Change in osmo-gbproxy[master]: gb_proxy: Ensure cell info is up to date when receiving PTP-BVC reset

daniel gerrit-no-reply at lists.osmocom.org
Fri Apr 9 08:50:43 UTC 2021


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


Change subject: gb_proxy: Ensure cell info is up to date when receiving PTP-BVC reset
......................................................................

gb_proxy: Ensure cell info is up to date when receiving PTP-BVC reset

When a BSS resets its BVC and reuses a BVCI with a differente cell id
the SGSN BVC still has the old cell information.

This results in the SGSN receiving a BVC reset for the old cell which in
turn leads to all sorts of issues (probably also with paging) and
conflicting information since the cell info is also present in the
UL-UNITDATA and this is just passed through from the BSS.

Instead of reusing the old BVC on the SGSN side free any existing and create
new ones.

Change-Id: Ia94090a0133340b7b284df6ec5b36546da698b37
---
M src/gb_proxy.c
1 file changed, 23 insertions(+), 16 deletions(-)



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

diff --git a/src/gb_proxy.c b/src/gb_proxy.c
index c01c5c6..64b1397 100644
--- a/src/gb_proxy.c
+++ b/src/gb_proxy.c
@@ -685,26 +685,33 @@
 		bvc->cell->bss_bvc = bvc;
 	}
 
-	/* allocate (any missing) SGSN-side BVCs within the cell, and reset them */
+	/* Ensure we have the correct RA/CELL ID */
+	if (!gsm48_ra_equal(&bvc->cell->id.raid, ra_id)) {
+		LOGPBVC(bvc, LOGL_NOTICE, "RAID changed from %s to %s, updating cell\n", osmo_rai_name(&bvc->cell->id.raid), osmo_rai_name(ra_id));
+		memcpy(&bvc->cell->id.raid, ra_id, sizeof(*ra_id));
+	}
+	if (bvc->cell->id.cid != cell_id) {
+		LOGPBVC(bvc, LOGL_NOTICE, "CellID changed from %05d to %05d, updating cell\n", bvc->cell->id.cid, cell_id);
+		bvc->cell->id.cid = cell_id;
+	}
+
+	/* Reallocate SGSN-side BVCs of the cell, and reset them
+	 * Removing and reallocating is needed becaus the ra_id/cell_id might have changed */
 	hash_for_each(cfg->sgsn_nses, i, sgsn_nse, list) {
 		struct gbproxy_bvc *sgsn_bvc = gbproxy_bvc_by_bvci(sgsn_nse, bvci);
 		if (sgsn_bvc)
-			OSMO_ASSERT(sgsn_bvc->cell == bvc->cell || !sgsn_bvc->cell);
+			gbproxy_bvc_free(sgsn_bvc);
 
-		if (!sgsn_bvc) {
-			sgsn_bvc = gbproxy_bvc_alloc(sgsn_nse, bvci);
-			OSMO_ASSERT(sgsn_bvc);
-
-			sgsn_bvc->cell = bvc->cell;
-			memcpy(&sgsn_bvc->raid, &bvc->cell->id.raid, sizeof(sgsn_bvc->raid));
-			sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,
-								   bvci, ra_id, cell_id);
-			OSMO_ASSERT(sgsn_bvc->fi);
-			bssgp_bvc_fsm_set_max_pdu_len(sgsn_bvc->fi, sgsn_nse->max_sdu_len);
-			bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);
-
-			gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc);
-		}
+		sgsn_bvc = gbproxy_bvc_alloc(sgsn_nse, bvci);
+		OSMO_ASSERT(sgsn_bvc);
+		sgsn_bvc->cell = bvc->cell;
+		memcpy(&sgsn_bvc->raid, &bvc->cell->id.raid, sizeof(sgsn_bvc->raid));
+		sgsn_bvc->fi = bssgp_bvc_fsm_alloc_ptp_bss(sgsn_bvc, cfg->nsi, sgsn_nse->nsei,
+							   bvci, ra_id, cell_id);
+		OSMO_ASSERT(sgsn_bvc->fi);
+		bssgp_bvc_fsm_set_max_pdu_len(sgsn_bvc->fi, sgsn_nse->max_sdu_len);
+		bssgp_bvc_fsm_set_ops(sgsn_bvc->fi, &sgsn_ptp_bvc_fsm_ops, sgsn_bvc);
+		gbproxy_cell_add_sgsn_bvc(bvc->cell, sgsn_bvc);
 	}
 
 	/* Trigger outbound BVC-RESET procedure toward each SGSN */

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

Gerrit-Project: osmo-gbproxy
Gerrit-Branch: master
Gerrit-Change-Id: Ia94090a0133340b7b284df6ec5b36546da698b37
Gerrit-Change-Number: 23684
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/20210409/14fb86f9/attachment.htm>


More information about the gerrit-log mailing list