diff options
authorNeels Hofmeyr <neels@hofmeyr.de>2020-08-29 23:01:44 +0000
committerNeels Hofmeyr <neels@hofmeyr.de>2020-08-31 18:01:17 +0200
commit90f7c3c08db3ca0150540262c47241b850133f96 (patch)
parentdbe59f69a4159846731bc2376c333b0059c39ed9 (diff)
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
2 files changed, 9 insertions, 0 deletions
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) {
+ conn->rx_clear_command = true;
ccd = data;
if (conn->lchan)