From 90f7c3c08db3ca0150540262c47241b850133f96 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sat, 29 Aug 2020 23:01:44 +0000 Subject: bssap: do not send a Clear Request after a Clear Command During handover cleanup due to a Clear Command from the MSC, do not send another Clear Request to the MSC. Only send that when no Clear Command was received yet. Add a flag rx_clear_command per gscon instance, indicating whether a Clear Command was received, and exit early in gscon_bssmap_clear() when true. This is part of patches fixing the rate counters around handover, which uncover some bugs: - Another patch enables proper handover result handling when receiving a Clear Command. - After that, the handover_end() handling would always cause sending a Clear Request, even if a Clear Command was already received. - This patch removes the extraneous Clear Request, for this scenario and for all other corner cases that might still exist. Related: OS#4736 Change-Id: Iab82cac0a7ffa7d36338c8ff7c0618a813025f13 --- include/osmocom/bsc/gsm_data.h | 2 ++ src/osmo-bsc/bsc_subscr_conn_fsm.c | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h index 09c02146f..ca96c56e1 100644 --- a/include/osmocom/bsc/gsm_data.h +++ b/include/osmocom/bsc/gsm_data.h @@ -303,6 +303,8 @@ struct gsm_subscriber_connection { /* MS Power Class, TS 05.05 sec 4.1.1 "Mobile station". 0 means unset. */ uint8_t ms_power_class:3; + + bool rx_clear_command; }; diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index 281ab7177..e7c6efe09 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -141,6 +141,11 @@ static void gscon_bssmap_clear(struct gsm_subscriber_connection *conn, struct msgb *resp; int rc; + if (conn->rx_clear_command) { + LOGPFSML(conn->fi, LOGL_DEBUG, "Not sending BSSMAP CLEAR REQUEST, already got CLEAR COMMAND from MSC\n"); + return; + } + LOGPFSML(conn->fi, LOGL_DEBUG, "Tx BSSMAP CLEAR REQUEST(%s) to MSC\n", gsm0808_cause_name(cause)); resp = gsm0808_create_clear_rqst(cause); if (!resp) { @@ -764,6 +769,8 @@ static void gscon_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *d /* Regular allstate event processing */ switch (event) { case GSCON_EV_A_CLEAR_CMD: + conn->rx_clear_command = true; + OSMO_ASSERT(data); ccd = data; if (conn->lchan) -- cgit v1.2.3