Make si2q scheduling optional
Previously si2quater SI messages were always scheduled. Check for
neighbor configuration and only schedule si2q when necessary. Add
corresponding unit test.
Change-Id: Ibe997803ffb894133fd4d838410fe735791d414f
Fixes: OS#1727
Reviewed-on: https://gerrit.osmocom.org/81
Tested-by: Jenkins Builder
Reviewed-by: Holger Freyther <holger@freyther.de>
diff --git a/openbsc/src/libbsc/system_information.c b/openbsc/src/libbsc/system_information.c
index d40bbaf..fd228e3 100644
--- a/openbsc/src/libbsc/system_information.c
+++ b/openbsc/src/libbsc/system_information.c
@@ -648,7 +648,7 @@
static int generate_si2quater(uint8_t *output, struct gsm_bts *bts)
{
- int rc;
+ int rc, i = MAX_EARFCN_LIST;
struct gsm48_system_information_type_2quater *si2q =
(struct gsm48_system_information_type_2quater *) output;
@@ -667,6 +667,14 @@
if (rc < 0)
return rc;
+ if (bts->si_common.si2quater_neigh_list.arfcn)
+ for (i = 0; i < MAX_EARFCN_LIST; i++)
+ if (bts->si_common.si2quater_neigh_list.arfcn[i] !=
+ OSMO_EARFCN_INVALID)
+ break;
+ if (!bts->si_common.uarfcn_length && i == MAX_EARFCN_LIST)
+ bts->si_valid &= ~(1 << SYSINFO_TYPE_2quater);
+
return sizeof(*si2q) + rc;
}