[PATCH 6/7] gb: Use the NS-VCI to find an existing NS-VC

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/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Tue Oct 8 10:04:46 UTC 2013


Currently when a NS-RESET is recevied over a link that has not yet
been associated with a NS-VC, the NSEI is used to find an existing
NS-VC. If one is found, the reset procedure is initiated.

This behaviour is not conformant with 3GPP TS 08.16 (see chapter
4.2.3) which allows to use several NS-VC between two endpoints in
parallel.

The patch changes the implementation to use the NSVCI instead
of the NSEI to search for an existing NS-VC object.
---
 src/gb/gprs_ns.c         |    8 ++++----
 tests/gb/gprs_ns_test.ok |    7 ++++---
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/gb/gprs_ns.c b/src/gb/gprs_ns.c
index bba75bc..4414bd5 100644
--- a/src/gb/gprs_ns.c
+++ b/src/gb/gprs_ns.c
@@ -823,7 +823,7 @@ int gprs_ns_vc_create(struct gprs_ns_inst *nsi, struct msgb *msg,
 	struct gprs_nsvc *existing_nsvc;
 
 	struct tlv_parsed tp;
-	uint16_t nsei;
+	uint16_t nsvci;
 
 	int rc;
 
@@ -860,10 +860,10 @@ int gprs_ns_vc_create(struct gprs_ns_inst *nsi, struct msgb *msg,
 				  msg);
 		return -EINVAL;
 	}
-	nsei = ntohs(*(uint16_t *) TLVP_VAL(&tp, NS_IE_NSEI));
-	/* Check if we already know this NSEI, the remote end might
+	nsvci = ntohs(*(uint16_t *) TLVP_VAL(&tp, NS_IE_VCI));
+	/* Check if we already know this NSVCI, the remote end might
 	 * simply have changed addresses, or it is a SGSN */
-	existing_nsvc = gprs_nsvc_by_nsei(nsi, nsei);
+	existing_nsvc = gprs_nsvc_by_nsvci(nsi, nsvci);
 	if (!existing_nsvc) {
 		*new_nsvc = gprs_nsvc_create(nsi, 0xffff);
 		log_set_context(GPRS_CTX_NSVC, *new_nsvc);
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 049b5e6..578b905 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -68,6 +68,7 @@ result (RESET) = 9
 
 Current NS-VCIs:
     VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333
+    VCI 0x1122, NSEI 0x1122, peer 0x01020304:2222
 
 --- Peer port changes, RESET, NSEI changes ---
 
@@ -83,8 +84,8 @@ RESPONSE, msg length 1
 result (RESET) = 9
 
 Current NS-VCIs:
-    VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444
     VCI 0x3344, NSEI 0x1122, peer 0x01020304:3333
+    VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444
 
 --- Peer port 3333, RESET, VCI is changed back ---
 
@@ -100,8 +101,8 @@ RESPONSE, msg length 1
 result (RESET) = 9
 
 Current NS-VCIs:
-    VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333
+    VCI 0x1122, NSEI 0x3344, peer 0x01020304:4444
 
 --- Peer port 4444, RESET, NSEI is changed back ---
 
@@ -117,8 +118,8 @@ RESPONSE, msg length 1
 result (RESET) = 9
 
 Current NS-VCIs:
-    VCI 0x1122, NSEI 0x1122, peer 0x01020304:4444
     VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333
+    VCI 0x1122, NSEI 0x1122, peer 0x01020304:4444
 
 ===== NS protocol test END
 
-- 
1.7.9.5





More information about the OpenBSC mailing list