aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVadim Yanitskiy <vyanitskiy@sysmocom.de>2020-10-29 06:32:36 +0700
committerlaforge <laforge@osmocom.org>2020-11-02 11:16:59 +0000
commita72a0765a4687ba4c24a3b299768b7c87f97e1a2 (patch)
tree28ab15ddf569fe18852864b290a69b437010abaf
parent850607295ca451c7f68233f9a34d4b845b673e87 (diff)
main: register VTY commands before handle_options()
Otherwise only those commands that are registered by libosmocore appear in the generated XML VTY reference - change the order. Instead of a pointer to 'struct gsm_bts', pass the application's talloc context, as it's only used for dynamic command allocation. Change-Id: Ic356a950da85de02c82e9882a5fbadaaa6929680 Related: SYS#4937, OS#3036
-rw-r--r--include/osmo-bts/vty.h2
-rw-r--r--src/common/main.c6
-rw-r--r--src/common/vty.c18
3 files changed, 13 insertions, 13 deletions
diff --git a/include/osmo-bts/vty.h b/include/osmo-bts/vty.h
index b6e3f0d3..c9840d11 100644
--- a/include/osmo-bts/vty.h
+++ b/include/osmo-bts/vty.h
@@ -22,7 +22,7 @@ struct phy_instance *vty_get_phy_instance(struct vty *vty, int phy_nr, int inst_
int bts_vty_go_parent(struct vty *vty);
int bts_vty_is_config_node(struct vty *vty, int node);
-int bts_vty_init(struct gsm_bts *bts);
+int bts_vty_init(void *ctx);
struct gsm_network *gsmnet_from_vty(struct vty *v);
diff --git a/src/common/main.c b/src/common/main.c
index 279e8231..463b7a83 100644
--- a/src/common/main.c
+++ b/src/common/main.c
@@ -277,6 +277,9 @@ int bts_main(int argc, char **argv)
osmo_cpu_sched_vty_init(tall_bts_ctx);
rate_ctr_init(tall_bts_ctx);
+ bts_vty_init(tall_bts_ctx);
+ e1inp_vty_init();
+
handle_options(argc, argv);
bts = gsm_bts_alloc(tall_bts_ctx, 0);
@@ -285,9 +288,6 @@ int bts_main(int argc, char **argv)
exit(1);
}
- e1inp_vty_init();
- bts_vty_init(bts);
-
/* enable realtime priority for us */
if (rt_prio != -1) {
struct sched_param param;
diff --git a/src/common/vty.c b/src/common/vty.c
index d20b143b..957678ab 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -1815,33 +1815,33 @@ DEFUN(no_logging_fltr_l1_sapi, no_logging_fltr_l1_sapi_cmd, "HIDDEN", "HIDDEN")
return CMD_SUCCESS;
}
-int bts_vty_init(struct gsm_bts *bts)
+int bts_vty_init(void *ctx)
{
- cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+ cfg_trx_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
"gsmtap-sapi (",
"|",")", VTY_DO_LOWER);
- cfg_trx_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+ cfg_trx_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
"Enable sending of UL/DL messages over GSMTAP\n",
"\n", "", 0);
- cfg_trx_no_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+ cfg_trx_no_gsmtap_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
"no gsmtap-sapi (",
"|",")", VTY_DO_LOWER);
- cfg_trx_no_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, gsmtap_sapi_names,
+ cfg_trx_no_gsmtap_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, gsmtap_sapi_names,
NO_STR "Disable sending of UL/DL messages over GSMTAP\n",
"\n", "", 0);
- logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+ logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
"logging filter l1-sapi (",
"|", ")", VTY_DO_LOWER);
- logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+ logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
LOGGING_STR FILTER_STR "L1 SAPI\n",
"\n", "", 0);
- no_logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+ no_logging_fltr_l1_sapi_cmd.string = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
"no logging filter l1-sapi (",
"|", ")", VTY_DO_LOWER);
- no_logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(bts, l1sap_common_sapi_names,
+ no_logging_fltr_l1_sapi_cmd.doc = vty_cmd_string_from_valstr(ctx, l1sap_common_sapi_names,
NO_STR LOGGING_STR FILTER_STR "L1 SAPI\n",
"\n", "", 0);