[PATCH] osmo-bsc[master]: Generate SI2ter Rest Octets

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/.

Max gerrit-no-reply at lists.osmocom.org
Mon Dec 11 11:13:09 UTC 2017


Review at  https://gerrit.osmocom.org/5269

Generate SI2ter Rest Octets

Previously we simply omitted SI2ter Rest Octets which is spec violation
which lead to 'Malformed Packet' error in Wireshark RSL dissector. Fix
this by generating empty 'no rest octets' with proper padding. Adjust
test output accordingly.

Change-Id: Ie4419aaaf93a462f501f8d8f7bf2677d37c58f94
Fixes: OS#2711
---
M include/osmocom/bsc/rest_octets.h
M src/libbsc/rest_octets.c
M src/libbsc/system_information.c
M tests/gsm0408/gsm0408_test.ok
4 files changed, 22 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/69/5269/1

diff --git a/include/osmocom/bsc/rest_octets.h b/include/osmocom/bsc/rest_octets.h
index 876e0ab..ba25b6d 100644
--- a/include/osmocom/bsc/rest_octets.h
+++ b/include/osmocom/bsc/rest_octets.h
@@ -9,6 +9,7 @@
 /* generate SI1 rest octets */
 int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net);
 int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts);
+int rest_octets_si2ter(uint8_t *data);
 int rest_octets_si6(uint8_t *data, bool is1800_net);
 
 struct gsm48_si_selection_params {
diff --git a/src/libbsc/rest_octets.c b/src/libbsc/rest_octets.c
index 7c6d7cd..05d8b2a 100644
--- a/src/libbsc/rest_octets.c
+++ b/src/libbsc/rest_octets.c
@@ -461,6 +461,22 @@
 		bitvec_set_bit(bv, L);
 }
 
+/* Generate SIeter Rest Octests 3GPP TS 44.018 Table 10.5.2.33a.1 */
+int rest_octets_si2ter(uint8_t *data)
+{
+	struct bitvec bv;
+
+	memset(&bv, 0, sizeof(bv));
+	bv.data = data;
+	bv.data_len = 4;
+
+	/* No SI2ter_MP_CHANGE_MARK */
+	bitvec_set_bit(&bv, L);
+
+	bitvec_spare_padding(&bv, (bv.data_len * 8) - 1);
+
+	return bv.data_len;
+}
 
 /* Generate SI3 Rest Octests (Chapter 10.5.2.34 / Table 10.4.72) */
 int rest_octets_si3(uint8_t *data, const struct gsm48_si_ro_info *si3)
diff --git a/src/libbsc/system_information.c b/src/libbsc/system_information.c
index c1b0d49..4575454 100644
--- a/src/libbsc/system_information.c
+++ b/src/libbsc/system_information.c
@@ -764,7 +764,10 @@
 	if (!n)
 		bts->si_valid &= ~(1 << SYSINFO_TYPE_2ter);
 
-	return sizeof(*si2t);
+	/* SI2ter Rest Octets as per 3GPP TS 44.018 §10.5.2.33a */
+	rc = rest_octets_si2ter(si2t->rest_octets);
+
+	return sizeof(*si2t) + rc;
 }
 
 /* SI2quater messages are optional - we only generate them when neighbor UARFCNs or EARFCNs are configured */
diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok
index 889f001..868cd9b 100644
--- a/tests/gsm0408/gsm0408_test.ok
+++ b/tests/gsm0408/gsm0408_test.ok
@@ -204,7 +204,7 @@
 Testing if BA-IND is set as expected in SI2xxx and SI5xxx
 SI2: 59 06 1a 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
 SI2bis: 59 06 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
-SI2ter: 59 06 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
+SI2ter: 59 06 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2b 2b 2b 2b 
 SI5: 06 1d 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
 SI5bis: 06 05 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 
 SI5ter: 06 06 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 

-- 
To view, visit https://gerrit.osmocom.org/5269
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie4419aaaf93a462f501f8d8f7bf2677d37c58f94
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list