Change in osmo-bsc[master]: main: exit on mutually exclusive codecs settings

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
Fri Mar 20 21:25:50 UTC 2020


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

Change subject: main: exit on mutually exclusive codecs settings
......................................................................

main: exit on mutually exclusive codecs settings

Refuse to start with mutually exclusive codec settings, unless
allow-unusable-timeslots is set in the network section of the config.
The checks were already implemented and fill the error log if the config
is invalid.

Related: OS#3739
Change-Id: I3ccfc3b0a8641400cb97a23b24d7ed92d2ad25cd
---
M include/osmocom/bsc/gsm_data.h
M src/osmo-bsc/bsc_vty.c
M src/osmo-bsc/osmo_bsc_main.c
3 files changed, 28 insertions(+), 2 deletions(-)

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



diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 040e36d..5afc2cf 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1608,6 +1608,9 @@
 
 	/* Remote BSS Cell Identifier Lists */
 	struct neighbor_ident_list *neighbor_bss_cells;
+
+	/* Don't refuse to start with mutually exclusive codec settings */
+	bool allow_unusable_timeslots;
 };
 
 struct gsm_audio_support {
diff --git a/src/osmo-bsc/bsc_vty.c b/src/osmo-bsc/bsc_vty.c
index dd157c0..39adb21 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1092,6 +1092,9 @@
 				meas_scenario, VTY_NEWLINE);
 	}
 
+	if (gsmnet->allow_unusable_timeslots)
+		vty_out(vty, " allow-unusable-timeslots%s", VTY_NEWLINE);
+
 	return CMD_SUCCESS;
 }
 
@@ -5209,6 +5212,17 @@
 	return osmo_tdef_vty_set_cmd(vty, net->T_defs, argv);
 }
 
+DEFUN(cfg_net_allow_unusable_timeslots, cfg_net_allow_unusable_timeslots_cmd,
+      "allow-unusable-timeslots",
+      "Don't refuse to start with mutually exclusive codec settings\n")
+{
+	struct gsm_network *net = gsmnet_from_vty(vty);
+	net->allow_unusable_timeslots = true;
+	LOGP(DMSC, LOGL_ERROR, "Configuration contains 'allow-unusable-timeslots'. OsmoBSC will start up even if the"
+			       " configuration has unusable codec settings!\n");
+	return CMD_SUCCESS;
+}
+
 extern int bsc_vty_init_extra(void);
 
 int bsc_vty_init(struct gsm_network *network)
@@ -5254,6 +5268,7 @@
 	install_element(GSMNET_NODE, &cfg_net_meas_feed_dest_cmd);
 	install_element(GSMNET_NODE, &cfg_net_meas_feed_scenario_cmd);
 	install_element(GSMNET_NODE, &cfg_net_timer_cmd);
+	install_element(GSMNET_NODE, &cfg_net_allow_unusable_timeslots_cmd);
 
 	install_element_ve(&bsc_show_net_cmd);
 	install_element_ve(&show_bts_cmd);
diff --git a/src/osmo-bsc/osmo_bsc_main.c b/src/osmo-bsc/osmo_bsc_main.c
index 66310b3..bf68c9b 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -902,8 +902,16 @@
 	}
 
 	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");
+	if (rc < 0) {
+		LOGP(DMSC, LOGL_ERROR, "Configuration contains mutually exclusive codec settings -- check"
+				       " configuration!\n");
+		if (!bsc_gsmnet->allow_unusable_timeslots) {
+			LOGP(DMSC, LOGL_ERROR, "You should really fix that! However, you can prevent OsmoBSC from"
+					       " stopping here by setting 'allow-unusable-timeslots' in the 'network'"
+					       " section of the config.\n");
+			exit(1);
+		}
+	}
 
 	llist_for_each_entry(msc, &bsc_gsmnet->bsc_data->mscs, entry) {
 		if (osmo_bsc_msc_init(msc) != 0) {

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Change-Id: I3ccfc3b0a8641400cb97a23b24d7ed92d2ad25cd
Gerrit-Change-Number: 17491
Gerrit-PatchSet: 5
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200320/51ad2370/attachment.htm>


More information about the gerrit-log mailing list