Change in osmo-sgsn[master]: add a test for OS#3178 (invalid unitdata message)

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Thu Jun 7 17:14:08 UTC 2018


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


Change subject: add a test for OS#3178 (invalid unitdata message)
......................................................................

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
---
M tests/gbproxy/gbproxy_test.c
1 file changed, 28 insertions(+), 0 deletions(-)



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

diff --git a/tests/gbproxy/gbproxy_test.c b/tests/gbproxy/gbproxy_test.c
index f9a1c6b..e6bb2e6 100644
--- a/tests/gbproxy/gbproxy_test.c
+++ b/tests/gbproxy/gbproxy_test.c
@@ -4927,6 +4927,33 @@
 	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 @@
 	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);

-- 
To view, visit https://gerrit.osmocom.org/9500
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: I39189701a57c785ffdacc3ae26d7aa93bb06cde6
Gerrit-Change-Number: 9500
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180607/387e3afe/attachment.htm>


More information about the gerrit-log mailing list