system_information: Fix BCCH Allocation when only 1 BTS present
The current code used the variable bitmap format, but
that's not possible since in this format the base ARFCN is
part of the set. That lead to a neighbor list containing ARFCN 0.
Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
diff --git a/openbsc/src/system_information.c b/openbsc/src/system_information.c
index df4f1a0..6493794 100644
--- a/openbsc/src/system_information.c
+++ b/openbsc/src/system_information.c
@@ -98,7 +98,7 @@
static int bitvec2freq_list(u_int8_t *chan_list, struct bitvec *bv,
const struct gsm_bts *bts)
{
- int i, rc, min = 1024, max = 0;
+ int i, rc, min = 1024, max = -1;
memset(chan_list, 0, 16);
@@ -128,6 +128,12 @@
}
}
+ if (max == -1) {
+ /* Empty set, use 'bit map 0 format' */
+ chan_list[0] = 0;
+ return 0;
+ }
+
if ((max - min) > 111) {
LOGP(DRR, LOGL_ERROR, "min_arfcn=%u, max_arfcn=%u, "
"distance > 111\n", min, max);