aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStefan Sperling <ssperling@sysmocom.de>2018-06-07 19:12:25 +0200
committerStefan Sperling <ssperling@sysmocom.de>2018-06-07 19:12:25 +0200
commitaaa3e2b9aee28e6a5e5ffcb84ff24876dc4fc72a (patch)
tree4ca78a71496e4edfc6acf4efc93a6cd93dda83f0 /tests
parent13c13128fa140d699a107f27f28a470bf4a4f1b3 (diff)
add a test for OS#3178 (invalid unitdata message)
Add a test which reproduces the parsing problem. Whether this problem is due to an invalid message or a parser bug is yet to be determined. Until then, this test helps with analyzing the problem further. Change-Id: I39189701a57c785ffdacc3ae26d7aa93bb06cde6 Related: OS#3178
Diffstat (limited to 'tests')
-rw-r--r--tests/gbproxy/gbproxy_test.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c
index f9a1c6bf..e6bb2e6d 100644
--- a/tests/gbproxy/gbproxy_test.c
+++ b/tests/gbproxy/gbproxy_test.c
@@ -4927,6 +4927,33 @@ static void test_gbproxy_stored_messages()
cleanup_test();
}
+/* See OS#3178 "gbproxy: failed to parse invalid BSSGP-UNITDATA message" */
+static void test_gbproxy_parse_bssgp_unitdata()
+{
+ const char *hex = "0000239401e155cfea000004088872f4801018009c4000800e000601c0416c4338";
+ struct msgb *msg = msgb_alloc(1034, "bssgp_unitdata");
+ struct gprs_gb_parse_context parse_ctx;
+ int rc;
+
+ memset(&parse_ctx, 0, sizeof(parse_ctx));
+
+ OSMO_ASSERT(msg);
+ msgb_bssgph(msg) = msg->head;
+ msgb_put(msg, osmo_hexparse(hex, msg->head, msgb_tailroom(msg)));
+
+ 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));
+ }
+
+ msgb_free(msg);
+}
+
static struct log_info_cat gprs_categories[] = {
[DGPRS] = {
.name = "DGPRS",
@@ -4985,6 +5012,7 @@ int main(int argc, char **argv)
test_gbproxy_keep_info();
test_gbproxy_tlli_expire();
test_gbproxy_stored_messages();
+ test_gbproxy_parse_bssgp_unitdata();
gbprox_reset(&gbcfg);
/* gbprox_reset() frees the rate_ctr, but re-allocates it again. */
rate_ctr_group_free(gbcfg.ctrg);