diff options
author | Philipp Maier <pmaier@sysmocom.de> | 2021-11-09 16:21:34 +0100 |
---|---|---|
committer | Philipp Maier <pmaier@sysmocom.de> | 2021-12-13 18:03:12 +0100 |
commit | 3ba9bd7c3571e86ed0605d90dec89183de9023c2 (patch) | |
tree | 9b9c8a3536e6bce4ec366959e54be783066b415d /src/osmo-bsc/bts.c | |
parent | 5cebdefed6e9ab6a5c268070b6e95fe54c7fbe65 (diff) |
abis_nm: actively block BTSs with invalid configuration
At the moment the BTS configuration is checked, but the check does not
have much consequence other than that some initialization that is not
executed. The BTS will go into the OML bootstrap phase anyway and most
likely fail at some later point due to the invalid configuration. To
reduce noise and unexpected behaviour of the BTS lets make sure that the
OML boostrap phase can only proceed when the BSC conciders the
configuration as valid.
Change-Id: I42c1c26a9b800600787b1266a871f95f2114c26e
Related: SYS#5369
Diffstat (limited to 'src/osmo-bsc/bts.c')
-rw-r--r-- | src/osmo-bsc/bts.c | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/src/osmo-bsc/bts.c b/src/osmo-bsc/bts.c index 11b1ec384..c4ae518ee 100644 --- a/src/osmo-bsc/bts.c +++ b/src/osmo-bsc/bts.c @@ -421,6 +421,57 @@ struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm return bts; } +/* Validate BTS configuration (ARFCN settings and physical channel configuration) */ +int gsm_bts_check_cfg(struct gsm_bts *bts) +{ + struct gsm_bts_trx *trx; + + if (!bts->model) + return -EFAULT; + + switch (bts->band) { + case GSM_BAND_1800: + if (bts->c0->arfcn < 512 || bts->c0->arfcn > 885) { + LOGP(DNM, LOGL_ERROR, "(bts=%u) GSM1800 channel (%u) must be between 512-885.\n", + bts->nr, bts->c0->arfcn); + return -EINVAL; + } + break; + case GSM_BAND_1900: + if (bts->c0->arfcn < 512 || bts->c0->arfcn > 810) { + LOGP(DNM, LOGL_ERROR, "(bts=%u) GSM1900 channel (%u) must be between 512-810.\n", + bts->nr, bts->c0->arfcn); + } + break; + case GSM_BAND_900: + if ((bts->c0->arfcn > 124 && bts->c0->arfcn < 955) || + bts->c0->arfcn > 1023) { + LOGP(DNM, LOGL_ERROR, "(bts=%u) GSM900 channel (%u) must be between 0-124, 955-1023.\n", + bts->nr, bts->c0->arfcn); + } + break; + case GSM_BAND_850: + if (bts->c0->arfcn < 128 || bts->c0->arfcn > 251) { + LOGP(DNM, LOGL_ERROR, "(bts=%u) GSM850 channel (%u) must be between 128-251.\n", + bts->nr, bts->c0->arfcn); + } + break; + default: + LOGP(DNM, LOGL_ERROR, "(bts=%u) Unsupported frequency band.\n", bts->nr); + } + + /* Verify the physical channel mapping */ + llist_for_each_entry(trx, &bts->trx_list, list) { + if (!trx_has_valid_pchan_config(trx)) { + LOGP(DNM, LOGL_ERROR, "TRX %u has invalid timeslot " + "configuration\n", trx->nr); + return -EINVAL; + } + } + + return 0; +} + static char ts2str[255]; char *gsm_bts_name(const struct gsm_bts *bts) |