summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--babeld/babel_interface.c1
-rw-r--r--babeld/babeld.c1
-rw-r--r--bfdd/bfdd_vty.c2
-rw-r--r--bgpd/bgp_bmp.c1
-rw-r--r--bgpd/bgp_debug.c1
-rw-r--r--bgpd/bgp_dump.c1
-rw-r--r--bgpd/bgp_filter.c1
-rw-r--r--bgpd/bgp_rpki.c1
-rw-r--r--bgpd/bgp_vty.c14
-rw-r--r--bgpd/rfapi/bgp_rfapi_cfg.c4
-rw-r--r--bgpd/rfapi/vnc_debug.c1
-rw-r--r--eigrpd/eigrp_cli.c2
-rw-r--r--eigrpd/eigrp_dump.c1
-rw-r--r--isisd/isis_circuit.c1
-rw-r--r--isisd/isisd.c13
-rw-r--r--ldpd/ldp_debug.c1
-rw-r--r--ldpd/ldp_vty_conf.c7
-rw-r--r--lib/agentx.c1
-rw-r--r--lib/command.c102
-rw-r--r--lib/command.h3
-rw-r--r--lib/filter.c3
-rw-r--r--lib/grammar_sandbox.c2
-rw-r--r--lib/keychain.c2
-rw-r--r--lib/nexthop_group.c1
-rw-r--r--lib/northbound_cli.c1
-rw-r--r--lib/plist.c2
-rw-r--r--lib/resolver.c1
-rw-r--r--lib/routemap.c1
-rw-r--r--lib/routemap_cli.c1
-rw-r--r--lib/vrf.c2
-rw-r--r--lib/vty.c1
-rw-r--r--nhrpd/nhrp_vty.c2
-rw-r--r--ospf6d/ospf6_interface.c1
-rw-r--r--ospf6d/ospf6_top.c1
-rw-r--r--ospf6d/ospf6d.c1
-rw-r--r--ospfd/ospf_dump.c1
-rw-r--r--ospfd/ospf_vty.c2
-rw-r--r--pbrd/pbr_vty.c3
-rw-r--r--pimd/pim_cmd.c2
-rw-r--r--ripd/rip_debug.c1
-rw-r--r--ripd/rip_interface.c1
-rw-r--r--ripd/ripd.c1
-rw-r--r--ripngd/ripng_debug.c1
-rw-r--r--ripngd/ripng_interface.c1
-rw-r--r--ripngd/ripngd.c1
-rw-r--r--staticd/static_vty.c1
-rw-r--r--tests/lib/cli/test_commands.c16
-rw-r--r--vrrpd/vrrp_vty.c3
-rw-r--r--vtysh/vtysh.c48
-rw-r--r--zebra/debug.c1
-rw-r--r--zebra/interface.c2
-rw-r--r--zebra/zebra_fpm.c1
-rw-r--r--zebra/zebra_mpls_vty.c1
-rw-r--r--zebra/zebra_pw.c1
-rw-r--r--zebra/zebra_vty.c4
55 files changed, 178 insertions, 95 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c
index 072ad7060a..21fb481631 100644
--- a/babeld/babel_interface.c
+++ b/babeld/babel_interface.c
@@ -60,6 +60,7 @@ static void babel_interface_free (babel_interface_nfo *bi);
static vector babel_enable_if; /* enable interfaces (by cmd). */
static int interface_config_write(struct vty *vty);
static struct cmd_node babel_interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/babeld/babeld.c b/babeld/babeld.c
index 6a83fa102e..906f48564d 100644
--- a/babeld/babeld.c
+++ b/babeld/babeld.c
@@ -72,6 +72,7 @@ static time_t source_expiry_time;
static int babel_config_write (struct vty *vty);
static struct cmd_node cmd_babel_node =
{
+ .name = "babel",
.node = BABEL_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c
index 5a4ce22b22..71d0a49f6d 100644
--- a/bfdd/bfdd_vty.c
+++ b/bfdd/bfdd_vty.c
@@ -887,6 +887,7 @@ DEFUN_NOSH(show_debugging_bfd,
static int bfdd_write_config(struct vty *vty);
struct cmd_node bfd_node = {
+ .name = "bfd",
.node = BFD_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-bfd)# ",
@@ -894,6 +895,7 @@ struct cmd_node bfd_node = {
};
struct cmd_node bfd_peer_node = {
+ .name = "bfd peer",
.node = BFD_PEER_NODE,
.parent_node = BFD_NODE,
.prompt = "%s(config-bfd-peer)# ",
diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c
index 0a0271dd19..8902a8789a 100644
--- a/bgpd/bgp_bmp.c
+++ b/bgpd/bgp_bmp.c
@@ -1773,6 +1773,7 @@ static void bmp_active_setup(struct bmp_active *ba)
}
static struct cmd_node bmp_node = {
+ .name = "bmp",
.node = BMP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-bgp-bmp)# "
diff --git a/bgpd/bgp_debug.c b/bgpd/bgp_debug.c
index a20015bbce..f503c1b18e 100644
--- a/bgpd/bgp_debug.c
+++ b/bgpd/bgp_debug.c
@@ -2284,6 +2284,7 @@ static int bgp_config_write_debug(struct vty *vty)
static int bgp_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = bgp_config_write_debug,
diff --git a/bgpd/bgp_dump.c b/bgpd/bgp_dump.c
index 36efcd5380..a79c5e0da0 100644
--- a/bgpd/bgp_dump.c
+++ b/bgpd/bgp_dump.c
@@ -780,6 +780,7 @@ DEFUN (no_dump_bgp_all,
static int config_write_bgp_dump(struct vty *vty);
/* BGP node structure. */
static struct cmd_node bgp_dump_node = {
+ .name = "dump",
.node = DUMP_NODE,
.prompt = "",
.config_write = config_write_bgp_dump,
diff --git a/bgpd/bgp_filter.c b/bgpd/bgp_filter.c
index 0f70e6e5ae..3e26263df1 100644
--- a/bgpd/bgp_filter.c
+++ b/bgpd/bgp_filter.c
@@ -669,6 +669,7 @@ static int config_write_as_list(struct vty *vty)
static int config_write_as_list(struct vty *vty);
static struct cmd_node as_list_node = {
+ .name = "as list",
.node = AS_LIST_NODE,
.prompt = "",
.config_write = config_write_as_list,
diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c
index 2d11718b58..11ef8563c4 100644
--- a/bgpd/bgp_rpki.c
+++ b/bgpd/bgp_rpki.c
@@ -144,6 +144,7 @@ static int rpki_sync_socket_rtr;
static int rpki_sync_socket_bgpd;
static struct cmd_node rpki_node = {
+ .name = "rpki",
.node = RPKI_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-rpki)# ",
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index e44f515187..873edf66cf 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -15335,6 +15335,7 @@ int bgp_config_write(struct vty *vty)
/* BGP node structure. */
static struct cmd_node bgp_node = {
+ .name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
@@ -15342,72 +15343,84 @@ static struct cmd_node bgp_node = {
};
static struct cmd_node bgp_ipv4_unicast_node = {
+ .name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_multicast_node = {
+ .name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_labeled_unicast_node = {
+ .name = "bgp ipv4 labeled unicast",
.node = BGP_IPV4L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_unicast_node = {
+ .name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_multicast_node = {
+ .name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_labeled_unicast_node = {
+ .name = "bgp ipv6 labeled unicast",
.node = BGP_IPV6L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv4_node = {
+ .name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv6_node = {
+ .name = "bgp vpnv6",
.node = BGP_VPNV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
};
static struct cmd_node bgp_evpn_node = {
+ .name = "bgp evpn",
.node = BGP_EVPN_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-evpn)# ",
};
static struct cmd_node bgp_evpn_vni_node = {
+ .name = "bgp evpn vni",
.node = BGP_EVPN_VNI_NODE,
.parent_node = BGP_EVPN_NODE,
.prompt = "%s(config-router-af-vni)# ",
};
static struct cmd_node bgp_flowspecv4_node = {
+ .name = "bgp ipv4 flowspec",
.node = BGP_FLOWSPECV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv6_node = {
+ .name = "bgp ipv6 flowspec",
.node = BGP_FLOWSPECV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
@@ -17893,6 +17906,7 @@ static int community_list_config_write(struct vty *vty)
static int community_list_config_write(struct vty *vty);
static struct cmd_node community_list_node = {
+ .name = "community list",
.node = COMMUNITY_LIST_NODE,
.prompt = "",
.config_write = community_list_config_write,
diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c
index 929165aa66..dd21a83913 100644
--- a/bgpd/rfapi/bgp_rfapi_cfg.c
+++ b/bgpd/rfapi/bgp_rfapi_cfg.c
@@ -2965,12 +2965,14 @@ DEFUN_NOSH (exit_vnc,
}
static struct cmd_node bgp_vnc_defaults_node = {
+ .name = "bgp vnc defaults",
.node = BGP_VNC_DEFAULTS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
};
static struct cmd_node bgp_vnc_nve_group_node = {
+ .name = "bgp vnc nve",
.node = BGP_VNC_NVE_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
@@ -3394,6 +3396,7 @@ DEFUN_NOSH (exit_vrf_policy,
}
static struct cmd_node bgp_vrf_policy_node = {
+ .name = "bgp vrf policy",
.node = BGP_VRF_POLICY_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
@@ -3633,6 +3636,7 @@ DEFUN (vnc_l2_group_rt,
static struct cmd_node bgp_vnc_l2_group_node = {
+ .name = "bgp vnc l2",
.node = BGP_VNC_L2_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
diff --git a/bgpd/rfapi/vnc_debug.c b/bgpd/rfapi/vnc_debug.c
index 5839d96f4c..5c627efbee 100644
--- a/bgpd/rfapi/vnc_debug.c
+++ b/bgpd/rfapi/vnc_debug.c
@@ -175,6 +175,7 @@ static int bgp_vnc_config_write_debug(struct vty *vty)
static int bgp_vnc_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
+ .name = "vnc debug",
.node = DEBUG_VNC_NODE,
.prompt = "",
.config_write = bgp_vnc_config_write_debug,
diff --git a/eigrpd/eigrp_cli.c b/eigrpd/eigrp_cli.c
index 502d29ebf9..c76e067685 100644
--- a/eigrpd/eigrp_cli.c
+++ b/eigrpd/eigrp_cli.c
@@ -840,6 +840,7 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,
*/
static int eigrp_config_write(struct vty *vty);
static struct cmd_node eigrp_node = {
+ .name = "eigrp",
.node = EIGRP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
@@ -862,6 +863,7 @@ static int eigrp_config_write(struct vty *vty)
static int eigrp_write_interface(struct vty *vty);
static struct cmd_node eigrp_interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/eigrpd/eigrp_dump.c b/eigrpd/eigrp_dump.c
index 05a25a433f..a3d6eb2e9e 100644
--- a/eigrpd/eigrp_dump.c
+++ b/eigrpd/eigrp_dump.c
@@ -557,6 +557,7 @@ DEFUN (no_debug_eigrp_packets,
/* Debug node. */
static int config_write_debug(struct vty *vty);
static struct cmd_node eigrp_debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c
index 47e91ac107..4add1e6bfd 100644
--- a/isisd/isis_circuit.c
+++ b/isisd/isis_circuit.c
@@ -1335,6 +1335,7 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
}
struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/isisd/isisd.c b/isisd/isisd.c
index a776e2da0a..2bb028f5ff 100644
--- a/isisd/isisd.c
+++ b/isisd/isisd.c
@@ -786,6 +786,7 @@ DEFUN_NOSH (show_debugging,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
@@ -2128,6 +2129,13 @@ static int isis_config_write(struct vty *vty)
return write;
}
+struct cmd_node router_node = {
+ .name = "openfabric",
+ .node = OPENFABRIC_NODE,
+ .parent_node = CONFIG_NODE,
+ .prompt = "%s(config-router)# ",
+ .config_write = isis_config_write,
+};
#else
/* IS-IS configuration write function */
static int isis_config_write(struct vty *vty)
@@ -2143,14 +2151,15 @@ static int isis_config_write(struct vty *vty)
return write;
}
-#endif /* ifdef FABRICD */
struct cmd_node router_node = {
- .node = ROUTER_NODE,
+ .name = "isis",
+ .node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
.config_write = isis_config_write,
};
+#endif /* ifdef FABRICD */
void isis_init(void)
{
diff --git a/ldpd/ldp_debug.c b/ldpd/ldp_debug.c
index 59d8676ec2..b9ef60ff94 100644
--- a/ldpd/ldp_debug.c
+++ b/ldpd/ldp_debug.c
@@ -33,6 +33,7 @@ static int ldp_debug_config_write(struct vty *);
/* Debug node. */
struct cmd_node ldp_debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = ldp_debug_config_write,
diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c
index ca82263b7d..3abd0817a8 100644
--- a/ldpd/ldp_vty_conf.c
+++ b/ldpd/ldp_vty_conf.c
@@ -40,6 +40,7 @@ static int ldp_vty_get_af(struct vty *);
static int ldp_iface_is_configured(struct ldpd_conf *, const char *);
struct cmd_node ldp_node = {
+ .name = "ldp",
.node = LDP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ldp)# ",
@@ -47,30 +48,35 @@ struct cmd_node ldp_node = {
};
struct cmd_node ldp_ipv4_node = {
+ .name = "ldp ipv4",
.node = LDP_IPV4_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
struct cmd_node ldp_ipv6_node = {
+ .name = "ldp ipv6",
.node = LDP_IPV6_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
struct cmd_node ldp_ipv4_iface_node = {
+ .name = "ldp ipv4 interface",
.node = LDP_IPV4_IFACE_NODE,
.parent_node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
struct cmd_node ldp_ipv6_iface_node = {
+ .name = "ldp ipv6 interface",
.node = LDP_IPV6_IFACE_NODE,
.parent_node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
struct cmd_node ldp_l2vpn_node = {
+ .name = "ldp l2vpn",
.node = LDP_L2VPN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-l2vpn)# ",
@@ -78,6 +84,7 @@ struct cmd_node ldp_l2vpn_node = {
};
struct cmd_node ldp_pseudowire_node = {
+ .name = "ldp",
.node = LDP_PSEUDOWIRE_NODE,
.parent_node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn-pw)# ",
diff --git a/lib/agentx.c b/lib/agentx.c
index 42c843bbb1..7c4bdcbe27 100644
--- a/lib/agentx.c
+++ b/lib/agentx.c
@@ -160,6 +160,7 @@ static void agentx_events_update(void)
/* AgentX node. */
static int config_write_agentx(struct vty *vty);
static struct cmd_node agentx_node = {
+ .name = "smux",
.node = SMUX_NODE,
.prompt = "",
.config_write = config_write_agentx,
diff --git a/lib/command.c b/lib/command.c
index dad35bfbf8..8ec93c1b33 100644
--- a/lib/command.c
+++ b/lib/command.c
@@ -73,86 +73,6 @@ const struct message tokennames[] = {
item(END_TKN),
{0},
};
-
-const char *const node_names[] = {
- "auth", // AUTH_NODE,
- "view", // VIEW_NODE,
- "auth enable", // AUTH_ENABLE_NODE,
- "enable", // ENABLE_NODE,
- "config", // CONFIG_NODE,
- "debug", // DEBUG_NODE,
- "vrf debug", // VRF_DEBUG_NODE,
- "northbound debug", // NORTHBOUND_DEBUG_NODE,
- "vnc debug", // DEBUG_VNC_NODE,
- "route-map debug", /* RMAP_DEBUG_NODE */
- "resolver debug", /* RESOLVER_DEBUG_NODE */
- "aaa", // AAA_NODE,
- "keychain", // KEYCHAIN_NODE,
- "keychain key", // KEYCHAIN_KEY_NODE,
- "static ip", // IP_NODE,
- "vrf", // VRF_NODE,
- "interface", // INTERFACE_NODE,
- "nexthop-group", // NH_GROUP_NODE,
- "zebra", // ZEBRA_NODE,
- "table", // TABLE_NODE,
- "rip", // RIP_NODE,
- "ripng", // RIPNG_NODE,
- "babel", // BABEL_NODE,
- "eigrp", // EIGRP_NODE,
- "bgp", // BGP_NODE,
- "bgp vpnv4", // BGP_VPNV4_NODE,
- "bgp vpnv6", // BGP_VPNV6_NODE,
- "bgp ipv4 unicast", // BGP_IPV4_NODE,
- "bgp ipv4 multicast", // BGP_IPV4M_NODE,
- "bgp ipv4 labeled unicast", // BGP_IPV4L_NODE,
- "bgp ipv6", // BGP_IPV6_NODE,
- "bgp ipv6 multicast", // BGP_IPV6M_NODE,
- "bgp ipv6 labeled unicast", // BGP_IPV6L_NODE,
- "bgp vrf policy", // BGP_VRF_POLICY_NODE,
- "bgp vnc defaults", // BGP_VNC_DEFAULTS_NODE,
- "bgp vnc nve", // BGP_VNC_NVE_GROUP_NODE,
- "bgp vnc l2", // BGP_VNC_L2_GROUP_NODE,
- "rfp defaults", // RFP_DEFAULTS_NODE,
- "bgp evpn", // BGP_EVPN_NODE,
- "ospf", // OSPF_NODE,
- "ospf6", // OSPF6_NODE,
- "ldp", // LDP_NODE,
- "ldp ipv4", // LDP_IPV4_NODE,
- "ldp ipv6", // LDP_IPV6_NODE,
- "ldp ipv4 interface", // LDP_IPV4_IFACE_NODE,
- "ldp ipv6 interface", // LDP_IPV6_IFACE_NODE,
- "ldp l2vpn", // LDP_L2VPN_NODE,
- "ldp", // LDP_PSEUDOWIRE_NODE,
- "isis", // ISIS_NODE,
- "ipv4 access list", // ACCESS_NODE,
- "ipv4 prefix list", // PREFIX_NODE,
- "ipv6 access list", // ACCESS_IPV6_NODE,
- "MAC access list", // ACCESS_MAC_NODE,
- "ipv6 prefix list", // PREFIX_IPV6_NODE,
- "as list", // AS_LIST_NODE,
- "community list", // COMMUNITY_LIST_NODE,
- "routemap", // RMAP_NODE,
- "pbr-map", // PBRMAP_NODE,
- "smux", // SMUX_NODE,
- "dump", // DUMP_NODE,
- "forwarding", // FORWARDING_NODE,
- "protocol", // PROTOCOL_NODE,
- "mpls", // MPLS_NODE,
- "pw", // PW_NODE,
- "vty", // VTY_NODE,
- "link-params", // LINK_PARAMS_NODE,
- "bgp evpn vni", // BGP_EVPN_VNI_NODE,
- "rpki", // RPKI_NODE
- "bgp ipv4 flowspec", /* BGP_FLOWSPECV4_NODE
- */
- "bgp ipv6 flowspec", /* BGP_FLOWSPECV6_NODE
- */
- "bfd", /* BFD_NODE */
- "bfd peer", /* BFD_PEER_NODE */
- "openfabric", // OPENFABRIC_NODE
- "vrrp", /* VRRP_NODE */
- "bmp", /* BMP_NODE */
-};
/* clang-format on */
/* Command vector which includes some level of command lists. Normally
@@ -181,27 +101,32 @@ const char *cmd_domainname_get(void)
/* Standard command node structures. */
static struct cmd_node auth_node = {
+ .name = "auth",
.node = AUTH_NODE,
.prompt = "Password: ",
};
static struct cmd_node view_node = {
+ .name = "view",
.node = VIEW_NODE,
.prompt = "%s> ",
};
static struct cmd_node auth_enable_node = {
+ .name = "auth enable",
.node = AUTH_ENABLE_NODE,
.prompt = "Password: ",
};
static struct cmd_node enable_node = {
+ .name = "enable",
.node = ENABLE_NODE,
.prompt = "%s# ",
};
static int config_write_host(struct vty *vty);
static struct cmd_node config_node = {
+ .name = "config",
.node = CONFIG_NODE,
.parent_node = ENABLE_NODE,
.prompt = "%s(config)# ",
@@ -395,9 +320,9 @@ void install_element(enum node_type ntype, const struct cmd_element *cmd)
if (cnode == NULL) {
fprintf(stderr,
"%s[%s]:\n"
- "\tnode %d (%s) does not exist.\n"
+ "\tnode %d does not exist.\n"
"\tplease call install_node() before install_element()\n",
- cmd->name, cmd->string, ntype, node_names[ntype]);
+ cmd->name, cmd->string, ntype);
exit(EXIT_FAILURE);
}
@@ -406,7 +331,7 @@ void install_element(enum node_type ntype, const struct cmd_element *cmd)
"%s[%s]:\n"
"\tnode %d (%s) already has this command installed.\n"
"\tduplicate install_element call?\n",
- cmd->name, cmd->string, ntype, node_names[ntype]);
+ cmd->name, cmd->string, ntype, cnode->name);
return;
}
@@ -444,9 +369,9 @@ void uninstall_element(enum node_type ntype, const struct cmd_element *cmd)
if (cnode == NULL) {
fprintf(stderr,
"%s[%s]:\n"
- "\tnode %d (%s) does not exist.\n"
+ "\tnode %d does not exist.\n"
"\tplease call install_node() before uninstall_element()\n",
- cmd->name, cmd->string, ntype, node_names[ntype]);
+ cmd->name, cmd->string, ntype);
exit(EXIT_FAILURE);
}
@@ -455,7 +380,7 @@ void uninstall_element(enum node_type ntype, const struct cmd_element *cmd)
"%s[%s]:\n"
"\tnode %d (%s) does not have this command installed.\n"
"\tduplicate uninstall_element call?\n",
- cmd->name, cmd->string, ntype, node_names[ntype]);
+ cmd->name, cmd->string, ntype, cnode->name);
return;
}
@@ -2745,7 +2670,7 @@ DEFUN(find,
if (regexec(&exp, cli->string, 0, NULL, 0) == 0)
vty_out(vty, " (%s) %s\n",
- node_names[node->node], cli->string);
+ node->name, cli->string);
}
}
@@ -2793,9 +2718,6 @@ void cmd_init(int terminal)
{
struct utsname names;
- if (array_size(node_names) != NODE_TYPE_MAX)
- assert(!"Update the CLI node description array!");
-
uname(&names);
qobj_init();
diff --git a/lib/command.h b/lib/command.h
index c1de67e10f..6ab8497fe6 100644
--- a/lib/command.h
+++ b/lib/command.h
@@ -165,11 +165,12 @@ enum node_type {
extern vector cmdvec;
extern const struct message tokennames[];
-extern const char *const node_names[];
/* Node which has some commands and prompt string and configuration
function pointer . */
struct cmd_node {
+ const char *name;
+
/* Node index. */
enum node_type node;
enum node_type parent_node;
diff --git a/lib/filter.c b/lib/filter.c
index c6cc16d7d9..71c9b8095a 100644
--- a/lib/filter.c
+++ b/lib/filter.c
@@ -2814,6 +2814,7 @@ static int config_write_access(struct vty *vty, afi_t afi)
static int config_write_access_mac(struct vty *vty);
static struct cmd_node access_mac_node = {
+ .name = "MAC access list",
.node = ACCESS_MAC_NODE,
.prompt = "",
.config_write = config_write_access_mac,
@@ -2868,6 +2869,7 @@ static void access_list_init_mac(void)
/* Access-list node. */
static int config_write_access_ipv4(struct vty *vty);
static struct cmd_node access_node = {
+ .name = "ipv4 access list",
.node = ACCESS_NODE,
.prompt = "",
.config_write = config_write_access_ipv4,
@@ -2956,6 +2958,7 @@ static void access_list_init_ipv4(void)
static int config_write_access_ipv6(struct vty *vty);
static struct cmd_node access_ipv6_node = {
+ .name = "ipv6 access list",
.node = ACCESS_IPV6_NODE,
.prompt = "",
.config_write = config_write_access_ipv6,
diff --git a/lib/grammar_sandbox.c b/lib/grammar_sandbox.c
index 8ccdbfcbc1..a40b815caa 100644
--- a/lib/grammar_sandbox.c
+++ b/lib/grammar_sandbox.c
@@ -399,7 +399,7 @@ DEFUN (grammar_findambig,
if (!nodegraph)
continue;
vty_out(vty, "scanning node %d (%s)\n", scannode - 1,
- node_names[scannode - 1]);
+ cnode->name);
}
commands = cmd_graph_permutations(nodegraph);
diff --git a/lib/keychain.c b/lib/keychain.c
index bfeaa7fec2..251211734b 100644
--- a/lib/keychain.c
+++ b/lib/keychain.c
@@ -961,6 +961,7 @@ DEFUN (no_send_lifetime,
static int keychain_config_write(struct vty *vty);
static struct cmd_node keychain_node = {
+ .name = "keychain",
.node = KEYCHAIN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-keychain)# ",
@@ -968,6 +969,7 @@ static struct cmd_node keychain_node = {
};
static struct cmd_node keychain_key_node = {
+ .name = "keychain key",
.node = KEYCHAIN_KEY_NODE,
.parent_node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain-key)# ",
diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c
index 5544605290..c23c57d2e1 100644
--- a/lib/nexthop_group.c
+++ b/lib/nexthop_group.c
@@ -935,6 +935,7 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,
static int nexthop_group_write(struct vty *vty);
static struct cmd_node nexthop_group_node = {
+ .name = "nexthop-group",
.node = NH_GROUP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-nh-group)# ",
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c
index d0e05990a8..d4467facaf 100644
--- a/lib/northbound_cli.c
+++ b/lib/northbound_cli.c
@@ -1675,6 +1675,7 @@ static int nb_debug_config_write(struct vty *vty)
static struct debug_callbacks nb_dbg_cbs = {.debug_set_all = nb_debug_set_all};
static struct cmd_node nb_debug_node = {
+ .name = "northbound debug",
.node = NORTHBOUND_DEBUG_NODE,
.prompt = "",
.config_write = nb_debug_config_write,
diff --git a/lib/plist.c b/lib/plist.c
index acc4491a00..8d43b9bd89 100644
--- a/lib/plist.c
+++ b/lib/plist.c
@@ -2047,6 +2047,7 @@ static void prefix_list_reset_afi(afi_t afi, int orf)
static int config_write_prefix_ipv4(struct vty *vty);
/* Prefix-list node. */
static struct cmd_node prefix_node = {
+ .name = "ipv4 prefix list",
.node = PREFIX_NODE,
.prompt = "",
.config_write = config_write_prefix_ipv4,
@@ -2113,6 +2114,7 @@ static void prefix_list_init_ipv4(void)
static int config_write_prefix_ipv6(struct vty *vty);
/* Prefix-list node. */
static struct cmd_node prefix_ipv6_node = {
+ .name = "ipv6 prefix list",
.node = PREFIX_IPV6_NODE,
.prompt = "",
.config_write = config_write_prefix_ipv6,
diff --git a/lib/resolver.c b/lib/resolver.c
index 56b2d6cd66..e5caadb2d0 100644
--- a/lib/resolver.c
+++ b/lib/resolver.c
@@ -247,6 +247,7 @@ DEFUN(debug_resolver,
static int resolver_config_write_debug(struct vty *vty);
static struct cmd_node resolver_debug_node = {
+ .name = "resolver debug",
.node = RESOLVER_DEBUG_NODE,
.prompt = "",
.config_write = resolver_config_write_debug,
diff --git a/lib/routemap.c b/lib/routemap.c
index 2208a69f94..210512212d 100644
--- a/lib/routemap.c
+++ b/lib/routemap.c
@@ -3017,6 +3017,7 @@ DEFUN (no_debug_rmap,
/* Debug node. */
static int rmap_config_write_debug(struct vty *vty);
static struct cmd_node rmap_debug_node = {
+ .name = "route-map debug",
.node = RMAP_DEBUG_NODE,
.prompt = "",
.config_write = rmap_config_write_debug,
diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c
index 16ecd11941..2c45f09751 100644
--- a/lib/routemap_cli.c
+++ b/lib/routemap_cli.c
@@ -1066,6 +1066,7 @@ static int route_map_config_write(struct vty *vty)
/* Route map node structure. */
static int route_map_config_write(struct vty *vty);
static struct cmd_node rmap_node = {
+ .name = "routemap",
.node = RMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-route-map)# ",
diff --git a/lib/vrf.c b/lib/vrf.c
index 1fadf5c0c8..0f57c602b1 100644
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -759,6 +759,7 @@ DEFUN (no_vrf,
static struct cmd_node vrf_node = {
+ .name = "vrf",
.node = VRF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-vrf)# ",
@@ -854,6 +855,7 @@ static int vrf_write_host(struct vty *vty)
static int vrf_write_host(struct vty *vty);
static struct cmd_node vrf_debug_node = {
+ .name = "vrf debug",
.node = VRF_DEBUG_NODE,
.prompt = "",
.config_write = vrf_write_host,
diff --git a/lib/vty.c b/lib/vty.c
index 24cdfeda42..683c39f893 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -3009,6 +3009,7 @@ static int vty_config_write(struct vty *vty)
static int vty_config_write(struct vty *vty);
struct cmd_node vty_node = {
+ .name = "vty",
.node = VTY_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-line)# ",
diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c
index bf29d02181..fe681b4052 100644
--- a/nhrpd/nhrp_vty.c
+++ b/nhrpd/nhrp_vty.c
@@ -19,6 +19,7 @@
static int nhrp_config_write(struct vty *vty);
static struct cmd_node zebra_node = {
+ .name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
@@ -27,6 +28,7 @@ static struct cmd_node zebra_node = {
static int interface_config_write(struct vty *vty);
static struct cmd_node nhrp_interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c
index 8ed9c67974..1209997514 100644
--- a/ospf6d/ospf6_interface.c
+++ b/ospf6d/ospf6_interface.c
@@ -1945,6 +1945,7 @@ static int config_write_ospf6_interface(struct vty *vty)
static int config_write_ospf6_interface(struct vty *vty);
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c
index 75c0460eca..dd672dd1c5 100644
--- a/ospf6d/ospf6_top.c
+++ b/ospf6d/ospf6_top.c
@@ -1115,6 +1115,7 @@ static int config_write_ospf6(struct vty *vty)
static int config_write_ospf6(struct vty *vty);
/* OSPF6 node structure. */
static struct cmd_node ospf6_node = {
+ .name = "ospf6",
.node = OSPF6_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ospf6)# ",
diff --git a/ospf6d/ospf6d.c b/ospf6d/ospf6d.c
index efbb332b6e..17e33902d9 100644
--- a/ospf6d/ospf6d.c
+++ b/ospf6d/ospf6d.c
@@ -71,6 +71,7 @@ struct route_node *route_prev(struct route_node *node)
static int config_write_ospf6_debug(struct vty *vty);
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_ospf6_debug,
diff --git a/ospfd/ospf_dump.c b/ospfd/ospf_dump.c
index e012326ea9..f0740349a0 100644
--- a/ospfd/ospf_dump.c
+++ b/ospfd/ospf_dump.c
@@ -1643,6 +1643,7 @@ DEFUN_NOSH (show_debugging_ospf_instance,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c
index 25bd410015..a3a02a0f95 100644
--- a/ospfd/ospf_vty.c
+++ b/ospfd/ospf_vty.c
@@ -10558,6 +10558,7 @@ void ospf_vty_show_init(void)
static int config_write_interface(struct vty *vty);
/* ospfd's interface node. */
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@@ -10676,6 +10677,7 @@ static void ospf_vty_zebra_init(void)
static int ospf_config_write(struct vty *vty);
static struct cmd_node ospf_node = {
+ .name = "ospf",
.node = OSPF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c
index 35dbb24d19..a52c2d1e30 100644
--- a/pbrd/pbr_vty.c
+++ b/pbrd/pbr_vty.c
@@ -678,6 +678,7 @@ DEFPY (show_pbr_interface,
/* PBR debugging CLI ------------------------------------------------------- */
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = pbr_debug_config_write,
@@ -731,6 +732,7 @@ DEFUN_NOSH(show_debugging_pbr,
static int pbr_interface_config_write(struct vty *vty);
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@@ -765,6 +767,7 @@ static int pbr_interface_config_write(struct vty *vty)
static int pbr_vty_map_config_write(struct vty *vty);
/* PBR map node structure. */
static struct cmd_node pbr_map_node = {
+ .name = "pbr-map",
.node = PBRMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pbr-map)# ",
diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c
index 895072a892..f99888b3af 100644
--- a/pimd/pim_cmd.c
+++ b/pimd/pim_cmd.c
@@ -70,6 +70,7 @@
#endif
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@@ -77,6 +78,7 @@ static struct cmd_node interface_node = {
};
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = pim_debug_config_write,
diff --git a/ripd/rip_debug.c b/ripd/rip_debug.c
index 676fc0cca4..871ee8e87e 100644
--- a/ripd/rip_debug.c
+++ b/ripd/rip_debug.c
@@ -175,6 +175,7 @@ DEFUN (no_debug_rip_zebra,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c
index 924eb8334b..177f53db45 100644
--- a/ripd/rip_interface.c
+++ b/ripd/rip_interface.c
@@ -1195,6 +1195,7 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)
static int rip_interface_config_write(struct vty *vty);
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/ripd/ripd.c b/ripd/ripd.c
index b6bbfb253d..fee700583b 100644
--- a/ripd/ripd.c
+++ b/ripd/ripd.c
@@ -3330,6 +3330,7 @@ static int config_write_rip(struct vty *vty)
static int config_write_rip(struct vty *vty);
/* RIP node structure. */
static struct cmd_node rip_node = {
+ .name = "rip",
.node = RIP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
diff --git a/ripngd/ripng_debug.c b/ripngd/ripng_debug.c
index 117148a3a1..54edb17ecc 100644
--- a/ripngd/ripng_debug.c
+++ b/ripngd/ripng_debug.c
@@ -177,6 +177,7 @@ DEFUN (no_debug_ripng_zebra,
static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c
index e45bbbe214..e8c907227e 100644
--- a/ripngd/ripng_interface.c
+++ b/ripngd/ripng_interface.c
@@ -957,6 +957,7 @@ static int interface_config_write(struct vty *vty)
static int interface_config_write(struct vty *vty);
/* ripngd's interface node. */
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c
index 47083f9471..d26e103866 100644
--- a/ripngd/ripngd.c
+++ b/ripngd/ripngd.c
@@ -2437,6 +2437,7 @@ static int ripng_config_write(struct vty *vty)
static int ripng_config_write(struct vty *vty);
/* RIPng node structure. */
static struct cmd_node cmd_ripng_node = {
+ .name = "ripng",
.node = RIPNG_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
diff --git a/staticd/static_vty.c b/staticd/static_vty.c
index 733578f86c..16cd64bcb6 100644
--- a/staticd/static_vty.c
+++ b/staticd/static_vty.c
@@ -1471,6 +1471,7 @@ DEFUN_NOSH (show_debugging_static,
}
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = static_config_write_debug,
diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c
index 54417f4954..2b345c91e8 100644
--- a/tests/lib/cli/test_commands.c
+++ b/tests/lib/cli/test_commands.c
@@ -49,96 +49,112 @@ static vector test_cmds;
static char test_buf[32768];
static struct cmd_node bgp_node = {
+ .name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node rip_node = {
+ .name = "rip",
.node = RIP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node isis_node = {
+ .name = "isis",
.node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
};
static struct cmd_node rmap_node = {
+ .name = "routemap",
.node = RMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-route-map)# ",
};
static struct cmd_node zebra_node = {
+ .name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node bgp_vpnv4_node = {
+ .name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_node = {
+ .name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4m_node = {
+ .name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_node = {
+ .name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6m_node = {
+ .name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node ospf_node = {
+ .name = "ospf",
.node = OSPF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ripng_node = {
+ .name = "ripng",
.node = RIPNG_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ospf6_node = {
+ .name = "ospf6",
.node = OSPF6_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ospf6)# ",
};
static struct cmd_node keychain_node = {
+ .name = "keychain",
.node = KEYCHAIN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-keychain)# ",
};
static struct cmd_node keychain_key_node = {
+ .name = "keychain key",
.node = KEYCHAIN_KEY_NODE,
.parent_node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain-key)# ",
diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c
index f2048db984..b6388cc5ba 100644
--- a/vrrpd/vrrp_vty.c
+++ b/vrrpd/vrrp_vty.c
@@ -745,6 +745,7 @@ static int vrrp_config_write_interface(struct vty *vty)
}
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@@ -752,12 +753,14 @@ static struct cmd_node interface_node = {
};
static struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = vrrp_config_write_debug,
};
static struct cmd_node vrrp_node = {
+ .name = "vrrp",
.node = VRRP_NODE,
.prompt = "",
.config_write = vrrp_config_write_global,
diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c
index ddb40a572f..a21deb4a0e 100644
--- a/vtysh/vtysh.c
+++ b/vtysh/vtysh.c
@@ -1173,264 +1173,308 @@ static char **new_completion(const char *text, int start, int end)
/* Vty node structures. */
static struct cmd_node bgp_node = {
+ .name = "bgp",
.node = BGP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node rip_node = {
+ .name = "rip",
.node = RIP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node isis_node = {
+ .name = "isis",
.node = ISIS_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node openfabric_node = {
+ .name = "openfabric",
.node = OPENFABRIC_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
};
static struct cmd_node pw_node = {
+ .name = "pw",
.node = PW_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pw)# ",
};
static struct cmd_node vrf_node = {
+ .name = "vrf",
.node = VRF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-vrf)# ",
};
static struct cmd_node nh_group_node = {
+ .name = "nexthop-group",
.node = NH_GROUP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-nh-group)# ",
};
static struct cmd_node rmap_node = {
+ .name = "routemap",
.node = RMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-route-map)# ",
};
static struct cmd_node pbr_map_node = {
+ .name = "pbr-map",
.node = PBRMAP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pbr-map)# ",
};
static struct cmd_node zebra_node = {
+ .name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node bgp_vpnv4_node = {
+ .name = "bgp vpnv4",
.node = BGP_VPNV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv6_node = {
+ .name = "bgp vpnv6",
.node = BGP_VPNV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv4_node = {
+ .name = "bgp ipv4 flowspec",
.node = BGP_FLOWSPECV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv6_node = {
+ .name = "bgp ipv6 flowspec",
.node = BGP_FLOWSPECV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_node = {
+ .name = "bgp ipv4 unicast",
.node = BGP_IPV4_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4m_node = {
+ .name = "bgp ipv4 multicast",
.node = BGP_IPV4M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4l_node = {
+ .name = "bgp ipv4 labeled unicast",
.node = BGP_IPV4L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_node = {
+ .name = "bgp ipv6",
.node = BGP_IPV6_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6m_node = {
+ .name = "bgp ipv6 multicast",
.node = BGP_IPV6M_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_evpn_node = {
+ .name = "bgp evpn",
.node = BGP_EVPN_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_evpn_vni_node = {
+ .name = "bgp evpn vni",
.node = BGP_EVPN_VNI_NODE,
.parent_node = BGP_EVPN_NODE,
.prompt = "%s(config-router-af-vni)# ",
};
static struct cmd_node bgp_ipv6l_node = {
+ .name = "bgp ipv6 labeled unicast",
.node = BGP_IPV6L_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vnc_defaults_node = {
+ .name = "bgp vnc defaults",
.node = BGP_VNC_DEFAULTS_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
};
static struct cmd_node bgp_vnc_nve_group_node = {
+ .name = "bgp vnc nve",
.node = BGP_VNC_NVE_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
};
static struct cmd_node bgp_vrf_policy_node = {
+ .name = "bgp vrf policy",
.node = BGP_VRF_POLICY_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
};
static struct cmd_node bgp_vnc_l2_group_node = {
+ .name = "bgp vnc l2",
.node = BGP_VNC_L2_GROUP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
};
static struct cmd_node bmp_node = {
+ .name = "bmp",
.node = BMP_NODE,
.parent_node = BGP_NODE,
.prompt = "%s(config-bgp-bmp)# "
};
static struct cmd_node ospf_node = {
+ .name = "ospf",
.node = OSPF_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node eigrp_node = {
+ .name = "eigrp",
.node = EIGRP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node babel_node = {
+ .name = "babel",
.node = BABEL_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ripng_node = {
+ .name = "ripng",
.node = RIPNG_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ospf6_node = {
+ .name = "ospf6",
.node = OSPF6_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ospf6)# ",
};
static struct cmd_node ldp_node = {
+ .name = "ldp",
.node = LDP_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-ldp)# ",
};
static struct cmd_node ldp_ipv4_node = {
+ .name = "ldp ipv4",
.node = LDP_IPV4_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
static struct cmd_node ldp_ipv6_node = {
+ .name = "ldp ipv6",
.node = LDP_IPV6_NODE,
.parent_node = LDP_NODE,
.prompt = "%s(config-ldp-af)# ",
};
static struct cmd_node ldp_ipv4_iface_node = {
+ .name = "ldp ipv4 interface",
.node = LDP_IPV4_IFACE_NODE,
.parent_node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
static struct cmd_node ldp_ipv6_iface_node = {
+ .name = "ldp ipv6 interface",
.node = LDP_IPV6_IFACE_NODE,
.parent_node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
static struct cmd_node ldp_l2vpn_node = {
+ .name = "ldp l2vpn",
.node = LDP_L2VPN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-l2vpn)# ",
};
static struct cmd_node ldp_pseudowire_node = {
+ .name = "ldp",
.node = LDP_PSEUDOWIRE_NODE,
.parent_node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn-pw)# ",
};
static struct cmd_node keychain_node = {
+ .name = "keychain",
.node = KEYCHAIN_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-keychain)# ",
};
static struct cmd_node keychain_key_node = {
+ .name = "keychain key",
.node = KEYCHAIN_KEY_NODE,
.parent_node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain-key)# ",
};
struct cmd_node link_params_node = {
+ .name = "link-params",
.node = LINK_PARAMS_NODE,
.parent_node = INTERFACE_NODE,
.prompt = "%s(config-link-params)# ",
};
static struct cmd_node rpki_node = {
+ .name = "rpki",
.node = RPKI_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-rpki)# ",
@@ -1438,12 +1482,14 @@ static struct cmd_node rpki_node = {
#if HAVE_BFDD > 0
static struct cmd_node bfd_node = {
+ .name = "bfd",
.node = BFD_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-bfd)# ",
};
static struct cmd_node bfd_peer_node = {
+ .name = "bfd peer",
.node = BFD_PEER_NODE,
.parent_node = BFD_NODE,
.prompt = "%s(config-bfd-peer)# ",
@@ -3568,7 +3614,7 @@ DEFUN(find,
if (regexec(&exp, cli->string, 0, NULL, 0) == 0)
vty_out(vty, " (%s) %s\n",
- node_names[node->node], cli->string);
+ node->name, cli->string);
}
}
diff --git a/zebra/debug.c b/zebra/debug.c
index a77693d94d..c920fca5ff 100644
--- a/zebra/debug.c
+++ b/zebra/debug.c
@@ -473,6 +473,7 @@ DEFPY (debug_zebra_nexthop,
/* Debug node. */
static int config_write_debug(struct vty *vty);
struct cmd_node debug_node = {
+ .name = "debug",
.node = DEBUG_NODE,
.prompt = "",
.config_write = config_write_debug,
diff --git a/zebra/interface.c b/zebra/interface.c
index f4b330d8a8..cad382ff08 100644
--- a/zebra/interface.c
+++ b/zebra/interface.c
@@ -1666,6 +1666,7 @@ static void interface_update_stats(void)
static int if_config_write(struct vty *vty);
struct cmd_node interface_node = {
+ .name = "interface",
.node = INTERFACE_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-if)# ",
@@ -2080,6 +2081,7 @@ DEFUN (no_bandwidth_if,
struct cmd_node link_params_node = {
+ .name = "link-params",
.node = LINK_PARAMS_NODE,
.parent_node = INTERFACE_NODE,
.prompt = "%s(config-link-params)# ",
diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c
index 462a75b551..41d73f3c97 100644
--- a/zebra/zebra_fpm.c
+++ b/zebra/zebra_fpm.c
@@ -1941,6 +1941,7 @@ static int fpm_remote_srv_write(struct vty *vty)
static int fpm_remote_srv_write(struct vty *vty);
/* Zebra node */
static struct cmd_node zebra_node = {
+ .name = "zebra",
.node = ZEBRA_NODE,
.parent_node = CONFIG_NODE,
.prompt = "",
diff --git a/zebra/zebra_mpls_vty.c b/zebra/zebra_mpls_vty.c
index 148b9c46db..d789f20071 100644
--- a/zebra/zebra_mpls_vty.c
+++ b/zebra/zebra_mpls_vty.c
@@ -452,6 +452,7 @@ DEFUN (no_mpls_label_global_block,
static int zebra_mpls_config(struct vty *vty);
/* MPLS node for MPLS LSP. */
static struct cmd_node mpls_node = {
+ .name = "mpls",
.node = MPLS_NODE,
.prompt = "",
.config_write = zebra_mpls_config,
diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c
index 1885401287..7a14f6304f 100644
--- a/zebra/zebra_pw.c
+++ b/zebra/zebra_pw.c
@@ -549,6 +549,7 @@ static int zebra_pw_config(struct vty *vty)
static int zebra_pw_config(struct vty *vty);
static struct cmd_node pw_node = {
+ .name = "pw",
.node = PW_NODE,
.parent_node = CONFIG_NODE,
.prompt = "%s(config-pw)# ",
diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c
index bb8d0c7744..8042264ca8 100644
--- a/zebra/zebra_vty.c
+++ b/zebra/zebra_vty.c
@@ -3480,12 +3480,14 @@ DEFUN_HIDDEN (show_frr,
/* IP node for static routes. */
static int zebra_ip_config(struct vty *vty);
static struct cmd_node ip_node = {
+ .name = "static ip",
.node = IP_NODE,
.prompt = "",
.config_write = zebra_ip_config,
};
static int config_write_protocol(struct vty *vty);
static struct cmd_node protocol_node = {
+ .name = "protocol",
.node = PROTOCOL_NODE,
.prompt = "",
.config_write = config_write_protocol,
@@ -3493,12 +3495,14 @@ static struct cmd_node protocol_node = {
/* table node for routing tables. */
static int config_write_table(struct vty *vty);
static struct cmd_node table_node = {
+ .name = "table",
.node = TABLE_NODE,
.prompt = "",
.config_write = config_write_table,
};
static int config_write_forwarding(struct vty *vty);
static struct cmd_node forwarding_node = {
+ .name = "forwarding",
.node = FORWARDING_NODE,
.prompt = "",
.config_write = config_write_forwarding,