aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2021-11-09 16:21:34 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2021-12-13 18:03:12 +0100
commit3ba9bd7c3571e86ed0605d90dec89183de9023c2 (patch)
tree9b9c8a3536e6bce4ec366959e54be783066b415d
parent5cebdefed6e9ab6a5c268070b6e95fe54c7fbe65 (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
-rw-r--r--include/osmocom/bsc/bts.h1
-rw-r--r--src/osmo-bsc/bts.c51
-rw-r--r--src/osmo-bsc/bts_ipaccess_nanobts.c8
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c56
4 files changed, 63 insertions, 53 deletions
diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 922753c9e..c4ee39daf 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -717,6 +717,7 @@ static inline const struct osmo_location_area_id *bts_lai(struct gsm_bts *bts)
}
struct gsm_bts *gsm_bts_alloc(struct gsm_network *net, struct gsm_bts_sm *bts_sm, uint8_t bts_num);
+int gsm_bts_check_cfg(struct gsm_bts *bts);
char *gsm_bts_name(const struct gsm_bts *bts);
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)
diff --git a/src/osmo-bsc/bts_ipaccess_nanobts.c b/src/osmo-bsc/bts_ipaccess_nanobts.c
index 9607068d5..1df6537f6 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -696,6 +696,14 @@ ipaccess_sign_link_up(void *unit_data, struct e1inp_line *line,
DEBUGP(DLINP, "%s: Identified BTS %u/%u/%u\n", e1inp_signtype_name(type),
dev->site_id, dev->bts_id, dev->trx_id);
+ /* Check if this BTS has a valid configuration. If not we will drop it
+ * immediately. */
+ if (gsm_bts_check_cfg(bts) != 0) {
+ LOGP(DLINP, LOGL_NOTICE, "(bts=%u) BTS config invalid, dropping BTS!\n", bts->nr);
+ ipaccess_drop_oml_deferred(bts);
+ return NULL;
+ }
+
switch(type) {
case E1INP_SIGN_OML:
/* remove old OML signal link for this BTS. */
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 243664117..b7e2616df 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -389,56 +389,6 @@ static void update_connection_stats_cb(void *data)
osmo_timer_schedule(&update_connection_stats_timer, 1, 0);
}
-static int check_bts(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 void bootstrap_bts(struct gsm_bts *bts)
{
unsigned int n = 0;
@@ -492,7 +442,7 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
case S_L_INP_TEI_UP:
if (isd->link_type == E1INP_SIGN_OML) {
/* Check parameters and apply vty config dependent parameters */
- rc = check_bts(trx->bts);
+ rc = gsm_bts_check_cfg(trx->bts);
if (rc < 0) {
LOGP(DNM, LOGL_ERROR, "(bts=%u) Error in BTS configuration -- cannot bootstrap BTS\n",
trx->bts->nr);
@@ -501,7 +451,7 @@ static int inp_sig_cb(unsigned int subsys, unsigned int signal,
bootstrap_bts(trx->bts);
}
if (isd->link_type == E1INP_SIGN_RSL) {
- rc = check_bts(trx->bts);
+ rc = gsm_bts_check_cfg(trx->bts);
if (rc < 0) {
LOGP(DNM, LOGL_ERROR, "(bts=%u) Error in BTS configuration -- cannot bootstrap RSL\n",
trx->bts->nr);
@@ -556,7 +506,7 @@ static int bsc_network_configure(const char *config_file)
osmo_signal_register_handler(SS_L_INPUT, inp_sig_cb, NULL);
llist_for_each_entry(bts, &bsc_gsmnet->bts_list, list) {
- rc = check_bts(bts);
+ rc = gsm_bts_check_cfg(bts);
if (rc < 0) {
LOGP(DNM, LOGL_FATAL, "(bts=%u) cannot bootstrap BTS, invalid BTS configuration\n", bts->nr);
return rc;