aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSylvain Munaut <tnt@246tNt.com>2009-12-24 14:20:19 +0100
committerHarald Welte <laforge@netfilter.org>2009-12-24 15:11:00 +0100
commit42a5652eb2032e1d7df19278b9e353f9cb40c7b4 (patch)
treef7c99d455d940bef080329ae174d7c1e15f93668
parentd6c35f6e8aee512830dac4792a3fbed4853349bb (diff)
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>
-rw-r--r--openbsc/src/system_information.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/openbsc/src/system_information.c b/openbsc/src/system_information.c
index df4f1a0c8..6493794ef 100644
--- a/openbsc/src/system_information.c
+++ b/openbsc/src/system_information.c
@@ -98,7 +98,7 @@ static int freq_list_bmrel_set_arfcn(u_int8_t *chan_list, unsigned int arfcn)
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 @@ static int bitvec2freq_list(u_int8_t *chan_list, struct bitvec *bv,
}
}
+ 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);