From 845a3a4c594f56fc754eae3b261675b460aec2ac Mon Sep 17 00:00:00 2001 From: Max Date: Mon, 15 May 2017 12:02:29 +0200 Subject: SI2quater: fix EARFCN inclusion check Previously only the existance of bts->si_common.si2quater_neigh_list was checked but not the actual number of EARFCNs in it. Fix it by using si2q_earfcn_count() and adjust tests accordingly. While at it - reformat tests to include extra information. The correctness was checked manually by inspecting GSMTAP output. Change-Id: Ic4fb2a9e870db66cac58b1e8d113587b30d64ce2 Related: RT#8792 --- openbsc/src/libbsc/rest_octets.c | 3 +-- openbsc/src/libbsc/system_information.c | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'openbsc/src') diff --git a/openbsc/src/libbsc/rest_octets.c b/openbsc/src/libbsc/rest_octets.c index 950e57006..a6fdf46fe 100644 --- a/openbsc/src/libbsc/rest_octets.c +++ b/openbsc/src/libbsc/rest_octets.c @@ -379,14 +379,13 @@ int rest_octets_si2quater(uint8_t *data, struct gsm_bts *bts) /* No GPRS_3G_MEASUREMENT Parameters Descr. */ bitvec_set_bit(&bv, 0); - if (&bts->si_common.si2quater_neigh_list) { /* FIXME: use si2q_earfcn_count() in if */ + if (si2q_earfcn_count(&bts->si_common.si2quater_neigh_list)) { append_earfcn(&bv, bts, SI2Q_MAX_LEN - bv.cur_bit); /* FIXME: remove following check once multiple SI2q are properly supported */ if ((bts->e_offset != si2q_earfcn_count(&bts->si_common.si2quater_neigh_list)) || si2q_earfcn_count(&bts->si_common.si2quater_neigh_list) > 5) return -ENOMEM; - } else { /* No Additions in Rel-5: */ bitvec_set_bit(&bv, L); diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c index 0496506b6..644bebdf4 100644 --- a/openbsc/src/libbsc/system_information.c +++ b/openbsc/src/libbsc/system_information.c @@ -692,6 +692,10 @@ static inline bool si2quater_not_needed(struct gsm_bts *bts) size_t si2q_earfcn_count(const struct osmo_earfcn_si2q *e) { unsigned i, ret = 0; + + if (!e) + return 0; + for (i = 0; i < e->length; i++) if (e->arfcn[i] != OSMO_EARFCN_INVALID) ret++; @@ -777,7 +781,8 @@ static int generate_si3(enum osmo_sysinfo_type t, struct gsm_bts *bts) si_info.si2ter_indicator = 0; } if ((bts->si_valid & (1 << SYSINFO_TYPE_2quater))) { - LOGP(DRR, LOGL_INFO, "SI 2quater is included.\n"); + LOGP(DRR, LOGL_INFO, "SI 2quater is included, based on %zu EARFCNs and %zu UARFCNs.\n", + si2q_earfcn_count(&bts->si_common.si2quater_neigh_list), bts->si_common.uarfcn_length); si_info.si2quater_indicator = 1; } else { si_info.si2quater_indicator = 0; -- cgit v1.2.3