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
This commit is contained in:
Philipp Maier 2021-11-09 16:21:34 +01:00
parent 5cebdefed6
commit 3ba9bd7c35
4 changed files with 63 additions and 53 deletions

View File

@ -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);

View File

@ -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)

View File

@ -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. */

View File

@ -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;