aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-06-19 10:23:50 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 16:19:57 +0200
commitcf02eb1b207a742a55bbd1182e33892626c7b65c (patch)
treeaa9776d219cb05280ddb05c43c38bc24f83c1766
parent1166974bca729d7a30127e7131df30321200f490 (diff)
gprs/test: Add Detach messages to test
This patch adds a Detach Request (MO) / Detach Accept sequence to the test, followed by another (here invalid) Act PDP Context Req which should be APN patched. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.c34
-rw-r--r--openbsc/tests/gbproxy/gbproxy_test.ok43
2 files changed, 74 insertions, 3 deletions
diff --git a/openbsc/tests/gbproxy/gbproxy_test.c b/openbsc/tests/gbproxy/gbproxy_test.c
index 75dc173e2..a0c202a17 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.c
+++ b/openbsc/tests/gbproxy/gbproxy_test.c
@@ -124,6 +124,29 @@ static const unsigned char bssgp_act_pdp_ctx_req[76] = {
0x00, 0x5a, 0xff, 0x02
};
+/* Base Station Subsystem GPRS Protocol: GSM A-I/F DTAP - Detach Request */
+static const unsigned char bssgp_detach_req[44] = {
+ 0x01, 0xef, 0xe2, 0xb7, 0x00, 0x00, 0x00, 0x04,
+ 0x08, 0x88, 0x11, 0x22, 0x33, 0x40, 0x50, 0x60,
+ 0x75, 0x30, 0x00, 0x80, 0x0e, 0x00, 0x15, 0x01,
+ 0xc0, 0x19, 0x08, 0x05, 0x01, 0x18, 0x05, 0xf4,
+ 0xef, 0xe2, 0xb7, 0x00, 0x19, 0x03, 0xb9, 0x97,
+ 0xcb, 0x7e, 0xe1, 0x41
+};
+
+/* Base Station Subsystem GPRS Protocol: GSM A-I/F DTAP - Detach Accept */
+static const unsigned char bssgp_detach_acc[67] = {
+ 0x00, 0xef, 0xe2, 0xb7, 0x00, 0x00, 0x50, 0x20,
+ 0x16, 0x82, 0x02, 0x58, 0x13, 0x99, 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, 0x0a,
+ 0x82, 0x08, 0x02, 0x0d, 0x88, 0x11, 0x12, 0x13,
+ 0x14, 0x15, 0x16, 0x17, 0x18, 0x00, 0x81, 0x00,
+ 0x0e, 0x89, 0x41, 0xc0, 0x15, 0x08, 0x06, 0x00,
+ 0xf7, 0x35, 0xf0
+};
+
static int gprs_process_message(struct gprs_ns_inst *nsi, const char *text,
struct sockaddr_in *peer, const unsigned char* data,
size_t data_len);
@@ -882,11 +905,22 @@ static void test_gbproxy_ra_patching()
&bss_peer[0], 0x1002,
bssgp_act_pdp_ctx_req, sizeof(bssgp_act_pdp_ctx_req));
+ /* Detach */
+ send_ns_unitdata(nsi, "DETACH REQ", &bss_peer[0], 0x1002,
+ bssgp_detach_req, sizeof(bssgp_detach_req));
+
+ send_ns_unitdata(nsi, "DETACH ACC", &sgsn_peer, 0x1002,
+ bssgp_detach_acc, sizeof(bssgp_detach_acc));
+
gbprox_dump_global(stdout, 0);
gbprox_dump_peers(stdout, 0);
printf("--- Bad cases ---\n\n");
+ printf("TLLI is already detached, shouldn't patch (expected failure)\n");
+ send_ns_unitdata(nsi, "ACT PDP CTX REQ", &bss_peer[0], 0x1002,
+ bssgp_act_pdp_ctx_req, sizeof(bssgp_act_pdp_ctx_req));
+
send_bssgp_reset_ack(nsi, &sgsn_peer, 0x1eee);
send_bssgp_suspend_ack(nsi, &sgsn_peer, &rai_unknown);
diff --git a/openbsc/tests/gbproxy/gbproxy_test.ok b/openbsc/tests/gbproxy/gbproxy_test.ok
index 9e70d9b12..59f3bcc9c 100644
--- a/openbsc/tests/gbproxy/gbproxy_test.ok
+++ b/openbsc/tests/gbproxy/gbproxy_test.ok
@@ -1647,14 +1647,51 @@ MESSAGE to SGSN at 0x05060708:32000, msg length 75
result (ACT PDP CTX REQ (REMOVE APN)) = 75
+PROCESSING DETACH 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 15 01 c0 19 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb 7e e1 41
+
+CALLBACK, event 0, msg length 44, bvci 0x1002
+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 15 01 c0 19 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb 7e e1 41
+
+NS UNITDATA MESSAGE to SGSN, BVCI 0x1002, msg length 44 (gprs_ns_sendmsg)
+MESSAGE to SGSN at 0x05060708:32000, msg length 48
+00 00 10 02 01 ef e2 b7 00 00 00 04 08 88 21 63 54 40 50 60 75 30 00 80 0e 00 15 01 c0 19 08 05 01 18 05 f4 ef e2 b7 00 19 03 b9 97 cb 7e e1 41
+
+result (DETACH REQ) = 48
+
+PROCESSING DETACH ACC from 0x05060708:32000
+00 00 10 02 00 ef e2 b7 00 00 50 20 16 82 02 58 13 99 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 0a 82 08 02 0d 88 11 12 13 14 15 16 17 18 00 81 00 0e 89 41 c0 15 08 06 00 f7 35 f0
+
+CALLBACK, event 0, msg length 67, bvci 0x1002
+00 00 10 02 00 ef e2 b7 00 00 50 20 16 82 02 58 13 99 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 0a 82 08 02 0d 88 11 12 13 14 15 16 17 18 00 81 00 0e 89 41 c0 15 08 06 00 f7 35 f0
+
+NS UNITDATA MESSAGE to BSS, BVCI 0x1002, msg length 67 (gprs_ns_sendmsg)
+MESSAGE to BSS at 0x01020304:1111, msg length 71
+00 00 10 02 00 ef e2 b7 00 00 50 20 16 82 02 58 13 99 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 0a 82 08 02 0d 88 11 12 13 14 15 16 17 18 00 81 00 0e 89 41 c0 15 08 06 00 f7 35 f0
+
+result (DETACH ACC) = 71
+
Gbproxy global:
- RAID patched (BSS ): 8
+ RAID patched (BSS ): 9
RAID patched (SGSN): 3
APN patched : 2
Peers:
NSEI 4096, BVCI 4098, not blocked, RAI 112-332-16464-96
--- Bad cases ---
+TLLI is already detached, shouldn't patch (expected failure)
+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
+
+CALLBACK, event 0, msg length 76, bvci 0x1002
+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
+
+NS UNITDATA MESSAGE to SGSN, BVCI 0x1002, msg length 71 (gprs_ns_sendmsg)
+MESSAGE to SGSN at 0x05060708:32000, msg length 75
+00 00 10 02 01 ef e2 b7 00 00 00 04 08 88 21 63 54 40 50 60 75 30 00 80 0e 00 30 01 c0 0d 0a 41 05 03 0c 00 00 1f 10 00 00 00 00 00 00 00 00 02 01 21 27 14 80 80 21 10 01 00 00 10 81 06 00 00 00 00 83 06 00 00 00 00 85 fa 60
+
+result (ACT PDP CTX REQ) = 75
+
PROCESSING BVC_RESET_ACK from 0x05060708:32000
00 00 00 00 23 04 82 1e ee
@@ -1678,9 +1715,9 @@ result (BVC_SUSPEND_ACK) = 28
Gbproxy global:
Invalid BVC Identifier : 1
Invalid Routing Area Identifier : 1
- RAID patched (BSS ): 8
+ RAID patched (BSS ): 10
RAID patched (SGSN): 4
- APN patched : 2
+ APN patched : 3
Peers:
NSEI 4096, BVCI 4098, not blocked, RAI 112-332-16464-96
===== GbProxy test END