From 55101ae00455d0c75a908a6dd4625fc08c0318e7 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Tue, 17 May 2016 23:20:03 +0200 Subject: bsc: Create minimal SI6 rest octets In GSM R99 SI6 has mandatory SI6 rest octets and so far we did not include them. Add minimal support to generate the right band indicator. Change-Id: I417a40eb91f42a3416b4e07bb9fb4d7a01aaa36b Fixes: OS#1698 Related: OS#1725 --- openbsc/include/openbsc/rest_octets.h | 1 + openbsc/src/libbsc/rest_octets.c | 39 +++++++++++++++++++++++++++++++++ openbsc/src/libbsc/system_information.c | 4 +++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/openbsc/include/openbsc/rest_octets.h b/openbsc/include/openbsc/rest_octets.h index 56d4e0de8..efb758689 100644 --- a/openbsc/include/openbsc/rest_octets.h +++ b/openbsc/include/openbsc/rest_octets.h @@ -5,6 +5,7 @@ /* generate SI1 rest octets */ int rest_octets_si1(uint8_t *data, uint8_t *nch_pos, int is1800_net); +int rest_octets_si6(uint8_t *data, int is1800_net); struct gsm48_si_selection_params { uint16_t penalty_time:5, diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c index 41bf5050b..7e352e182 100644 --- a/openbsc/src/libbsc/rest_octets.c +++ b/openbsc/src/libbsc/rest_octets.c @@ -187,6 +187,45 @@ int rest_octets_si4(uint8_t *data, const struct gsm48_si_ro_info *si4) return bv.data_len; } + +/* GSM 04.18 ETSI TS 101 503 V8.27.0 (2006-05) + + ::= +{L | H } +{L | H } +{ < DTM_support : bit == L > I < DTM_support : bit == H > +< RAC : bit (8) > +< MAX_LAPDm : bit (3) > } +< Band indicator > +{ L | H < GPRS_MS_TXPWR_MAX_CCH : bit (5) > } +; +*/ +int rest_octets_si6(uint8_t *data, int is1800_net) +{ + struct bitvec bv; + + memset(&bv, 0, sizeof(bv)); + bv.data = data; + bv.data_len = 1; + + /* no PCH/NCH info */ + bitvec_set_bit(&bv, L); + /* no VBS/VGCS options */ + bitvec_set_bit(&bv, L); + /* no DTM_support */ + bitvec_set_bit(&bv, L); + /* band indicator */ + if (is1800_net) + bitvec_set_bit(&bv, L); + else + bitvec_set_bit(&bv, H); + /* no GPRS_MS_TXPWR_MAX_CCH */ + bitvec_set_bit(&bv, L); + + bitvec_spare_padding(&bv, 3); + return bv.data_len; +} + /* GPRS Mobile Allocation as per TS 04.60 Chapter 12.10a: < GPRS Mobile Allocation IE > ::= < HSN : bit (6) > diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index a3deefc73..fd3ae08b6 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -707,6 +707,7 @@ static int generate_si6(uint8_t *output, struct gsm_bts *bts) { struct gsm48_system_information_type_6 *si6; int l2_plen = 11; + int rc; memset(output, GSM_MACBLOCK_PADDING, GSM_MACBLOCK_LEN); @@ -735,8 +736,9 @@ static int generate_si6(uint8_t *output, struct gsm_bts *bts) si6->ncc_permitted = bts->si_common.ncc_permitted; /* SI6 Rest Octets: 10.5.2.35a: PCH / NCH info, VBS/VGCS options */ + rc = rest_octets_si6(si6->rest_octets, is_dcs_net(bts)); - return l2_plen; + return l2_plen + rc; } static struct gsm48_si13_info si13_default = { -- cgit v1.2.3