Ensure all 'view' commands are availalbe from 'enable' too
diff --git a/openbsc/include/vty/command.h b/openbsc/include/vty/command.h
index 99fba47..1b6e0a7 100644
--- a/openbsc/include/vty/command.h
+++ b/openbsc/include/vty/command.h
@@ -350,6 +350,7 @@
void install_node(struct cmd_node *, int (*)(struct vty *));
void install_default(enum node_type);
void install_element(enum node_type, struct cmd_element *);
+void install_element_ve(struct cmd_element *cmd);
void sort_node();
/* Concatenates argv[shift] through argv[argc-1] into a single NUL-terminated
diff --git a/openbsc/src/vty/command.c b/openbsc/src/vty/command.c
index fe29824..a1130b6 100644
--- a/openbsc/src/vty/command.c
+++ b/openbsc/src/vty/command.c
@@ -478,6 +478,13 @@
cmd->cmdsize = cmd_cmdsize(cmd->strvec);
}
+/* Install a command into VIEW and ENABLE node */
+void install_element_ve(struct cmd_element *cmd)
+{
+ install_element(VIEW_NODE, cmd);
+ install_element(ENABLE_NODE, cmd);
+}
+
#ifdef VTY_CRYPT_PW
static unsigned char itoa64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
diff --git a/openbsc/src/vty_interface.c b/openbsc/src/vty_interface.c
index 48dce9e..acfdd94 100644
--- a/openbsc/src/vty_interface.c
+++ b/openbsc/src/vty_interface.c
@@ -1904,17 +1904,17 @@
cmd_init(1);
vty_init();
- install_element(VIEW_NODE, &show_net_cmd);
- install_element(VIEW_NODE, &show_bts_cmd);
- install_element(VIEW_NODE, &show_trx_cmd);
- install_element(VIEW_NODE, &show_ts_cmd);
- install_element(VIEW_NODE, &show_lchan_cmd);
+ install_element_ve(&show_net_cmd);
+ install_element_ve(&show_bts_cmd);
+ install_element_ve(&show_trx_cmd);
+ install_element_ve(&show_ts_cmd);
+ install_element_ve(&show_lchan_cmd);
- install_element(VIEW_NODE, &show_e1drv_cmd);
- install_element(VIEW_NODE, &show_e1line_cmd);
- install_element(VIEW_NODE, &show_e1ts_cmd);
+ install_element_ve(&show_e1drv_cmd);
+ install_element_ve(&show_e1line_cmd);
+ install_element_ve(&show_e1ts_cmd);
- install_element(VIEW_NODE, &show_paging_cmd);
+ install_element_ve(&show_paging_cmd);
openbsc_vty_add_cmds();
diff --git a/openbsc/src/vty_interface_cmds.c b/openbsc/src/vty_interface_cmds.c
index 3181892..dd5e108 100644
--- a/openbsc/src/vty_interface_cmds.c
+++ b/openbsc/src/vty_interface_cmds.c
@@ -324,14 +324,13 @@
void openbsc_vty_add_cmds()
{
- install_element(VIEW_NODE, &enable_logging_cmd);
- install_element(VIEW_NODE, &disable_logging_cmd);
- install_element(VIEW_NODE, &logging_fltr_imsi_cmd);
- install_element(VIEW_NODE, &logging_fltr_all_cmd);
- install_element(VIEW_NODE, &logging_use_clr_cmd);
- install_element(VIEW_NODE, &logging_prnt_timestamp_cmd);
- install_element(VIEW_NODE, &logging_set_category_mask_cmd);
- install_element(VIEW_NODE, &logging_level_cmd);
- install_element(VIEW_NODE, &show_logging_vty_cmd);
-
+ install_element_ve(&enable_logging_cmd);
+ install_element_ve(&disable_logging_cmd);
+ install_element_ve(&logging_fltr_imsi_cmd);
+ install_element_ve(&logging_fltr_all_cmd);
+ install_element_ve(&logging_use_clr_cmd);
+ install_element_ve(&logging_prnt_timestamp_cmd);
+ install_element_ve(&logging_set_category_mask_cmd);
+ install_element_ve(&logging_level_cmd);
+ install_element_ve(&show_logging_vty_cmd);
}
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index fee5bae..1b2adbb 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -544,16 +544,16 @@
register_signal_handler(SS_SCALL, scall_cbfn, NULL);
- install_element(VIEW_NODE, &show_subscr_cmd);
- install_element(VIEW_NODE, &show_subscr_cache_cmd);
+ install_element_ve(&show_subscr_cmd);
+ install_element_ve(&show_subscr_cache_cmd);
- install_element(VIEW_NODE, &sms_send_pend_cmd);
+ install_element_ve(&sms_send_pend_cmd);
- install_element(VIEW_NODE, &subscriber_send_sms_cmd);
- install_element(VIEW_NODE, &subscriber_silent_sms_cmd);
- install_element(VIEW_NODE, &subscriber_silent_call_start_cmd);
- install_element(VIEW_NODE, &subscriber_silent_call_stop_cmd);
- install_element(VIEW_NODE, &show_stats_cmd);
+ install_element_ve(&subscriber_send_sms_cmd);
+ install_element_ve(&subscriber_silent_sms_cmd);
+ install_element_ve(&subscriber_silent_call_start_cmd);
+ install_element_ve(&subscriber_silent_call_stop_cmd);
+ install_element_ve(&show_stats_cmd);
install_element(CONFIG_NODE, &cfg_subscr_cmd);
install_node(&subscr_node, dummy_config_write);