Change in osmo-gbproxy[master]: gbproxy: Forward MS_REGISTR_ENQ/_RESP correctly

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

daniel gerrit-no-reply at lists.osmocom.org
Tue Jul 6 12:06:58 UTC 2021


daniel has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-gbproxy/+/24859 )


Change subject: gbproxy: Forward MS_REGISTR_ENQ/_RESP correctly
......................................................................

gbproxy: Forward MS_REGISTR_ENQ/_RESP correctly

We need to save the BSS NSE <-> IMSI mapping to correctly route the
answer.

Related: OS#4472
Change-Id: I1908bbe8db11271dbd3f45b0d9f1bc0bfe48f239
---
M src/gb_proxy.c
1 file changed, 39 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-gbproxy refs/changes/59/24859/1

diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 8c8faf7..a80e5a9 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -1114,6 +1114,26 @@
 		rc = gbprox_relay2nse(msg, nse, 0);
 		break;
 	}
+	case BSSGP_PDUT_MS_REGISTR_ENQ:
+	{
+		struct gbproxy_sgsn *sgsn;
+		struct osmo_mobile_identity mi;
+		const uint8_t *mi_data = TLVP_VAL(&tp[0], BSSGP_IE_IMSI);
+		uint8_t mi_len = TLVP_LEN(&tp[0], BSSGP_IE_IMSI);
+		osmo_mobile_identity_decode(&mi, mi_data, mi_len, false);
+
+		sgsn = gbproxy_select_sgsn(nse->cfg, NULL);
+		if (!sgsn) {
+			LOGP(DGPRS, LOGL_ERROR, "Could not find any SGSN, dropping message!\n");
+			rc = -EINVAL;
+			break;
+		}
+
+		gbproxy_imsi_cache_update(nse, mi.imsi);
+
+		rc = gbprox_relay2nse(msg, sgsn->nse, 0);
+		break;
+	}
 	default:
 		LOGPNSE(nse, LOGL_ERROR, "Rx %s: Implementation missing\n", pdut_name);
 		break;
@@ -1444,6 +1464,25 @@
 	case BSSGP_PDUT_RAN_INFO_APP_ERROR:
 		rc = gbprox_rx_rim_from_sgsn(tp, nse, msg, log_pfx, pdut_name);
 		break;
+	case BSSGP_PDUT_MS_REGISTR_ENQ_RESP:
+	{
+		struct gbproxy_nse *nse_peer;
+		struct osmo_mobile_identity mi;
+		const uint8_t *mi_data = TLVP_VAL(&tp[0], BSSGP_IE_IMSI);
+		uint8_t mi_len = TLVP_LEN(&tp[0], BSSGP_IE_IMSI);
+		osmo_mobile_identity_decode(&mi, mi_data, mi_len, false);
+		nse_peer = gbproxy_nse_by_imsi(cfg, mi.imsi);
+		if (!nse_peer) {
+			LOGPNSE(nse, LOGL_ERROR, "Rx %s: Cannot find NSE\n", pdut_name);
+			return tx_status(nse, ns_bvci, BSSGP_CAUSE_INV_MAND_INF, NULL, msg);
+		} else if (nse_peer->sgsn_facing) {
+			LOGPNSE(nse, LOGL_ERROR, "Forwarding %s failed: IMSI cache contains SGSN NSE", pdut_name);
+			return tx_status(nse, ns_bvci, BSSGP_CAUSE_PROTO_ERR_UNSPEC, NULL, msg);
+		}
+		gbproxy_imsi_cache_remove(cfg, mi.imsi);
+		gbprox_relay2nse(msg, nse_peer, ns_bvci);
+		break;
+	}
 	default:
 		LOGPNSE(nse, LOGL_NOTICE, "Rx %s: Not supported\n", pdut_name);
 		rate_ctr_inc(rate_ctr_group_get_ctr(cfg->ctrg, GBPROX_GLOB_CTR_PROTO_ERR_SGSN));

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

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: I1908bbe8db11271dbd3f45b0d9f1bc0bfe48f239
Gerrit-Change-Number: 24859
Gerrit-PatchSet: 1
Gerrit-Owner: daniel <dwillmann at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210706/c572aa97/attachment.htm>


More information about the gerrit-log mailing list