aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/gbproxy
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-12 10:33:38 +0200
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-09-18 11:26:07 +0200
commit991606b57a613e806e3db3be02864508f593cb27 (patch)
treec6199e30e11ab72722da3e6a0568e65393c49923 /openbsc/tests/gbproxy
parent2fd1ba4c6d17e9b7fef80a39a951674c541d1cf7 (diff)
gbproxy/test: Add/modify test cases
Add a Attach Request message to test_gbproxy_ra_patching, where the BSSGP RAI differs from the old RAI signalled in the LLC part. This case had not been tested explicitely yet. Change the RAI in the first Attach Request in test_gbproxy_imsi_acquisition from rai_unknown to rai_bss. Add Detach Requests to test_gbproxy_imsi_acquisition, one for a incomplete attach procedure and one for an unknown (fresh) TLLI. In these cases, the acquisition of a IMSI is not necessary and also doesn't work properly with an E71. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/tests/gbproxy')
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.c36
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.ok61
2 files changed, 88 insertions, 9 deletions
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index bb2e3e5f3..1521c5fb7 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -183,6 +183,16 @@ static const unsigned char dtap_attach_req[] = {
0xc6, 0x62, 0x00, 0x60, 0x80, 0x00,
};
+/* DTAP - Attach Request (invalid RAI) */
+static const unsigned char dtap_attach_req2[] = {
+ 0x08, 0x01, 0x02, 0xf5, 0xe0, 0x21, 0x08, 0x02,
+ 0x05, 0xf4, 0xfb, 0x00, 0xbe, 0xef, 0x99, 0x99,
+ 0x99, 0x40, 0x50, 0x60, 0x19, 0x18, 0xb3, 0x43,
+ 0x2b, 0x25, 0x96, 0x62, 0x00, 0x60, 0x80, 0x9a,
+ 0xc2, 0xc6, 0x62, 0x00, 0x60, 0x80, 0xba, 0xc8,
+ 0xc6, 0x62, 0x00, 0x60, 0x80, 0x00,
+};
+
/* DTAP - Identity Request */
static const unsigned char dtap_identity_req[] = {
0x08, 0x15, 0x01
@@ -1329,6 +1339,7 @@ static void test_gbproxy_ra_patching()
const uint32_t ptmsi = 0xefe2b700;
const uint32_t local_tlli = 0xefe2b700;
const uint32_t foreign_tlli = 0xbbc54679;
+ const uint32_t foreign_tlli2 = 0xbb00beef;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
struct gbproxy_tlli_info *tlli_info;
struct gbproxy_peer *peer;
@@ -1530,6 +1541,14 @@ static void test_gbproxy_ra_patching()
printf("--- Bad cases ---\n\n");
+ /* The RAI in the Attach Request message differs from the RAI in the
+ * BSSGP message, only patch the latter */
+
+ send_llc_ul_ui(nsi, "ATTACH REQUEST (foreign RAI)", &bss_peer[0], 0x1002,
+ foreign_tlli2, &rai_bss, cell_id,
+ GPRS_SAPI_GMM, 0,
+ dtap_attach_req2, sizeof(dtap_attach_req2));
+
printf("TLLI is already detached, shouldn't patch\n");
send_llc_ul_ui(nsi, "ACT PDP CTX REQ", &bss_peer[0], 0x1002,
local_tlli, &rai_bss, cell_id,
@@ -1896,6 +1915,7 @@ static void test_gbproxy_imsi_acquisition()
const uint32_t bss_ptmsi = 0xc00f7304;
const uint32_t local_bss_tlli = 0xc00f7304;
const uint32_t foreign_bss_tlli = 0x8000dead;
+ const uint32_t other_bss_tlli = 0x8000beef;
const uint8_t imsi[] = {0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18};
struct gbproxy_tlli_info *tlli_info;
@@ -1942,7 +1962,7 @@ static void test_gbproxy_imsi_acquisition()
printf("--- Send message from BSS 1 to SGSN, BVCI 0x1002 ---\n\n");
send_llc_ul_ui(nsi, "ATTACH REQUEST", &bss_peer[0], 0x1002,
- foreign_bss_tlli, &rai_unknown, cell_id,
+ foreign_bss_tlli, &rai_bss, cell_id,
GPRS_SAPI_GMM, bss_nu++,
dtap_attach_req, sizeof(dtap_attach_req));
@@ -2104,6 +2124,20 @@ static void test_gbproxy_imsi_acquisition()
GPRS_SAPI_GMM, bss_nu++,
dtap_attach_req, sizeof(dtap_attach_req));
+ send_llc_ul_ui(nsi, "DETACH REQ", &bss_peer[0], 0x1002,
+ foreign_bss_tlli, &rai_bss, cell_id,
+ GPRS_SAPI_GMM, bss_nu++,
+ dtap_detach_req, sizeof(dtap_detach_req));
+
+ dump_peers(stdout, 0, 0, &gbcfg);
+
+ /* Special case: Detach from an unknown TLLI */
+
+ send_llc_ul_ui(nsi, "DETACH REQ (unknown TLLI)", &bss_peer[0], 0x1002,
+ other_bss_tlli, &rai_bss, cell_id,
+ GPRS_SAPI_GMM, bss_nu++,
+ dtap_detach_req, sizeof(dtap_detach_req));
+
dump_peers(stdout, 0, 0, &gbcfg);
dump_global(stdout, 0);
diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok
index 5ba31bb8d..4a0956112 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.ok
+++ b/openbsc/tests/gbproxy/gbproxy_test.ok
@@ -1858,6 +1858,18 @@ Peers:
TLLI-Cache: 0
--- Bad cases ---
+PROCESSING ATTACH REQUEST (foreign RAI) from 0x01020304:1111
+00 00 10 02 01 bb 00 be ef 00 00 04 08 88 11 22 33 40 50 60 75 30 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb 00 be ef 99 99 99 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 2d c7 df
+
+CALLBACK, event 0, msg length 75, bvci 0x1002
+00 00 10 02 01 bb 00 be ef 00 00 04 08 88 11 22 33 40 50 60 75 30 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb 00 be ef 99 99 99 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 2d c7 df
+
+NS UNITDATA MESSAGE to SGSN, BVCI 0x1002, msg length 75 (gprs_ns_sendmsg)
+MESSAGE to SGSN at 0x05060708:32000, msg length 79
+00 00 10 02 01 bb 00 be ef 00 00 04 08 88 21 63 54 40 50 60 75 30 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb 00 be ef 99 99 99 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 2d c7 df
+
+result (ATTACH REQUEST (foreign RAI)) = 79
+
TLLI is already detached, shouldn't patch
PROCESSING ACT PDP CTX REQ from 0x01020304:1111
00 00 10 02 01 ef e2 b7 00 00 00 04 08 88 11 22 33 40 50 60 75 30 00 80 0e 00 35 01 c0 0d 0a 41 05 03 0c 00 00 1f 10 00 00 00 00 00 00 00 00 02 01 21 28 03 02 61 62 27 14 80 80 21 10 01 00 00 10 81 06 00 00 00 00 83 06 00 00 00 00 5a ff 02
@@ -1889,14 +1901,15 @@ Gbproxy global:
Patch error: no peer : 1
Peers:
NSEI 4096, BVCI 4098, not blocked, RAI 112-332-16464-96
- RAID patched (BSS ): 15
+ RAID patched (BSS ): 16
RAID patched (SGSN): 3
APN patched : 4
- Attach Request count : 1
+ Attach Request count : 2
TLLI from SGSN unknown : 1
- TLLI cache size : 1
- TLLI-Cache: 1
+ TLLI cache size : 2
+ TLLI-Cache: 2
TLLI efe2b700 -> efe2b700, IMSI (none), AGE 0
+ TLLI bb00beef -> bb00beef, IMSI (none), AGE 0
=== test_gbproxy_ptmsi_patching ===
--- Initialise SGSN ---
@@ -2643,10 +2656,10 @@ Peers:
--- Send message from BSS 1 to SGSN, BVCI 0x1002 ---
PROCESSING ATTACH REQUEST from 0x01020304:1111
-00 00 10 02 01 80 00 de ad 00 00 04 08 88 00 f1 99 00 63 60 12 34 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 16 6d 01
+00 00 10 02 01 80 00 de ad 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 16 6d 01
CALLBACK, event 0, msg length 75, bvci 0x1002
-00 00 10 02 01 80 00 de ad 00 00 04 08 88 00 f1 99 00 63 60 12 34 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 16 6d 01
+00 00 10 02 01 80 00 de ad 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 16 6d 01
NS UNITDATA MESSAGE to BSS, BVCI 0x1002, msg length 24 (gprs_ns_sendmsg)
MESSAGE to BSS at 0x01020304:1111, msg length 28
@@ -2669,7 +2682,7 @@ CALLBACK, event 0, msg length 40, bvci 0x1002
NS UNITDATA MESSAGE to SGSN, BVCI 0x1002, msg length 75 (gprs_ns_sendmsg)
MESSAGE to SGSN at 0x05060708:32000, msg length 79
-00 00 10 02 01 7c 69 fb 81 00 00 04 08 88 21 63 54 00 63 60 12 34 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 16 6d 01
+00 00 10 02 01 7c 69 fb 81 00 00 04 08 88 21 63 54 40 50 60 12 34 00 80 0e 00 34 01 c0 01 08 01 02 f5 e0 21 08 02 05 f4 fb c5 46 79 11 22 33 40 50 60 19 18 b3 43 2b 25 96 62 00 60 80 9a c2 c6 62 00 60 80 ba c8 c6 62 00 60 80 00 16 6d 01
result (IDENT RESPONSE) = 0
@@ -3057,6 +3070,14 @@ MESSAGE to BSS at 0x01020304:1111, msg length 28
result (ATTACH REQUEST) = 0
+PROCESSING DETACH REQ from 0x01020304:1111
+00 00 10 02 01 80 00 de ad 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 15 01 c0 1d 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb aa cc a3
+
+CALLBACK, event 0, msg length 44, bvci 0x1002
+00 00 10 02 01 80 00 de ad 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 15 01 c0 1d 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb aa cc a3
+
+result (DETACH REQ) = 0
+
Peers:
NSEI 4096, BVCI 4098, not blocked, RAI 112-332-16464-96
RAID patched (BSS ): 8
@@ -3067,7 +3088,31 @@ Peers:
Attach Request count : 3
TLLI cache size : 1
TLLI-Cache: 1
- TLLI 8000dead -> 7eb52dfb, IMSI (none), AGE 0, STORED 1, IMSI acquisition in progress
+ TLLI 8000dead -> 7eb52dfb, IMSI (none), AGE 0, STORED 2, IMSI acquisition in progress
+PROCESSING DETACH REQ (unknown TLLI) from 0x01020304:1111
+00 00 10 02 01 80 00 be ef 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 15 01 c0 21 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb ca 4d 70
+
+CALLBACK, event 0, msg length 44, bvci 0x1002
+00 00 10 02 01 80 00 be ef 00 00 04 08 88 11 22 33 40 50 60 12 34 00 80 0e 00 15 01 c0 21 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb ca 4d 70
+
+NS UNITDATA MESSAGE to BSS, BVCI 0x1002, msg length 24 (gprs_ns_sendmsg)
+MESSAGE to BSS at 0x01020304:1111, msg length 28
+00 00 10 02 00 80 00 be ef 00 50 20 16 82 02 58 0e 00 09 41 c4 01 08 15 01 b7 f8 36
+
+result (DETACH REQ (unknown TLLI)) = 0
+
+Peers:
+ NSEI 4096, BVCI 4098, not blocked, RAI 112-332-16464-96
+ RAID patched (BSS ): 8
+ RAID patched (SGSN): 3
+ TLLI patched (BSS ): 9
+ TLLI patched (SGSN): 9
+ P-TMSI patched (SGSN): 1
+ Attach Request count : 3
+ TLLI cache size : 2
+ TLLI-Cache: 2
+ TLLI 8000beef -> 7e23ef54, IMSI (none), AGE 0, STORED 1, IMSI acquisition in progress
+ TLLI 8000dead -> 7eb52dfb, IMSI (none), AGE 0, STORED 2, IMSI acquisition in progress
Gbproxy global:
Invalid Routing Area Identifier : 1
BSSGP protocol error (SGSN): 1