Change in osmo-bsc[master]: abis_nm: actively block BTSs with invalid configuration

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Dec 13 18:13:10 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bsc/+/26197 )

Change subject: abis_nm: actively block BTSs with invalid configuration
......................................................................

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
---
M include/osmocom/bsc/bts.h
M src/osmo-bsc/bts.c
M src/osmo-bsc/bts_ipaccess_nanobts.c
M src/osmo-bsc/osmo_bsc_main.c
4 files changed, 63 insertions(+), 53 deletions(-)

Approvals:
  pespin: Looks good to me, but someone else must approve
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/bts.h b/include/osmocom/bsc/bts.h
index 922753c..c4ee39d 100644
--- a/include/osmocom/bsc/bts.h
+++ b/include/osmocom/bsc/bts.h
@@ -717,6 +717,7 @@
 }
 
 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 11b1ec3..c4ae518 100644
--- a/src/osmo-bsc/bts.c
+++ b/src/osmo-bsc/bts.c
@@ -421,6 +421,57 @@
 	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 9607068..1df6537 100644
--- a/src/osmo-bsc/bts_ipaccess_nanobts.c
+++ b/src/osmo-bsc/bts_ipaccess_nanobts.c
@@ -696,6 +696,14 @@
 	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 2436641..b7e2616 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -389,56 +389,6 @@
 	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 @@
 	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 @@
 			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 @@
 	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;

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bsc/+/26197
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I42c1c26a9b800600787b1266a871f95f2114c26e
Gerrit-Change-Number: 26197
Gerrit-PatchSet: 9
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-CC: fixeria <vyanitskiy at sysmocom.de>
Gerrit-CC: osmith <osmith at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211213/daa4f6c5/attachment.htm>


More information about the gerrit-log mailing list