gbproxy_main: Process options after all initialization is done
Previously gprs_ns2_vty_init() was called after handle_options(). This
caused config-ns* commands to be missing when calling
osmo-gbproxy --vty-ref-xml
which is used to generate the vty reference manual.
This commit moves argument handling until after all VTY commands have
been installed.
Change-Id: I0f779c16085a42b308925a676b144999106f2b63
diff --git a/src/gb_proxy_main.c b/src/gb_proxy_main.c
index cf7421f..1a4e951 100644
--- a/src/gb_proxy_main.c
+++ b/src/gb_proxy_main.c
@@ -289,23 +289,6 @@
osmo_cpu_sched_vty_init(tall_sgsn_ctx);
gbproxy_vty_init();
- handle_options(argc, argv);
-
- /* Backwards compatibility: for years, the default config file name was
- * osmo_gbproxy.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 (!config_file) {
- /* No -c option was passed */
- if (file_exists(CONFIG_FILE_LEGACY)
- && !file_exists(CONFIG_FILE_DEFAULT))
- config_file = CONFIG_FILE_LEGACY;
- else
- config_file = CONFIG_FILE_DEFAULT;
- }
-
rate_ctr_init(tall_sgsn_ctx);
osmo_stats_init(tall_sgsn_ctx);
@@ -323,6 +306,23 @@
gprs_ns2_vty_init(gbcfg->nsi);
logging_vty_add_deprecated_subsys(tall_sgsn_ctx, "bssgp");
+ handle_options(argc, argv);
+
+ /* Backwards compatibility: for years, the default config file name was
+ * osmo_gbproxy.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 (!config_file) {
+ /* No -c option was passed */
+ if (file_exists(CONFIG_FILE_LEGACY)
+ && !file_exists(CONFIG_FILE_DEFAULT))
+ config_file = CONFIG_FILE_LEGACY;
+ else
+ config_file = CONFIG_FILE_DEFAULT;
+ }
+
bssgp_set_bssgp_callback(gbprox_bssgp_send_cb, gbcfg);
rc = gbproxy_parse_config(config_file, gbcfg);