Change in osmo-bsc[master]: codec_pref: check codec configuration before start

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Mon Oct 8 09:50:12 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/11243 )

Change subject: codec_pref: check codec configuration before start
......................................................................

codec_pref: check codec configuration before start

In networks with a couple of different BTSs it may be likely that one
accidently sets up a codec configuration (codec-support)) that will be
mutually exclusive towards the codec configuration for the MSC
(codec-list). We need a check that validates the configuration before
start to catch such configuration flaws quickly.

- Add a check that checks each MSC codec-list against each BTS
  codec-support setting.

Change-Id: Ice827896bab1a2330741e0fccc731a04f1a07d38
Related: OS#3625
---
M include/osmocom/bsc/codec_pref.h
M src/osmo-bsc/codec_pref.c
M src/osmo-bsc/osmo_bsc_main.c
3 files changed, 33 insertions(+), 0 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/bsc/codec_pref.h b/include/osmocom/bsc/codec_pref.h
index 3085ad4..d62d29f 100644
--- a/include/osmocom/bsc/codec_pref.h
+++ b/include/osmocom/bsc/codec_pref.h
@@ -21,3 +21,5 @@
 void gen_bss_supported_codec_list(struct gsm0808_speech_codec_list *scl,
 				  const struct bsc_msc_data *msc,
 				  const struct gsm_bts *bts);
+
+int check_codec_pref(struct llist_head *mscs);
diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c
index afecaa3..0f0ffa5 100644
--- a/src/osmo-bsc/codec_pref.c
+++ b/src/osmo-bsc/codec_pref.c
@@ -348,3 +348,29 @@
 	}
 }
 
+/*! Visit the codec settings for the MSC and for each BTS in order to make sure
+ *  that the configuration does not contain any combinations that lead into a
+ *  mutually exclusive codec configuration (empty intersection).
+ *  \param[in] mscs list head of the msc list.
+ *  \returns 0 on success, -1 in case an invalid setting is found. */
+int check_codec_pref(struct llist_head *mscs)
+{
+	struct bsc_msc_data *msc;
+	struct gsm_bts *bts;
+	struct gsm0808_speech_codec_list scl;
+	int rc = 0;
+
+	llist_for_each_entry(msc, mscs, entry) {
+		llist_for_each_entry(bts, &msc->network->bts_list, list) {
+			gen_bss_supported_codec_list(&scl, msc, bts);
+			if (scl.len <= 0) {
+				LOGP(DMSC, LOGL_FATAL,
+				     "codec-support of BTS %u does not intersect with codec-list of MSC %u\n",
+				     bts->nr, msc->nr);
+				rc = -1;
+			}
+		}
+	}
+
+	return rc;
+}
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 468b58e..67fccd3 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -59,6 +59,7 @@
 #include <osmocom/bsc/abis_rsl.h>
 #include <osmocom/bsc/chan_alloc.h>
 #include <osmocom/bsc/e1_config.h>
+#include <osmocom/bsc/codec_pref.h>
 
 #include <osmocom/mgcp_client/mgcp_client.h>
 
@@ -881,6 +882,10 @@
 		exit(1);
 	}
 
+	rc = check_codec_pref(&bsc_gsmnet->bsc_data->mscs);
+	if (rc < 0)
+		LOGP(DMSC, LOGL_ERROR, "Configuration contains mutually exclusive codec settings -- check configuration!\n");
+
 	llist_for_each_entry(msc, &bsc_gsmnet->bsc_data->mscs, entry) {
 		if (osmo_bsc_msc_init(msc) != 0) {
 			LOGP(DNAT, LOGL_ERROR, "Failed to start up. Exiting.\n");

-- 
To view, visit https://gerrit.osmocom.org/11243
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ice827896bab1a2330741e0fccc731a04f1a07d38
Gerrit-Change-Number: 11243
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181008/68a5f8f2/attachment.htm>


More information about the gerrit-log mailing list