diff options
author | Harald Welte <laforge@osmocom.org> | 2021-02-23 16:41:04 +0100 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-02-23 16:43:37 +0100 |
commit | ebd39830cbb43e591c48b92a442aac4157a02af2 (patch) | |
tree | 247b34b95a19ca54b3185689f7a98ceee9b40b3b /src | |
parent | b05c1d0ce4a0399620d8b18a39b40d461d08cef1 (diff) |
main: change initialization order
We must have initialized e.g. the NS protocol stack before calling
handle_options(), as that might want to dumpy the VTY XML, and it
can obviously only dump those nodes that are registered at that
point.
Change-Id: Icd1b8fb3f466cdace67ff0d4f7c85183d8266c41
Diffstat (limited to 'src')
-rw-r--r-- | src/sgsn/sgsn_main.c | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/sgsn/sgsn_main.c b/src/sgsn/sgsn_main.c index 6c57071a2..2cabbf3cf 100644 --- a/src/sgsn/sgsn_main.c +++ b/src/sgsn/sgsn_main.c @@ -407,23 +407,6 @@ int main(int argc, char **argv) osmo_sccp_vty_init(); #endif - handle_options(argc, argv); - - /* Backwards compatibility: for years, the default config file name was - * osmo_sgsn.cfg. All other Osmocom programs use osmo-*.cfg with a - * dash. To be able to use the new config file name without breaking - * previous setups that might rely on the legacy default config file - * name, we need to look for the old config file if no -c option was - * passed AND no file exists with the new default file name. */ - if (!sgsn->config_file) { - /* No -c option was passed */ - if (file_exists(CONFIG_FILE_LEGACY) - && !file_exists(CONFIG_FILE_DEFAULT)) - osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_LEGACY); - else - osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_DEFAULT); - } - rate_ctr_init(tall_sgsn_ctx); logging_vty_add_deprecated_subsys(tall_sgsn_ctx, "bssgp"); @@ -448,6 +431,23 @@ int main(int argc, char **argv) sgsn_auth_init(sgsn); sgsn_cdr_init(sgsn); + handle_options(argc, argv); + + /* Backwards compatibility: for years, the default config file name was + * osmo_sgsn.cfg. All other Osmocom programs use osmo-*.cfg with a + * dash. To be able to use the new config file name without breaking + * previous setups that might rely on the legacy default config file + * name, we need to look for the old config file if no -c option was + * passed AND no file exists with the new default file name. */ + if (!sgsn->config_file) { + /* No -c option was passed */ + if (file_exists(CONFIG_FILE_LEGACY) + && !file_exists(CONFIG_FILE_DEFAULT)) + osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_LEGACY); + else + osmo_talloc_replace_string(sgsn, &sgsn->config_file, CONFIG_FILE_DEFAULT); + } + rc = sgsn_parse_config(sgsn->config_file); if (rc < 0) { LOGP(DGPRS, LOGL_FATAL, "Error in config file\n"); |