[bsc_hack] Sanity check for the GSM1800 nanoBTS
The GSM1800 requires us to use channels between 512-885. When
failing to provide such a channel the OML layer will fail and
no RSL connection will be opened.
Add a sanity check before creating the gsm_network and fail
when the channels are not within the allowed range.
Assume no one is operating a BS11 in the 1800 spectrum.
diff --git a/openbsc/src/bsc_hack.c b/openbsc/src/bsc_hack.c
index 7aa8b9a..687be33 100644
--- a/openbsc/src/bsc_hack.c
+++ b/openbsc/src/bsc_hack.c
@@ -960,6 +960,26 @@
{
struct gsm_bts *bts;
+ switch(BTS_TYPE) {
+ case GSM_BTS_TYPE_NANOBTS_1800:
+ if (ARFCN < 512 || ARFCN > 885) {
+ fprintf(stderr, "GSM1800 channel must be between 512-885.\n");
+ return -EINVAL;
+ }
+ break;
+ case GSM_BTS_TYPE_BS11:
+ case GSM_BTS_TYPE_NANOBTS_900:
+ /* Assume we have a P-GSM900 here */
+ if (ARFCN < 1 || ARFCN > 124) {
+ fprintf(stderr, "GSM900 channel must be between 1-124.\n");
+ return -EINVAL;
+ }
+ break;
+ case GSM_BTS_TYPE_UNKNOWN:
+ fprintf(stderr, "Unknown BTS. Please use the --bts-type switch\n");
+ return -EINVAL;
+ }
+
/* initialize our data structures */
gsmnet = gsm_network_init(2, BTS_TYPE, MCC, MNC);
if (!gsmnet)