Change in osmo-gbproxy[master]: WIP rim support

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
Wed Feb 3 15:03:24 UTC 2021


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


Change subject: WIP rim support
......................................................................

WIP rim support

Change-Id: I11fbe29e73aa27ed5f87156ac612e6c0ad6ed788
---
M src/gb_proxy.c
1 file changed, 53 insertions(+), 4 deletions(-)



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

diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index 2dee5b2..bf5e544 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -46,6 +46,7 @@
 #include <osmocom/gprs/gprs_bssgp2.h>
 #include <osmocom/gprs/gprs_bssgp_bss.h>
 #include <osmocom/gprs/bssgp_bvc_fsm.h>
+#include <osmocom/gprs/protocol/gsm_08_18.h>
 
 #include <osmocom/gsm/gsm23236.h>
 #include <osmocom/gsm/gsm_utils.h>
@@ -973,9 +974,34 @@
 	case BSSGP_PDUT_RAN_INFO_ACK:
 	case BSSGP_PDUT_RAN_INFO_ERROR:
 	case BSSGP_PDUT_RAN_INFO_APP_ERROR:
-		/* FIXME: route based in RIM Routing IE */
-		rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg);
+	{
+		struct gbproxy_cell *cell;
+		struct gbproxy_sgsn *sgsn;
+		struct bssgp_rim_routing_info ri;
+
+		/* TODO: Check the RIM src addr and ensure it matches a Cell we have for this BSS */
+		/* Reply with STATUS if BSSGP didn't negotiate RIM feature */
+		/* FIXME: Check negotiated features
+		if (0) {
+			rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg);
+		} */
+
+		rc = bssgp_parse_rim_ri(&ri, TLVP_VAL(&tp, BSSGP_IE_RIM_ROUTING_INFO), TLVP_LEN(&tp, BSSGP_IE_RIM_ROUTING_INFO));
+
+		/* Check RIM destination addr */
+		if (ri.discr == BSSGP_RIM_ROUTING_INFO_GERAN) {
+			cell = gbproxy_cell_by_cellid(nse->cfg, &ri.geran.raid, ri.geran.cid);
+			if (cell) {
+				/* Destination is known by gbproxy, route directly */
+				return gbprox_relay2peer(msg, cell->bss_bvc, 0);
+			}
+		}
+		/* Otherwise pass on to a RIM-capable SGSN */
+		/* TODO: Check SGSN is RIM-capable */
+		sgsn = gbproxy_select_sgsn(nse->cfg, NULL);
+		gbprox_relay2nse(msg, sgsn->nse, 0);
 		break;
+	}
 	case BSSGP_PDUT_LLC_DISCARD:
 	case BSSGP_PDUT_FLUSH_LL_ACK:
 		/* route based on BVCI + TLLI */
@@ -1275,9 +1301,32 @@
 	case BSSGP_PDUT_RAN_INFO_ACK:
 	case BSSGP_PDUT_RAN_INFO_ERROR:
 	case BSSGP_PDUT_RAN_INFO_APP_ERROR:
-		/* FIXME: route based in RIM Routing IE */
-		rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg);
+	{
+		struct gbproxy_cell *cell;
+		struct bssgp_rim_routing_info ri;
+
+		/* Reply with STATUS if BSSGP didn't negotiate RIM feature */
+		/* FIXME: Check negotiated features
+		if (0) {
+			rc = bssgp_tx_status(BSSGP_CAUSE_PDU_INCOMP_FEAT, NULL, msg);
+		} */
+
+		rc = bssgp_parse_rim_ri(&ri, TLVP_VAL(&tp, BSSGP_IE_RIM_ROUTING_INFO), TLVP_LEN(&tp, BSSGP_IE_RIM_ROUTING_INFO));
+
+		/* Check RIM destination addr */
+		if (ri.discr == BSSGP_RIM_ROUTING_INFO_GERAN) {
+			cell = gbproxy_cell_by_cellid(cfg, &ri.geran.raid, ri.geran.cid);
+			if (!cell) {
+				/* TODO: Log error */
+			} else {
+				return gbprox_relay2peer(msg, cell->bss_bvc, 0);
+			}
+		}
+		/* If it's not a GERAN Cell or it's a Cell gbproxy doesn't know about: Return STATUS PDU with
+		 * "Unknown Destination Address" */
+		rc = bssgp_tx_status(BSSGP_CAUSE_UNKN_DST, NULL, msg);
 		break;
+	}
 	default:
 		LOGPNSE(nse, LOGL_NOTICE, "Rx %s: Not supported\n", pdut_name);
 		rate_ctr_inc(&cfg->ctrg->ctr[GBPROX_GLOB_CTR_PROTO_ERR_SGSN]);

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

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: I11fbe29e73aa27ed5f87156ac612e6c0ad6ed788
Gerrit-Change-Number: 22656
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/20210203/d4f62d32/attachment.htm>


More information about the gerrit-log mailing list