diff options
author | Harald Welte <laforge@osmocom.org> | 2020-06-21 18:00:23 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2020-08-17 13:04:03 +0200 |
commit | 210aa95d4967748a5899a2070db8e3e703a92e2a (patch) | |
tree | c517fc6ade6fa03bf51addebfeb845a29cfe1f38 /src/osmo-bsc/bsc_subscr_conn_fsm.c | |
parent | fe12b70ce5db384d56adc011292346c511ed9446 (diff) |
Implement support for receiving BSSMAP CommonID from MSC
The MSC may at any time send a BSSMAP CommonID message via a
SCCP connection to inform us of the IMSI of the subscriber. Let's
make use of that information by associating a related bsc_subscr
and updating the identity of the bsc_subscr_conn_fsm for improved
logging / filtering.
Closes: OS#2969
Change-Id: I52c43fb940f0db796adf4c0adb2260321c721c39
Diffstat (limited to 'src/osmo-bsc/bsc_subscr_conn_fsm.c')
-rw-r--r-- | src/osmo-bsc/bsc_subscr_conn_fsm.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index 6a35c755d..bd0b53468 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -73,6 +73,7 @@ static const struct value_string gscon_fsm_event_names[] = { {GSCON_EV_A_CONN_CFM, "MO-CONNECT.cfm"}, {GSCON_EV_A_CLEAR_CMD, "CLEAR_CMD"}, {GSCON_EV_A_DISC_IND, "DISCONNET.ind"}, + {GSCON_EV_A_COMMON_ID_IND, "COMMON_ID.ind"}, {GSCON_EV_ASSIGNMENT_START, "ASSIGNMENT_START"}, {GSCON_EV_ASSIGNMENT_END, "ASSIGNMENT_END"}, {GSCON_EV_HANDOVER_START, "HANDOVER_START"}, @@ -759,6 +760,7 @@ static void gscon_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *d { struct gsm_subscriber_connection *conn = fi->priv; const struct gscon_clear_cmd_data *ccd; + struct osmo_mobile_identity *mi_imsi; /* Regular allstate event processing */ switch (event) { @@ -805,6 +807,18 @@ static void gscon_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *d break; case GSCON_EV_LCLS_FAIL: break; + case GSCON_EV_A_COMMON_ID_IND: + OSMO_ASSERT(data); + mi_imsi = data; + if (!conn->bsub) + conn->bsub = bsc_subscr_find_or_create_by_imsi(conn->network->bsc_subscribers, mi_imsi->imsi); + else { + /* we already have a bsc_subscr associated; maybe that subscriber has no IMSI yet? */ + if (!conn->bsub->imsi[0]) + bsc_subscr_set_imsi(conn->bsub, mi_imsi->imsi); + } + gscon_update_id(conn); + break; default: OSMO_ASSERT(false); break; @@ -898,7 +912,8 @@ static struct osmo_fsm gscon_fsm = { .name = "SUBSCR_CONN", .states = gscon_fsm_states, .num_states = ARRAY_SIZE(gscon_fsm_states), - .allstate_event_mask = S(GSCON_EV_A_DISC_IND) | S(GSCON_EV_A_CLEAR_CMD) | S(GSCON_EV_RSL_CONN_FAIL) | + .allstate_event_mask = S(GSCON_EV_A_DISC_IND) | S(GSCON_EV_A_CLEAR_CMD) | S(GSCON_EV_A_COMMON_ID_IND) | + S(GSCON_EV_RSL_CONN_FAIL) | S(GSCON_EV_LCLS_FAIL) | S(GSCON_EV_FORGET_LCHAN) | S(GSCON_EV_FORGET_MGW_ENDPOINT), |