aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/ipaccess
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-07-22 20:12:09 +0200
committerHarald Welte <laforge@gnumonks.org>2010-07-22 21:54:19 +0200
commitc95cf10d0849f0795f69ef9b5b8db76e970272a6 (patch)
tree103578ce0c7a9ff70f47a0ff2ebb680db15782a0 /openbsc/src/ipaccess
parente39a5912f115215c75db1f0ff850227025dec136 (diff)
[ipaccess-config] fix bugs in generating the PHYSICAL CONFIG attribute
... while asking the BTS to perform tests for us. The length of the ARFCN whitelist is the actual length in bytes, not the number of 16bit ARFCN numbers. Also, implement a limit, either by rxlevel or by number of ARFCN that should end up in the whitelist.
Diffstat (limited to 'openbsc/src/ipaccess')
-rw-r--r--openbsc/src/ipaccess/ipaccess-config.c6
-rw-r--r--openbsc/src/ipaccess/network_listen.c9
2 files changed, 10 insertions, 5 deletions
diff --git a/openbsc/src/ipaccess/ipaccess-config.c b/openbsc/src/ipaccess/ipaccess-config.c
index 7b0fd40a1..f0ad464f9 100644
--- a/openbsc/src/ipaccess/ipaccess-config.c
+++ b/openbsc/src/ipaccess/ipaccess-config.c
@@ -127,10 +127,10 @@ static uint16_t build_physconf(uint8_t *physconf_buf, const struct rxlev_stats *
/* Create whitelist from rxlevels */
physconf_buf[0] = phys_conf_min[0];
physconf_buf[1] = NM_IPAC_EIE_ARFCN_WHITE;
- num_arfcn = ipac_rxlevstat2whitelist(whitelist, st);
+ num_arfcn = ipac_rxlevstat2whitelist(whitelist, st, 0, 100);
arfcnlist_size = num_arfcn * 2;
- *((uint16_t *) (physconf_buf+2)) = htons(num_arfcn);
- printf("pc_buf (%s)\n", hexdump(physconf_buf, arfcnlist_size+4));
+ *((uint16_t *) (physconf_buf+2)) = htons(arfcnlist_size);
+ DEBUGP(DNM, "physconf_buf (%s)\n", hexdump(physconf_buf, arfcnlist_size+4));
return arfcnlist_size+4;
}
diff --git a/openbsc/src/ipaccess/network_listen.c b/openbsc/src/ipaccess/network_listen.c
index 7625eec3d..23e404f1e 100644
--- a/openbsc/src/ipaccess/network_listen.c
+++ b/openbsc/src/ipaccess/network_listen.c
@@ -40,18 +40,23 @@
#define WHITELIST_MAX_SIZE ((NUM_ARFCNS*2)+2+1)
-int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st)
+int ipac_rxlevstat2whitelist(uint16_t *buf, const struct rxlev_stats *st, uint8_t min_rxlev,
+ uint16_t max_num_arfcns)
{
int i;
unsigned int num_arfcn = 0;
- for (i = NUM_RXLEVS-1; i >= 0; i--) {
+ for (i = NUM_RXLEVS-1; i >= min_rxlev; i--) {
int16_t arfcn = -1;
while ((arfcn = rxlev_stat_get_next(st, i, arfcn)) >= 0) {
*buf++ = htons(arfcn);
num_arfcn++;
+
}
+
+ if (num_arfcn > max_num_arfcns)
+ break;
}
return num_arfcn;