This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
laforge gerrit-no-reply at lists.osmocom.orglaforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/18942 ) Change subject: Implement support for receiving BSSMAP CommonID from MSC ...................................................................... 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 --- M include/osmocom/bsc/bsc_msc_data.h M include/osmocom/bsc/bsc_subscr_conn_fsm.h M src/osmo-bsc/bsc_subscr_conn_fsm.c M src/osmo-bsc/osmo_bsc_bssap.c M src/osmo-bsc/osmo_bsc_msc.c 5 files changed, 55 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/42/18942/1 diff --git a/include/osmocom/bsc/bsc_msc_data.h b/include/osmocom/bsc/bsc_msc_data.h index b1fe14d..43ace25 100644 --- a/include/osmocom/bsc/bsc_msc_data.h +++ b/include/osmocom/bsc/bsc_msc_data.h @@ -64,6 +64,7 @@ MSC_CTR_BSSMAP_RX_DT1_HANDOVER_CMD, MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST, MSC_CTR_BSSMAP_RX_DT1_CONFUSION, + MSC_CTR_BSSMAP_RX_DT1_COMMON_ID, MSC_CTR_BSSMAP_RX_DT1_UNKNOWN, MSC_CTR_BSSMAP_RX_DT1_DTAP, MSC_CTR_BSSMAP_RX_DT1_DTAP_ERROR, diff --git a/include/osmocom/bsc/bsc_subscr_conn_fsm.h b/include/osmocom/bsc/bsc_subscr_conn_fsm.h index 5475272..1c88e42 100644 --- a/include/osmocom/bsc/bsc_subscr_conn_fsm.h +++ b/include/osmocom/bsc/bsc_subscr_conn_fsm.h @@ -12,6 +12,8 @@ GSCON_EV_A_CLEAR_CMD, /* MSC SCCP disconnect indication */ GSCON_EV_A_DISC_IND, + /* MSC has sent a BSSMAP COMMON ID */ + GSCON_EV_A_COMMON_ID_IND, GSCON_EV_ASSIGNMENT_START, GSCON_EV_ASSIGNMENT_END, diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c index 1d30246..b723526 100644 --- a/src/osmo-bsc/bsc_subscr_conn_fsm.c +++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c @@ -72,6 +72,7 @@ {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"}, @@ -746,6 +747,7 @@ static void gscon_fsm_allstate(struct osmo_fsm_inst *fi, uint32_t event, void *data) { struct gsm_subscriber_connection *conn = fi->priv; + struct osmo_mobile_identity *mi_imsi; /* Regular allstate event processing */ switch (event) { @@ -788,6 +790,17 @@ break; case GSCON_EV_LCLS_FAIL: break; + case GSCON_EV_A_COMMON_ID_IND: + 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; @@ -879,7 +892,8 @@ .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), diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c index 6b225e4..6cbe6fb 100644 --- a/src/osmo-bsc/osmo_bsc_bssap.c +++ b/src/osmo-bsc/osmo_bsc_bssap.c @@ -1060,6 +1060,38 @@ return 0; } +/* Common ID; 3GPP TS 48.008 3.2.1.68 */ +static int bssmap_handle_common_id(struct gsm_subscriber_connection *conn, + struct msgb *msg, unsigned int length) +{ + struct tlv_parsed tp; + struct osmo_mobile_identity mi_imsi; + + osmo_bssap_tlv_parse(&tp, msg->l4h + 1, length - 1); + + /* Check for the mandatory elements */ + if (!TLVP_PRESENT(&tp, GSM0808_IE_IMSI)) { + LOGPFSML(conn->fi, LOGL_ERROR, + "CommonID: missing mandatory IMSI IE: %s\n", + osmo_hexdump(msg->l4h, length)); + return -EINVAL; + } else if ((TLVP_VAL(&tp, GSM0808_IE_IMSI)[0] & GSM_MI_TYPE_MASK) != GSM_MI_TYPE_IMSI) { + LOGPFSML(conn->fi, LOGL_ERROR, "CommonID: Wrong content in the IMSI IE\n"); + return -EINVAL; + } + + if (osmo_mobile_identity_decode(&mi_imsi, TLVP_VAL(&tp, GSM0808_IE_IMSI), TLVP_LEN(&tp, GSM0808_IE_IMSI), false) + || mi_imsi.type != GSM_MI_TYPE_IMSI) { + LOGPFSML(conn->fi, LOGL_ERROR, "CommonID: could not parse IMSI\n"); + return -EINVAL; + } + + osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_COMMON_ID_IND, &mi_imsi); + + return 0; +} + + static int bssmap_rcvmsg_udt(struct bsc_msc_data *msc, struct msgb *msg, unsigned int length) { @@ -1140,6 +1172,10 @@ rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DT1_CONFUSION]); ret = bssmap_handle_confusion(conn, msg, length); break; + case BSS_MAP_MSG_COMMON_ID: + rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DT1_COMMON_ID]); + ret = bssmap_handle_common_id(conn, msg, length); + break; default: rate_ctr_inc(&ctrs[MSC_CTR_BSSMAP_RX_DT1_UNKNOWN]); LOGP(DMSC, LOGL_NOTICE, "Unimplemented msg type: %s\n", diff --git a/src/osmo-bsc/osmo_bsc_msc.c b/src/osmo-bsc/osmo_bsc_msc.c index 9b00ffc..aa2a671 100644 --- a/src/osmo-bsc/osmo_bsc_msc.c +++ b/src/osmo-bsc/osmo_bsc_msc.c @@ -57,6 +57,7 @@ [MSC_CTR_BSSMAP_RX_DT1_HANDOVER_CMD] = {"bssmap:rx:dt1:handover:cmd", "Number of received BSSMAP DT1 HANDOVER CMD messages"}, [MSC_CTR_BSSMAP_RX_DT1_CLASSMARK_RQST] = {"bssmap:rx:dt1:classmark:rqst", "Number of received BSSMAP DT1 CLASSMARK RQST messages"}, [MSC_CTR_BSSMAP_RX_DT1_CONFUSION] = {"bssmap:rx:dt1:confusion", "Number of received BSSMAP DT1 CONFUSION messages"}, + [MSC_CTR_BSSMAP_RX_DT1_COMMON_ID] = {"bssmap:rx:dt1:common_id", "Number of received BSSMAP DT1 COMMON ID messages"}, [MSC_CTR_BSSMAP_RX_DT1_UNKNOWN] = {"bssmap:rx:dt1:err_unknown", "Number of received BSSMAP unknown DT1 messages"}, [MSC_CTR_BSSMAP_RX_DT1_DTAP] = {"bssmap:rx:dt1:dtap:good", "Number of received BSSMAP DTAP messages"}, [MSC_CTR_BSSMAP_RX_DT1_DTAP_ERROR] = {"bssmap:rx:dt1:dtap:error", "Number of received BSSMAP DTAP messages with errors"}, -- To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/18942 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Change-Id: I52c43fb940f0db796adf4c0adb2260321c721c39 Gerrit-Change-Number: 18942 Gerrit-PatchSet: 1 Gerrit-Owner: laforge <laforge at osmocom.org> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200621/0d678693/attachment.htm>