aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2021-08-02 02:04:02 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2021-08-09 17:47:44 +0200
commit4bf2297b2f29231e3b4cf61f48ac23ec20753d4c (patch)
tree0edda342a5475040a788666f32821016f4625cbe
parentc96c05f07b4692d2707f4706e945939a66646665 (diff)
fix gscon clear 1/n: store clear cause in gscon
Allows returning a context sensitive cause instead of a hardcoded one in gscon pre_term(). The conn->cause is needed to move message dispatch to an "onenter" function in patch I234b2a754d0c98031056981823cdbc187e977741 Split off as a separate patch for better readability. Change-Id: Ib6432746040899129d1d73ae8dc59add2d88a915
-rw-r--r--include/osmocom/bsc/gsm_data.h2
-rw-r--r--src/osmo-bsc/bsc_subscr_conn_fsm.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 5a20e72d2..159aa7a53 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -395,6 +395,8 @@ struct gsm_subscriber_connection {
bool last_eutran_plmn_valid; /* Is information stored in field below available? */
struct osmo_plmn_id last_eutran_plmn;
} fast_return;
+
+ enum gsm0808_cause clear_cause;
};
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index afb633dc3..1be8ddf9f 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -143,6 +143,7 @@ static void gscon_bssmap_clear(struct gsm_subscriber_connection *conn,
struct msgb *resp;
int rc;
+ conn->clear_cause = cause;
if (conn->rx_clear_command) {
LOGPFSML(conn->fi, LOGL_DEBUG, "Not sending BSSMAP CLEAR REQUEST, already got CLEAR COMMAND from MSC\n");
@@ -950,9 +951,7 @@ static void gscon_pre_term(struct osmo_fsm_inst *fi, enum osmo_fsm_term_cause ca
}
LOGPFSML(fi, LOGL_DEBUG, "Releasing all lchans (if any) because this conn is terminating\n");
- /* when things go smoothly, the lchan should have been released before FSM instance termination. So if this is
- * necessary it's probably "abnormal". */
- gscon_release_lchans(conn, true, GSM48_RR_CAUSE_ABNORMAL_UNSPEC);
+ gscon_release_lchans(conn, true, bsc_gsm48_rr_cause_from_gsm0808_cause(conn->clear_cause));
/* drop pending messages */
gscon_dtap_queue_flush(conn, 0);
@@ -1031,6 +1030,9 @@ struct gsm_subscriber_connection *bsc_subscr_con_allocate(struct gsm_network *ne
INIT_LLIST_HEAD(&conn->hodec2.penalty_timers);
conn->sccp.conn_id = -1;
+ /* Default clear cause (on RR translates to GSM48_RR_CAUSE_ABNORMAL_UNSPEC) */
+ conn->clear_cause = GSM0808_CAUSE_EQUIPMENT_FAILURE;
+
/* don't allocate from 'conn' context, as gscon_cleanup() will call talloc_free(conn) before
* libosmocore will call talloc_free(conn->fi), i.e. avoid use-after-free during cleanup */
conn->fi = osmo_fsm_inst_alloc(&gscon_fsm, net, conn, LOGL_DEBUG, NULL);