aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests
diff options
context:
space:
mode:
authorPhilipp <pmaier@sysmocom.de>2016-12-22 14:15:20 +0100
committerPhilipp <pmaier@sysmocom.de>2016-12-23 11:19:15 +0100
commitdb142dc59dc8d79d8ee608c9165bc865d240b97d (patch)
treea4c1ec7fdece679b7dd252ac321b28c60e3492d2 /openbsc/tests
parenta191dcd8f01767b266b85578d0fb445d864dfabd (diff)
sndcp: Allow empty SNDCP-XID indications
In some rare cases the modem might send a xid indication that does not contain anything except the version number field. The sgsn ignors such SNDCP-XID indications by stripping the entire field from the response. We found a modem in the wild that started to act problematic when the empty SNDCP-XID was missing in the response. This patch changes the XID negotiation behaviour in a way that if a modem should send empty SNDCP-XID indications, the reply will also contain an empty SNDCP-XID indication. Apart from that the SNDCP-XID version number is now parsed and echoed in the response. This ensures that we always reply with the version number that the modem expects. (The version was 0 in all cases we observed so far) Change-Id: I097a770cb4907418f53e620a051ebb8cd110c5f2 Related: OS#1794
Diffstat (limited to 'openbsc/tests')
-rw-r--r--openbsc/tests/sndcp_xid/sndcp_xid_test.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/openbsc/tests/sndcp_xid/sndcp_xid_test.c b/openbsc/tests/sndcp_xid/sndcp_xid_test.c
index 3a3361970..151dd2bb5 100644
--- a/openbsc/tests/sndcp_xid/sndcp_xid_test.c
+++ b/openbsc/tests/sndcp_xid/sndcp_xid_test.c
@@ -47,13 +47,14 @@ static void test_xid_decode_realworld(const void *ctx)
uint8_t xid_r[512];
/* Parse and show contained comp fields */
- comp_fields = gprs_sndcp_parse_xid(ctx, xid, sizeof(xid), NULL);
+ comp_fields = gprs_sndcp_parse_xid(NULL, ctx, xid, sizeof(xid), NULL);
OSMO_ASSERT(comp_fields);
printf("Decoded:\n");
gprs_sndcp_dump_comp_fields(comp_fields, DSNDCP);
/* Encode comp-fields again */
- rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields);
+ rc = gprs_sndcp_compile_xid(xid_r,sizeof(xid_r), comp_fields,
+ DEFAULT_SNDCP_VERSION);
printf("Result length=%i\n",rc);
printf("Encoded: %s\n", osmo_hexdump_nospc(xid, sizeof(xid)));
printf("Rencoded: %s\n", osmo_hexdump_nospc(xid_r, rc));
@@ -226,13 +227,14 @@ static void test_xid_encode_decode(const void *ctx)
gprs_sndcp_dump_comp_fields(&comp_fields, DSNDCP);
/* Encode SNDCP-XID fields */
- rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields);
+ rc = gprs_sndcp_compile_xid(xid, xid_len, &comp_fields,
+ DEFAULT_SNDCP_VERSION);
OSMO_ASSERT(rc > 0);
printf("Encoded: %s (%i bytes)\n", osmo_hexdump_nospc(xid, rc), rc);
/* Parse and show contained comp fields */
- comp_fields_dec = gprs_sndcp_parse_xid(ctx, xid, rc, NULL);
+ comp_fields_dec = gprs_sndcp_parse_xid(NULL, ctx, xid, rc, NULL);
OSMO_ASSERT(comp_fields_dec);
printf("Decoded:\n");