Stefan Sperling has uploaded this change for review. ( 
https://gerrit.osmocom.org/9715


Change subject: finish gbproxy_parse_bssgp_unitdata test
......................................................................

finish gbproxy_parse_bssgp_unitdata test

The message this test is trying to parse is indeed invalid.
Add a comment showing the message in decoded form, and assert
that the parser rejects it.

Also, add a missing call to cleanup_test().

Change-Id: I2a86432d080c38d3c95626372a0129499d7146dd
Related: OS#3178
---
M tests/gbproxy/gbproxy_test.c
1 file changed, 55 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sgsn refs/changes/15/9715/1

diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c
index e6bb2e6..157da8b 100644
--- a/tests/gbproxy/gbproxy_test.c
+++ b/tests/gbproxy/gbproxy_test.c
@@ -4944,14 +4944,64 @@
        parse_ctx.to_bss = 0;
        parse_ctx.peer_nsei = msgb_nsei(msg);

-       /* TODO: Determine whether our parser or the message is wrong. */
-
        rc = gprs_gb_parse_bssgp(msg->data, msg->len, &parse_ctx);
-       if (!rc) {
-               fprintf(stderr, "%s: Failed to parse message %s\n", __func__, 
msgb_hexdump(msg));
-       }
+       if (!rc)
+               fprintf(stderr, "%s: Test passed; Failed to parse invalid 
message %s\n", __func__, msgb_hexdump(msg));
+       else
+               fprintf(stderr, "%s: Test failed; invalid message was accepted 
by parser: %s\n", __func__, msgb_hexdump(msg));
+
+       OSMO_ASSERT(!rc);
+
+       /* Manually decoded message according to:
+          ETSI TS 148 018 V10.6.0 (2012 07) 96
+          3GPP TS 48.018 version 10.6.0 Release 10
+          Table 10.2.2: UL-UNITDATA PDU content
+
+       00      - PDU type UL-UNITDATA (ok)
+
+               11.3.35 Temporary logical link Identity (TLLI)
+       00      - TLLI[0]
+       23      - TLLI[1]
+       94      - TLLI[2]
+       01      - TLLI[3]
+                 TLLI == "00239401"
+
+       e1      - QOS[0] (bit rate MSB)
+       55      - QOS[1] (bit rate LSB)
+                 bit rate = "57685" (57685*100000 bit/s per PBRG)
+       cf      - QOS[2] PBRG = 11 (bit rate is expressed in 100000 bit/s 
increments),
+                       C/R 0 (contains LLC ACK/SACK),
+                       T 0 (contains signalling),
+                       A 1 (radio if uses MAC/UNITDATA,
+                       Precedence 111 (reserved value)
+
+       ea      - CELL_ID[0] (TLV IEI: wrong, should be 0x08)
+       00      - CELL_ID[1] (length 1)
+       00      - CELL_ID[2] (length 2)
+               lenth == 0
+       04      -- CELL_ID[3]
+       08      -- CELL_ID[4]
+       88      -- CELL_ID[5]
+       72      -- CELL_ID[6]
+       f4      -- CELL_ID[7]
+       80      -- CELL_ID[8]
+       10      -- CELL_DI[9]
+
+       18      -- QOSP[0] OoS Profile IEI
+               not allowed in BSSGP Userdata
+       00      -- QOSP[1]
+       9c      -- QOSP[2]
+       40      -- QOSP[3]
+       00      -- QOSP[4]
+
+       80      -- IEI for "E-UTRAN Inter RAT Handover Info"
+               not allowed in BSSGP Userdata
+       0e      -- length (14 bytes -- only 8 bytes remain)
+       00 06 01 c0 41 6c 43 38 */

        msgb_free(msg);
+
+       cleanup_test();
 }

 static struct log_info_cat gprs_categories[] = {

--
To view, visit https://gerrit.osmocom.org/9715
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sgsn
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a86432d080c38d3c95626372a0129499d7146dd
Gerrit-Change-Number: 9715
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperl...@sysmocom.de>

Reply via email to