aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Smith <osmith@sysmocom.de>2020-03-17 12:21:00 +0100
committerOliver Smith <osmith@sysmocom.de>2020-03-19 12:29:22 +0100
commita595db15ea991f8cf46bf6b634b57bc2494d1ad2 (patch)
tree4fdd3d686a35bbc832aeabf69f8b85cb7c41b8ac
parent5edae5d203897aa6d4bc32c052330855dd811475 (diff)
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
-rw-r--r--include/osmocom/bsc/gsm_data.h3
-rw-r--r--src/osmo-bsc/bsc_vty.c15
-rw-r--r--src/osmo-bsc/osmo_bsc_main.c12
3 files changed, 28 insertions, 2 deletions
diff --git a/include/osmocom/bsc/gsm_data.h b/include/osmocom/bsc/gsm_data.h
index 040e36d79..5afc2cfce 100644
--- a/include/osmocom/bsc/gsm_data.h
+++ b/include/osmocom/bsc/gsm_data.h
@@ -1608,6 +1608,9 @@ struct gsm_network {
/* 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 dd157c016..39adb21ac 100644
--- a/src/osmo-bsc/bsc_vty.c
+++ b/src/osmo-bsc/bsc_vty.c
@@ -1092,6 +1092,9 @@ static int config_write_net(struct vty *vty)
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 @@ DEFUN(cfg_net_timer, cfg_net_timer_cmd,
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 @@ int bsc_vty_init(struct gsm_network *network)
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 66310b37c..bf68c9b84 100644
--- a/src/osmo-bsc/osmo_bsc_main.c
+++ b/src/osmo-bsc/osmo_bsc_main.c
@@ -902,8 +902,16 @@ int main(int argc, char **argv)
}
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) {