Change in osmo-bsc[master]: bssap: pass whole tlv_parsed to event GSCON_EV_A_COMMON_ID_IND

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/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Apr 12 17:49:34 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/23733 )


Change subject: bssap: pass whole tlv_parsed to event GSCON_EV_A_COMMON_ID_IND
......................................................................

bssap: pass whole tlv_parsed to event GSCON_EV_A_COMMON_ID_IND

This change will allow handling more IEs in the future, like
"Last used E-UTRAN PLMN ID" one.

Related: SYS#5337
Change-Id: I96a0e1a7491fabf7aaad62207886821ad6194927
---
M src/osmo-bsc/bsc_subscr_conn_fsm.c
M src/osmo-bsc/osmo_bsc_bssap.c
2 files changed, 11 insertions(+), 12 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/33/23733/1

diff --git a/src/osmo-bsc/bsc_subscr_conn_fsm.c b/src/osmo-bsc/bsc_subscr_conn_fsm.c
index 954c6a5..827416b 100644
--- a/src/osmo-bsc/bsc_subscr_conn_fsm.c
+++ b/src/osmo-bsc/bsc_subscr_conn_fsm.c
@@ -809,7 +809,8 @@
 {
 	struct gsm_subscriber_connection *conn = fi->priv;
 	const struct gscon_clear_cmd_data *ccd;
-	struct osmo_mobile_identity *mi_imsi;
+	struct tlv_parsed *tp;
+	struct osmo_mobile_identity mi_imsi;
 
 	/* Regular allstate event processing */
 	switch (event) {
@@ -868,14 +869,19 @@
 		break;
 	case GSCON_EV_A_COMMON_ID_IND:
 		OSMO_ASSERT(data);
-		mi_imsi = data;
+		tp = data;
+		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(fi, LOGL_ERROR, "CommonID: could not parse IMSI\n");
+			return;
+		}
 		if (!conn->bsub)
-			conn->bsub = bsc_subscr_find_or_create_by_imsi(conn->network->bsc_subscribers, mi_imsi->imsi,
+			conn->bsub = bsc_subscr_find_or_create_by_imsi(conn->network->bsc_subscribers, mi_imsi.imsi,
 								       BSUB_USE_CONN);
 		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);
+				bsc_subscr_set_imsi(conn->bsub, mi_imsi.imsi);
 		}
 		gscon_update_id(conn);
 		break;
diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 9d78153..b558fae 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -1072,7 +1072,6 @@
 				   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);
 
@@ -1084,13 +1083,7 @@
 		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);
+	osmo_fsm_inst_dispatch(conn->fi, GSCON_EV_A_COMMON_ID_IND, &tp);
 
 	return 0;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/23733
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I96a0e1a7491fabf7aaad62207886821ad6194927
Gerrit-Change-Number: 23733
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210412/e3168bf8/attachment.htm>


More information about the gerrit-log mailing list