aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/libbsc/abis_rsl.c32
-rw-r--r--src/osmo-bsc/osmo_bsc_api.c3
2 files changed, 29 insertions, 6 deletions
diff --git a/src/libbsc/abis_rsl.c b/src/libbsc/abis_rsl.c
index 7400f896e..9ec4f2d35 100644
--- a/src/libbsc/abis_rsl.c
+++ b/src/libbsc/abis_rsl.c
@@ -2125,13 +2125,33 @@ static void rsl_handle_release(struct gsm_lchan *lchan)
int sapi;
struct gsm_bts *bts;
- /*
- * Maybe only one link/SAPI was releasd or the error handling
- * was activated. Just return now and let the other code handle
- * it.
- */
- if (lchan->state != LCHAN_S_REL_REQ)
+ if (lchan->state == LCHAN_S_NONE) {
+ LOGP(DRSL, LOGL_ERROR, "%s Release requested for an unused lchan\n",
+ gsm_lchan_name(lchan));
+ return;
+ }
+
+ if (lchan->state != LCHAN_S_REL_REQ) {
+ /* The MS asked us to release. */
+ struct bsc_api *bsc_api = lchan->ts->trx->bts->network->bsc_api;
+ if (!bsc_api || !bsc_api->clear_request) {
+ LOGP(DRSL, LOGL_ERROR, "%s FATAL: no bsc_api to dispatch Clear Request\n",
+ gsm_lchan_name(lchan));
+ return;
+ }
+ rsl_lchan_set_state(lchan, LCHAN_S_REL_REQ);
+
+ if (!lchan->conn) {
+ /* No conn exists, release the lchan right away */
+ lchan->state = LCHAN_S_REL_REQ;
+ rsl_rf_chan_release(lchan, 0, SACCH_NONE);
+ return;
+ }
+
+ /* Kick off a BSSAP Clear Request followed by a full teardown via MSC. */
+ bsc_api->clear_request(lchan->conn, 0);
return;
+ }
for (sapi = 0; sapi < ARRAY_SIZE(lchan->sapis); ++sapi) {
if (lchan->sapis[sapi] == LCHAN_SAPI_UNUSED)
diff --git a/src/osmo-bsc/osmo_bsc_api.c b/src/osmo-bsc/osmo_bsc_api.c
index 75dae1293..b87711d27 100644
--- a/src/osmo-bsc/osmo_bsc_api.c
+++ b/src/osmo-bsc/osmo_bsc_api.c
@@ -449,6 +449,9 @@ static void bsc_assign_fail(struct gsm_subscriber_connection *conn,
static int bsc_clear_request(struct gsm_subscriber_connection *conn, uint32_t cause)
{
struct msgb *resp;
+ if (!conn)
+ return 1;
+
return_when_not_connected_val(conn, 1);
LOGP(DMSC, LOGL_INFO, "Tx MSC CLEAR REQUEST\n");