Fix SI2bis Rest Octets generation According to the spec it's an empty 1-byte element reserved for future extension but we still have to generate padding properly. Add stub function similar to the used for SI2ter and adjust test output accordingly.
Change-Id: I3c278c57880a173df3c4648c9724339d23ce94fd --- 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, 20 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/72/5272/2 diff --git a/include/osmocom/bsc/rest_octets.h b/include/osmocom/bsc/rest_octets.h index ba25b6d..f7ad682 100644 --- a/include/osmocom/bsc/rest_octets.h +++ b/include/osmocom/bsc/rest_octets.h @@ -10,6 +10,7 @@ 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_si2bis(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 b8a29ba..c323e42 100644 --- a/src/libbsc/rest_octets.c +++ b/src/libbsc/rest_octets.c @@ -478,6 +478,20 @@ return bv.data_len; } +/* Generate SIbis Rest Octests 3GPP TS 44.018 Table 10.5.2.33.1 */ +int rest_octets_si2bis(uint8_t *data) +{ + struct bitvec bv; + + memset(&bv, 0, sizeof(bv)); + bv.data = data; + bv.data_len = 1; + + 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 4575454..a04959d 100644 --- a/src/libbsc/system_information.c +++ b/src/libbsc/system_information.c @@ -739,7 +739,10 @@ si2b->rach_control = bts->si_common.rach_control; - return sizeof(*si2b); + /* SI2bis Rest Octets as per 3GPP TS 44.018 ยง10.5.2.33 */ + rc = rest_octets_si2bis(si2b->rest_octets); + + return sizeof(*si2b) + rc; } static int generate_si2ter(enum osmo_sysinfo_type t, struct gsm_bts *bts) diff --git a/tests/gsm0408/gsm0408_test.ok b/tests/gsm0408/gsm0408_test.ok index 868cd9b..536287c 100644 --- a/tests/gsm0408/gsm0408_test.ok +++ b/tests/gsm0408/gsm0408_test.ok @@ -203,7 +203,7 @@ generated valid SI2quater [05/05]: [23] 59 06 07 4a a0 04 86 59 84 26 53 97 65 60 2b 2b 2b 2b 2b 2b 2b 2b 2b 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 +SI2bis: 59 06 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 2b 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 -- To view, visit https://gerrit.osmocom.org/5272 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I3c278c57880a173df3c4648c9724339d23ce94fd Gerrit-PatchSet: 2 Gerrit-Project: osmo-bsc Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de> Gerrit-Reviewer: Jenkins Builder