summaryrefslogtreecommitdiffstats
path: root/tests/gb
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-10-24 01:33:23 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2013-10-24 10:01:18 +0200
commit5405a104bbe7d3711fe6f19ea7d0fce50ef91147 (patch)
treed0bac56348b47cb2bf698e8d794d2cb1bc2c8801 /tests/gb
parent81d7c14756ee17c2748c3d34a198c640655fd0c6 (diff)
gb: Fix NS RESET/RESET_ACK abnormal cases
This changes the implementations for the reception of RESET and RESET_ACK to be compatible with 3GPP TS 08.16, 7.3.1: - Just send a RESET_ACK with correct values back to the SGSN when a RESET with an invalid NSVCI or NSEI has been received. - Check RESET_ACK for matching NSEI and NSVCI. - Ignore unexpected RESET_ACKs. In addition, use RESET_ACK from a BSS to update the BSS source address based on the NSVCI to be tolerant with changing UDP source addresses/ports. Sponsored-by: On-Waves ehf
Diffstat (limited to 'tests/gb')
-rw-r--r--tests/gb/gprs_ns_test.c6
-rw-r--r--tests/gb/gprs_ns_test.ok169
2 files changed, 74 insertions, 101 deletions
diff --git a/tests/gb/gprs_ns_test.c b/tests/gb/gprs_ns_test.c
index 3d0293eb..546c20a3 100644
--- a/tests/gb/gprs_ns_test.c
+++ b/tests/gb/gprs_ns_test.c
@@ -357,6 +357,12 @@ static int test_signal(unsigned int subsys, unsigned int signal,
gprs_ns_ll_str(nssd->old_nsvc));
break;
+ case S_NS_MISMATCH:
+ printf("==> got signal NS_MISMATCH: 0x%04x/%s pdu=%d, ie=%d\n",
+ nssd->nsvc->nsvci, gprs_ns_ll_str(nssd->nsvc),
+ nssd->pdu_type, nssd->ie_type);
+ break;
+
default:
printf("==> got signal %d, NS-VC 0x%04x/%s\n", signal,
nssd->nsvc->nsvci,
diff --git a/tests/gb/gprs_ns_test.ok b/tests/gb/gprs_ns_test.ok
index 96fbd380..a882488a 100644
--- a/tests/gb/gprs_ns_test.ok
+++ b/tests/gb/gprs_ns_test.ok
@@ -196,7 +196,7 @@ PROCESSING RESET from 0x01020304:3333
==> got signal NS_REPLACED: 0x1122/1.2.3.4:4444 -> 0x3344/1.2.3.4:3333
==> got signal NS_RESET, NS-VC 0x1122/1.2.3.4:3333
MESSAGE to BSS, msg length 9
-03 01 82 11 22 04 82 11 22
+03 01 82 11 22 04 82 33 44
MESSAGE to BSS, msg length 1
0a
@@ -205,9 +205,9 @@ result (RESET) = 9
Current NS-VCIs:
VCI 0x3344, NSEI 0x1122, peer 0x00000000:0, blocked
- VCI 0x1122, NSEI 0x1122, peer 0x01020304:3333, blocked
+ VCI 0x1122, NSEI 0x3344, peer 0x01020304:3333, blocked
NS-VC replaced other count: 1
- NS-VC changed NSEI : 2
+ NS-VC changed NSEI : 1
--- Peer port 4444, RESET, NSEI is changed back ---
@@ -340,35 +340,21 @@ MESSAGE to BSS, msg length 12
PROCESSING RESET_ACK from 0x01020304:2222
03 01 82 10 01 04 82 10 00
+==> got signal NS_REPLACED: 0x1001/1.2.3.4:1111 -> 0x2001/1.2.3.4:2222
MESSAGE to BSS, msg length 1
0a
result (RESET_ACK) = 1
Current NS-VCIs:
- VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222, blocked
- NS-VC Block count : 1
- VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
- NS-VC Block count : 1
+ VCI 0x2001, NSEI 0x2000, peer 0x00000000:0
+ VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+ NS-VC Block count : 2
+ NS-VC replaced other count: 1
--- Setup VC 2 SGSN -> BSS (hits NSEI 2) ---
-MESSAGE to BSS, msg length 12
-02 00 81 01 01 82 20 01 04 82 20 00
-
-PROCESSING RESET_ACK from 0x01020304:1111
-03 01 82 20 01 04 82 20 00
-
-MESSAGE to BSS, msg length 1
-0a
-
-result (RESET_ACK) = 1
-
-Current NS-VCIs:
- VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222, blocked
- NS-VC Block count : 1
- VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
- NS-VC Block count : 2
+Failed to send RESET to 0.0.0.0:0
--- Setup VC 1 SGSN -> BSS (hits NSEI 1) ---
@@ -384,10 +370,10 @@ MESSAGE to BSS, msg length 1
result (RESET_ACK) = 1
Current NS-VCIs:
- VCI 0x2001, NSEI 0x2000, peer 0x01020304:2222, blocked
- NS-VC Block count : 2
- VCI 0x1001, NSEI 0x1000, peer 0x01020304:1111, blocked
- NS-VC Block count : 2
+ VCI 0x2001, NSEI 0x2000, peer 0x00000000:0
+ VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+ NS-VC Block count : 3
+ NS-VC replaced other count: 1
--- Setup VC 2 BSS -> SGSN ---
@@ -396,7 +382,6 @@ Setup NS-VC: remote 0x01020304:1111, NSVCI 0x2001(8193), NSEI 0x2000(8192)
PROCESSING RESET from 0x01020304:1111
02 00 81 01 01 82 20 01 04 82 20 00
-==> got signal NS_REPLACED: 0x2001/1.2.3.4:2222 -> 0x1001/1.2.3.4:1111
==> got signal NS_RESET, NS-VC 0x2001/1.2.3.4:1111
MESSAGE to BSS, msg length 9
03 01 82 20 01 04 82 20 00
@@ -430,32 +415,27 @@ result (ALIVE_ACK) = 0
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
+ VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+ NS-VC Block count : 3
NS-VC replaced other count: 1
- VCI 0x1001, NSEI 0x1000, peer 0x00000000:0, blocked
- NS-VC Block count : 2
--- RESET with invalid NSEI, BSS -> SGSN ---
PROCESSING RESET from 0x01020304:2222
02 00 81 01 01 82 10 01 04 82 f0 00
-==> got signal NS_RESET, NS-VC 0x1001/1.2.3.4:2222
+==> got signal NS_MISMATCH: 0x1001/1.2.3.4:2222 pdu=2, ie=4
MESSAGE to BSS, msg length 9
-03 01 82 10 01 04 82 f0 00
+03 01 82 10 01 04 82 10 00
-MESSAGE to BSS, msg length 1
-0a
-
-result (RESET) = 9
+result (RESET) = 0
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
+ VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
+ NS-VC Block count : 3
NS-VC replaced other count: 1
- VCI 0x1001, NSEI 0xf000, peer 0x01020304:2222, blocked
- NS-VC Block count : 2
- NS-VC changed NSEI : 1
+ NSEI was invalid count : 1
--- RESET with invalid NSVCI, BSS -> SGSN ---
@@ -473,11 +453,10 @@ result (RESET) = 9
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
- NS-VC replaced other count: 1
VCI 0xf001, NSEI 0x1000, peer 0x01020304:2222, blocked
- NS-VC Block count : 2
- NS-VC changed NSEI : 1
+ NS-VC Block count : 3
+ NS-VC replaced other count: 1
+ NSEI was invalid count : 1
--- RESET with old NSEI, NSVCI, BSS -> SGSN ---
@@ -495,29 +474,24 @@ result (RESET) = 9
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
- NS-VC replaced other count: 1
VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
- NS-VC Block count : 2
- NS-VC changed NSEI : 1
+ NS-VC Block count : 3
+ NS-VC replaced other count: 1
+ NSEI was invalid count : 1
--- Unexpected RESET_ACK VC 1, BSS -> SGSN ---
PROCESSING RESET_ACK from 0x01020304:2222
03 01 82 10 01 04 82 10 00
-MESSAGE to BSS, msg length 1
-0a
-
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
- NS-VC replaced other count: 1
VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
NS-VC Block count : 3
- NS-VC changed NSEI : 1
+ NS-VC replaced other count: 1
+ NSEI was invalid count : 1
--- RESET_ACK with invalid NSEI, BSS -> SGSN ---
@@ -527,18 +501,15 @@ MESSAGE to BSS, msg length 12
PROCESSING RESET_ACK from 0x01020304:2222
03 01 82 10 01 04 82 f0 00
-MESSAGE to BSS, msg length 1
-0a
-
-result (RESET_ACK) = 1
+==> got signal NS_MISMATCH: 0x1001/1.2.3.4:2222 pdu=3, ie=4
+result (RESET_ACK) = -22
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
- NS-VC replaced other count: 1
VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
- NS-VC Block count : 4
- NS-VC changed NSEI : 1
+ NS-VC Block count : 3
+ NS-VC replaced other count: 1
+ NSEI was invalid count : 2
--- RESET_ACK with invalid NSVCI, BSS -> SGSN ---
@@ -548,18 +519,16 @@ MESSAGE to BSS, msg length 12
PROCESSING RESET_ACK from 0x01020304:2222
03 01 82 f0 01 04 82 10 00
-MESSAGE to BSS, msg length 1
-0a
-
-result (RESET_ACK) = 1
+==> got signal NS_MISMATCH: 0x1001/1.2.3.4:2222 pdu=3, ie=1
+result (RESET_ACK) = -22
Current NS-VCIs:
VCI 0x2001, NSEI 0x2000, peer 0x01020304:1111
- NS-VC Block count : 2
- NS-VC replaced other count: 1
VCI 0x1001, NSEI 0x1000, peer 0x01020304:2222, blocked
- NS-VC Block count : 5
- NS-VC changed NSEI : 1
+ NS-VC Block count : 3
+ NS-VC replaced other count: 1
+ NS-VCI was invalid count : 1
+ NSEI was invalid count : 2
Current NS-VCIs:
@@ -617,36 +586,33 @@ Current NS-VCIs:
PROCESSING RESET from 0x05060708:32000
02 00 81 01 01 82 01 01 04 82 f0 00
-==> got signal NS_RESET, NS-VC 0x0101/5.6.7.8:32000
+==> got signal NS_MISMATCH: 0x0101/5.6.7.8:32000 pdu=2, ie=4
MESSAGE to SGSN, msg length 9
-03 01 82 01 01 04 82 f0 00
-
-MESSAGE to SGSN, msg length 1
-0a
+03 01 82 01 01 04 82 01 00
-result (RESET) = 9
+result (RESET) = 0
Current NS-VCIs:
- VCI 0x0101, NSEI 0xf000, peer 0x05060708:32000, blocked
+ VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
NS-VC Block count : 1
+ NSEI was invalid count : 1
--- RESET with invalid NSVCI, SGSN -> BSS ---
PROCESSING RESET from 0x05060708:32000
02 00 81 01 01 82 f0 01 04 82 01 00
-==> got signal NS_RESET, NS-VC 0xf001/5.6.7.8:32000
+==> got signal NS_MISMATCH: 0x0101/5.6.7.8:32000 pdu=2, ie=1
MESSAGE to SGSN, msg length 9
-03 01 82 f0 01 04 82 01 00
-
-MESSAGE to SGSN, msg length 1
-0a
+03 01 82 01 01 04 82 01 00
-result (RESET) = 9
+result (RESET) = 0
Current NS-VCIs:
- VCI 0xf001, NSEI 0x0100, peer 0x05060708:32000, blocked
+ VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
NS-VC Block count : 1
+ NS-VCI was invalid count : 1
+ NSEI was invalid count : 1
--- RESET, SGSN -> BSS ---
@@ -665,20 +631,21 @@ result (RESET) = 9
Current NS-VCIs:
VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
NS-VC Block count : 1
+ NS-VCI was invalid count : 1
+ NSEI was invalid count : 1
--- Unexpected RESET_ACK VC 1, BSS -> SGSN ---
PROCESSING RESET_ACK from 0x05060708:32000
03 01 82 01 01 04 82 01 00
-MESSAGE to SGSN, msg length 1
-0a
-
-result (RESET_ACK) = 1
+result (RESET_ACK) = 0
Current NS-VCIs:
VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
- NS-VC Block count : 2
+ NS-VC Block count : 1
+ NS-VCI was invalid count : 1
+ NSEI was invalid count : 1
--- RESET_ACK with invalid NSEI, BSS -> SGSN ---
@@ -688,14 +655,14 @@ MESSAGE to SGSN, msg length 12
PROCESSING RESET_ACK from 0x05060708:32000
03 01 82 01 01 04 82 e0 00
-MESSAGE to SGSN, msg length 1
-0a
-
-result (RESET_ACK) = 1
+==> got signal NS_MISMATCH: 0x0101/5.6.7.8:32000 pdu=3, ie=4
+result (RESET_ACK) = -22
Current NS-VCIs:
VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
- NS-VC Block count : 3
+ NS-VC Block count : 1
+ NS-VCI was invalid count : 1
+ NSEI was invalid count : 2
--- RESET_ACK with invalid NSVCI, BSS -> SGSN ---
@@ -705,14 +672,14 @@ MESSAGE to SGSN, msg length 12
PROCESSING RESET_ACK from 0x05060708:32000
03 01 82 e0 01 04 82 01 00
-MESSAGE to SGSN, msg length 1
-0a
-
-result (RESET_ACK) = 1
+==> got signal NS_MISMATCH: 0x0101/5.6.7.8:32000 pdu=3, ie=1
+result (RESET_ACK) = -22
Current NS-VCIs:
VCI 0x0101, NSEI 0x0100, peer 0x05060708:32000, blocked
- NS-VC Block count : 4
+ NS-VC Block count : 1
+ NS-VCI was invalid count : 2
+ NSEI was invalid count : 2
Current NS-VCIs: