*: clean up cmd_node initializers

... and use named assignments everywhere (so I can change the struct.)

Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
David Lamparter 2018-09-08 21:46:23 +02:00 committed by David Lamparter
parent 4c749d99dc
commit 62b346eefa
51 changed files with 625 additions and 270 deletions

View file

@ -58,11 +58,10 @@ static void babel_interface_free (babel_interface_nfo *bi);
static vector babel_enable_if; /* enable interfaces (by cmd). */
static struct cmd_node babel_interface_node = /* babeld's interface node. */
{
INTERFACE_NODE,
"%s(config-if)# ",
1 /* VTYSH */
static struct cmd_node babel_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};

View file

@ -886,15 +886,15 @@ DEFUN_NOSH(show_debugging_bfd,
}
struct cmd_node bfd_node = {
BFD_NODE,
"%s(config-bfd)# ",
1,
.node = BFD_NODE,
.prompt = "%s(config-bfd)# ",
.vtysh = 1,
};
struct cmd_node bfd_peer_node = {
BFD_PEER_NODE,
"%s(config-bfd-peer)# ",
1,
.node = BFD_PEER_NODE,
.prompt = "%s(config-bfd-peer)# ",
.vtysh = 1,
};
static int bfdd_write_config(struct vty *vty)

View file

@ -1772,7 +1772,10 @@ static void bmp_active_setup(struct bmp_active *ba)
}
}
static struct cmd_node bmp_node = {BMP_NODE, "%s(config-bgp-bmp)# "};
static struct cmd_node bmp_node = {
.node = BMP_NODE,
.prompt = "%s(config-bgp-bmp)# "
};
#define BMP_STR "BGP Monitoring Protocol\n"

View file

@ -2282,7 +2282,11 @@ static int bgp_config_write_debug(struct vty *vty)
return write;
}
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
void bgp_debug_init(void)
{

View file

@ -778,7 +778,11 @@ DEFUN (no_dump_bgp_all,
}
/* BGP node structure. */
static struct cmd_node bgp_dump_node = {DUMP_NODE, "", 1};
static struct cmd_node bgp_dump_node = {
.node = DUMP_NODE,
.prompt = "",
.vtysh = 1,
};
#if 0
char *

View file

@ -667,7 +667,11 @@ static int config_write_as_list(struct vty *vty)
return write;
}
static struct cmd_node as_list_node = {AS_LIST_NODE, "", 1};
static struct cmd_node as_list_node = {
.node = AS_LIST_NODE,
.prompt = "",
.vtysh = 1,
};
/* Register functions. */
void bgp_filter_init(void)

View file

@ -143,7 +143,11 @@ static unsigned int retry_interval;
static int rpki_sync_socket_rtr;
static int rpki_sync_socket_bgpd;
static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1};
static struct cmd_node rpki_node = {
.node = RPKI_NODE,
.prompt = "%s(config-rpki)# ",
.vtysh = 1,
};
static const struct route_map_rule_cmd route_match_rpki_cmd = {
"rpki", route_match, route_match_compile, route_match_free};

View file

@ -15335,50 +15335,82 @@ int bgp_config_write(struct vty *vty)
/* BGP node structure. */
static struct cmd_node bgp_node = {
BGP_NODE, "%s(config-router)# ", 1,
.node = BGP_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};
static struct cmd_node bgp_ipv4_unicast_node = {
BGP_IPV4_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV4_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_ipv4_multicast_node = {
BGP_IPV4M_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV4M_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_ipv4_labeled_unicast_node = {
BGP_IPV4L_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV4L_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_ipv6_unicast_node = {
BGP_IPV6_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV6_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_ipv6_multicast_node = {
BGP_IPV6M_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV6M_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_ipv6_labeled_unicast_node = {
BGP_IPV6L_NODE, "%s(config-router-af)# ", 1,
.node = BGP_IPV6L_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,
"%s(config-router-af)# ", 1};
static struct cmd_node bgp_vpnv4_node = {
.node = BGP_VPNV4_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_vpnv6_node = {BGP_VPNV6_NODE,
"%s(config-router-af-vpnv6)# ", 1};
static struct cmd_node bgp_vpnv6_node = {
.node = BGP_VPNV6_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
.vtysh = 1,
};
static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE,
"%s(config-router-evpn)# ", 1};
static struct cmd_node bgp_evpn_node = {
.node = BGP_EVPN_NODE,
.prompt = "%s(config-router-evpn)# ",
.vtysh = 1,
};
static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE,
"%s(config-router-af-vni)# ", 1};
static struct cmd_node bgp_evpn_vni_node = {
.node = BGP_EVPN_VNI_NODE,
.prompt = "%s(config-router-af-vni)# ",
.vtysh = 1,
};
static struct cmd_node bgp_flowspecv4_node = {BGP_FLOWSPECV4_NODE,
"%s(config-router-af)# ", 1};
static struct cmd_node bgp_flowspecv4_node = {
.node = BGP_FLOWSPECV4_NODE,
.prompt = "%s(config-router-af)# ",
.vtysh = 1,
};
static struct cmd_node bgp_flowspecv6_node = {BGP_FLOWSPECV6_NODE,
"%s(config-router-af-vpnv6)# ", 1};
static struct cmd_node bgp_flowspecv6_node = {
.node = BGP_FLOWSPECV6_NODE,
.prompt = "%s(config-router-af-vpnv6)# ",
.vtysh = 1,
};
static void community_list_vty(void);
@ -17859,7 +17891,9 @@ static int community_list_config_write(struct vty *vty)
}
static struct cmd_node community_list_node = {
COMMUNITY_LIST_NODE, "", 1 /* Export to vtysh. */
.node = COMMUNITY_LIST_NODE,
.prompt = "",
.vtysh = 1,
};
static void community_list_vty(void)

View file

@ -2965,10 +2965,16 @@ DEFUN_NOSH (exit_vnc,
}
static struct cmd_node bgp_vnc_defaults_node = {
BGP_VNC_DEFAULTS_NODE, "%s(config-router-vnc-defaults)# ", 1};
.node = BGP_VNC_DEFAULTS_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
.vtysh = 1,
};
static struct cmd_node bgp_vnc_nve_group_node = {
BGP_VNC_NVE_GROUP_NODE, "%s(config-router-vnc-nve-group)# ", 1};
.node = BGP_VNC_NVE_GROUP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
.vtysh = 1,
};
/*-------------------------------------------------------------------------
* VNC nve-group
@ -3388,7 +3394,10 @@ DEFUN_NOSH (exit_vrf_policy,
}
static struct cmd_node bgp_vrf_policy_node = {
BGP_VRF_POLICY_NODE, "%s(config-router-vrf-policy)# ", 1};
.node = BGP_VRF_POLICY_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
.vtysh = 1,
};
/*-------------------------------------------------------------------------
* vnc-l2-group
@ -3624,7 +3633,10 @@ DEFUN (vnc_l2_group_rt,
static struct cmd_node bgp_vnc_l2_group_node = {
BGP_VNC_L2_GROUP_NODE, "%s(config-router-vnc-l2-group)# ", 1};
.node = BGP_VNC_L2_GROUP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
.vtysh = 1,
};
struct rfapi_l2_group_cfg *
bgp_rfapi_get_group_by_lni_label(struct bgp *bgp, uint32_t logical_net_id,

View file

@ -173,7 +173,11 @@ static int bgp_vnc_config_write_debug(struct vty *vty)
return write;
}
static struct cmd_node debug_node = {DEBUG_VNC_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_VNC_NODE,
.prompt = "",
.vtysh = 1,
};
void vnc_debug_init(void)
{

View file

@ -838,7 +838,11 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,
/*
* CLI installation procedures.
*/
static struct cmd_node eigrp_node = {EIGRP_NODE, "%s(config-router)# ", 1};
static struct cmd_node eigrp_node = {
.node = EIGRP_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};
static int eigrp_config_write(struct vty *vty)
{
@ -854,8 +858,11 @@ static int eigrp_config_write(struct vty *vty)
return written;
}
static struct cmd_node eigrp_interface_node = {INTERFACE_NODE,
"%s(config-if)# ", 1};
static struct cmd_node eigrp_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
static int eigrp_write_interface(struct vty *vty)

View file

@ -556,7 +556,9 @@ DEFUN (no_debug_eigrp_packets,
/* Debug node. */
static struct cmd_node eigrp_debug_node = {
DEBUG_NODE, "", 1 /* VTYSH */
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
/* Initialize debug commands. */

View file

@ -1336,7 +1336,9 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
}
struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1,
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type)

View file

@ -785,7 +785,11 @@ DEFUN_NOSH (show_debugging,
}
/* Debug node. */
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_debug(struct vty *vty)
{
@ -2141,7 +2145,11 @@ int isis_config_write(struct vty *vty)
}
#endif /* ifdef FABRICD */
struct cmd_node router_node = {ROUTER_NODE, "%s(config-router)# ", 1};
struct cmd_node router_node = {
.node = ROUTER_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};
void isis_init(void)
{

View file

@ -30,11 +30,10 @@ struct ldp_debug conf_ldp_debug;
struct ldp_debug ldp_debug;
/* Debug node. */
struct cmd_node ldp_debug_node =
{
DEBUG_NODE,
"",
1
struct cmd_node ldp_debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
int

View file

@ -37,53 +37,46 @@ static void ldp_l2vpn_pw_config_write(struct vty *, struct l2vpn_pw *);
static int ldp_vty_get_af(struct vty *);
static int ldp_iface_is_configured(struct ldpd_conf *, const char *);
struct cmd_node ldp_node =
{
LDP_NODE,
"%s(config-ldp)# ",
1,
struct cmd_node ldp_node = {
.node = LDP_NODE,
.prompt = "%s(config-ldp)# ",
.vtysh = 1,
};
struct cmd_node ldp_ipv4_node =
{
LDP_IPV4_NODE,
"%s(config-ldp-af)# ",
1,
struct cmd_node ldp_ipv4_node = {
.node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af)# ",
.vtysh = 1,
};
struct cmd_node ldp_ipv6_node =
{
LDP_IPV6_NODE,
"%s(config-ldp-af)# ",
1,
struct cmd_node ldp_ipv6_node = {
.node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af)# ",
.vtysh = 1,
};
struct cmd_node ldp_ipv4_iface_node =
{
LDP_IPV4_IFACE_NODE,
"%s(config-ldp-af-if)# ",
1,
struct cmd_node ldp_ipv4_iface_node = {
.node = LDP_IPV4_IFACE_NODE,
.prompt = "%s(config-ldp-af-if)# ",
.vtysh = 1,
};
struct cmd_node ldp_ipv6_iface_node =
{
LDP_IPV6_IFACE_NODE,
"%s(config-ldp-af-if)# ",
1,
struct cmd_node ldp_ipv6_iface_node = {
.node = LDP_IPV6_IFACE_NODE,
.prompt = "%s(config-ldp-af-if)# ",
.vtysh = 1,
};
struct cmd_node ldp_l2vpn_node =
{
LDP_L2VPN_NODE,
"%s(config-l2vpn)# ",
1,
struct cmd_node ldp_l2vpn_node = {
.node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn)# ",
.vtysh = 1,
};
struct cmd_node ldp_pseudowire_node =
{
LDP_PSEUDOWIRE_NODE,
"%s(config-l2vpn-pw)# ",
1,
struct cmd_node ldp_pseudowire_node = {
.node = LDP_PSEUDOWIRE_NODE,
.prompt = "%s(config-l2vpn-pw)# ",
.vtysh = 1,
};
int

View file

@ -158,9 +158,11 @@ static void agentx_events_update(void)
}
/* AgentX node. */
static struct cmd_node agentx_node = {SMUX_NODE,
"", /* AgentX has no interface. */
1};
static struct cmd_node agentx_node = {
.node = SMUX_NODE,
.prompt = "",
.vtysh = 1,
};
/* Logging NetSNMP messages */
static int agentx_log_callback(int major, int minor, void *serverarg,

View file

@ -181,22 +181,30 @@ const char *cmd_domainname_get(void)
/* Standard command node structures. */
static struct cmd_node auth_node = {
AUTH_NODE, "Password: ",
.node = AUTH_NODE,
.prompt = "Password: ",
};
static struct cmd_node view_node = {
VIEW_NODE, "%s> ",
.node = VIEW_NODE,
.prompt = "%s> ",
};
static struct cmd_node auth_enable_node = {
AUTH_ENABLE_NODE, "Password: ",
.node = AUTH_ENABLE_NODE,
.prompt = "Password: ",
};
static struct cmd_node enable_node = {
ENABLE_NODE, "%s# ",
.node = ENABLE_NODE,
.prompt = "%s# ",
};
static struct cmd_node config_node = {CONFIG_NODE, "%s(config)# ", 1};
static struct cmd_node config_node = {
.node = CONFIG_NODE,
.prompt = "%s(config)# ",
.vtysh = 1,
};
static const struct facility_map {
int facility;

View file

@ -2813,8 +2813,10 @@ static int config_write_access(struct vty *vty, afi_t afi)
}
static struct cmd_node access_mac_node = {
ACCESS_MAC_NODE, "", /* Access list has no interface. */
1};
.node = ACCESS_MAC_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_access_mac(struct vty *vty)
{
@ -2863,9 +2865,11 @@ static void access_list_init_mac(void)
}
/* Access-list node. */
static struct cmd_node access_node = {ACCESS_NODE,
"", /* Access list has no interface. */
1};
static struct cmd_node access_node = {
.node = ACCESS_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_access_ipv4(struct vty *vty)
{
@ -2948,7 +2952,11 @@ static void access_list_init_ipv4(void)
install_element(CONFIG_NODE, &no_access_list_remark_comment_cmd);
}
static struct cmd_node access_ipv6_node = {ACCESS_IPV6_NODE, "", 1};
static struct cmd_node access_ipv6_node = {
.node = ACCESS_IPV6_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_access_ipv6(struct vty *vty)
{

View file

@ -959,11 +959,17 @@ DEFUN (no_send_lifetime,
return CMD_SUCCESS;
}
static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# ",
1};
static struct cmd_node keychain_node = {
.node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain)# ",
.vtysh = 1,
};
static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE,
"%s(config-keychain-key)# ", 1};
static struct cmd_node keychain_key_node = {
.node = KEYCHAIN_KEY_NODE,
.prompt = "%s(config-keychain-key)# ",
.vtysh = 1,
};
static int keychain_strftime(char *buf, int bufsiz, time_t *time)
{

View file

@ -934,9 +934,9 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,
}
static struct cmd_node nexthop_group_node = {
NH_GROUP_NODE,
"%s(config-nh-group)# ",
1
.node = NH_GROUP_NODE,
.prompt = "%s(config-nh-group)# ",
.vtysh = 1,
};
void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh)

View file

@ -1674,7 +1674,11 @@ 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 = {NORTHBOUND_DEBUG_NODE, "", 1};
static struct cmd_node nb_debug_node = {
.node = NORTHBOUND_DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
void nb_cli_install_default(int node)
{

View file

@ -2045,9 +2045,11 @@ static void prefix_list_reset_afi(afi_t afi, int orf)
/* Prefix-list node. */
static struct cmd_node prefix_node = {PREFIX_NODE,
"", /* Prefix list has no interface. */
1};
static struct cmd_node prefix_node = {
.node = PREFIX_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_prefix_ipv4(struct vty *vty)
{
@ -2109,8 +2111,10 @@ static void prefix_list_init_ipv4(void)
/* Prefix-list node. */
static struct cmd_node prefix_ipv6_node = {
PREFIX_IPV6_NODE, "", /* Prefix list has no interface. */
1};
.node = PREFIX_IPV6_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_prefix_ipv6(struct vty *vty)
{

View file

@ -245,7 +245,11 @@ DEFUN(debug_resolver,
return CMD_SUCCESS;
}
static struct cmd_node resolver_debug_node = {RESOLVER_DEBUG_NODE, "", 1};
static struct cmd_node resolver_debug_node = {
.node = RESOLVER_DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int resolver_config_write_debug(struct vty *vty)
{

View file

@ -3015,7 +3015,11 @@ DEFUN (no_debug_rmap,
}
/* Debug node. */
static struct cmd_node rmap_debug_node = {RMAP_DEBUG_NODE, "", 1};
static struct cmd_node rmap_debug_node = {
.node = RMAP_DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
/* Configuration write function. */
static int rmap_config_write_debug(struct vty *vty)

View file

@ -1064,7 +1064,11 @@ static int route_map_config_write(struct vty *vty)
}
/* Route map node structure. */
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# ", 1};
static struct cmd_node rmap_node = {
.node = RMAP_NODE,
.prompt = "%s(config-route-map)# ",
.vtysh = 1,
};
static void rmap_autocomplete(vector comps, struct cmd_token *token)
{

View file

@ -758,7 +758,11 @@ DEFUN (no_vrf,
}
static struct cmd_node vrf_node = {VRF_NODE, "%s(config-vrf)# ", 1};
static struct cmd_node vrf_node = {
.node = VRF_NODE,
.prompt = "%s(config-vrf)# ",
.vtysh = 1,
};
DEFUN_NOSH (vrf_netns,
vrf_netns_cmd,
@ -848,7 +852,11 @@ static int vrf_write_host(struct vty *vty)
return 1;
}
static struct cmd_node vrf_debug_node = {VRF_DEBUG_NODE, "", 1};
static struct cmd_node vrf_debug_node = {
.node = VRF_DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
void vrf_install_commands(void)
{

View file

@ -2990,7 +2990,9 @@ static int vty_config_write(struct vty *vty)
}
struct cmd_node vty_node = {
VTY_NODE, "%s(config-line)# ", 1,
.node = VTY_NODE,
.prompt = "%s(config-line)# ",
.vtysh = 1,
};
/* Reset all VTY status. */

View file

@ -1944,7 +1944,9 @@ static int config_write_ospf6_interface(struct vty *vty)
}
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
static int ospf6_ifp_create(struct interface *ifp)

View file

@ -1114,7 +1114,9 @@ static int config_write_ospf6(struct vty *vty)
/* OSPF6 node structure. */
static struct cmd_node ospf6_node = {
OSPF6_NODE, "%s(config-ospf6)# ", 1 /* VTYSH */
.node = OSPF6_NODE,
.prompt = "%s(config-ospf6)# ",
.vtysh = 1,
};
/* Install ospf related commands. */

View file

@ -70,7 +70,9 @@ struct route_node *route_prev(struct route_node *node)
}
static struct cmd_node debug_node = {
DEBUG_NODE, "", 1 /* VTYSH */
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_ospf6_debug(struct vty *vty)

View file

@ -1642,7 +1642,9 @@ DEFUN_NOSH (show_debugging_ospf_instance,
/* Debug node. */
static struct cmd_node debug_node = {
DEBUG_NODE, "", 1 /* VTYSH */
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_debug(struct vty *vty)

View file

@ -10556,7 +10556,11 @@ void ospf_vty_show_init(void)
/* ospfd's interface node. */
static struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1};
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
/* Initialization of OSPF interface. */
static void ospf_vty_if_init(void)
@ -10668,7 +10672,11 @@ static void ospf_vty_zebra_init(void)
#endif /* 0 */
}
static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# ", 1};
static struct cmd_node ospf_node = {
.node = OSPF_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};
static void ospf_interface_clear(struct interface *ifp)
{

View file

@ -677,7 +677,11 @@ DEFPY (show_pbr_interface,
/* PBR debugging CLI ------------------------------------------------------- */
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
DEFPY(debug_pbr,
debug_pbr_cmd,
@ -726,7 +730,9 @@ DEFUN_NOSH(show_debugging_pbr,
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1 /* vtysh ? yes */
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
static int pbr_interface_config_write(struct vty *vty)
@ -755,7 +761,11 @@ static int pbr_interface_config_write(struct vty *vty)
}
/* PBR map node structure. */
static struct cmd_node pbr_map_node = {PBRMAP_NODE, "%s(config-pbr-map)# ", 1};
static struct cmd_node pbr_map_node = {
.node = PBRMAP_NODE,
.prompt = "%s(config-pbr-map)# ",
.vtysh = 1,
};
static int pbr_vty_map_config_write_sequence(struct vty *vty,
struct pbr_map *pbrm,

View file

@ -70,10 +70,16 @@
#endif
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1 /* vtysh ? yes */
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
const int argc, int *idx)

View file

@ -173,9 +173,11 @@ DEFUN (no_debug_rip_zebra,
}
/* Debug node. */
static struct cmd_node debug_node = {DEBUG_NODE,
"", /* Debug node has no interface. */
1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_debug(struct vty *vty)
{

View file

@ -1194,7 +1194,9 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)
}
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1,
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
void rip_interface_sync(struct interface *ifp)

View file

@ -3328,7 +3328,11 @@ static int config_write_rip(struct vty *vty)
}
/* RIP node structure. */
static struct cmd_node rip_node = {RIP_NODE, "%s(config-router)# ", 1};
static struct cmd_node rip_node = {
.node = RIP_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};
/* Distribute-list update functions. */
static void rip_distribute_update(struct distribute_ctx *ctx,

View file

@ -176,8 +176,9 @@ DEFUN (no_debug_ripng_zebra,
/* Debug node. */
static struct cmd_node debug_node = {
DEBUG_NODE, "", /* Debug node has no interface. */
1 /* VTYSH */
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_debug(struct vty *vty)

View file

@ -956,7 +956,9 @@ static int interface_config_write(struct vty *vty)
/* ripngd's interface node. */
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ", 1 /* VTYSH */
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
/* Initialization of interface. */

View file

@ -2436,7 +2436,9 @@ static int ripng_config_write(struct vty *vty)
/* RIPng node structure. */
static struct cmd_node cmd_ripng_node = {
RIPNG_NODE, "%s(config-router)# ", 1,
.node = RIPNG_NODE,
.prompt = "%s(config-router)# ",
.vtysh = 1,
};
static void ripng_distribute_update(struct distribute_ctx *ctx,

View file

@ -1470,7 +1470,11 @@ DEFUN_NOSH (show_debugging_static,
return CMD_SUCCESS;
}
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
void static_vty_init(void)
{

View file

@ -49,50 +49,84 @@ static vector test_cmds;
static char test_buf[32768];
static struct cmd_node bgp_node = {
BGP_NODE, "%s(config-router)# ",
.node = BGP_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node rip_node = {
RIP_NODE, "%s(config-router)# ",
.node = RIP_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node isis_node = {
ISIS_NODE, "%s(config-router)# ",
.node = ISIS_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ",
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
};
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "};
static struct cmd_node rmap_node = {
.node = RMAP_NODE,
.prompt = "%s(config-route-map)# ",
};
static struct cmd_node zebra_node = {ZEBRA_NODE, "%s(config-router)# "};
static struct cmd_node zebra_node = {
.node = ZEBRA_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_vpnv4_node = {
.node = BGP_VPNV4_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_node = {BGP_IPV4_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv4_node = {
.node = BGP_IPV4_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4m_node = {BGP_IPV4M_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv4m_node = {
.node = BGP_IPV4M_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_node = {BGP_IPV6_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv6_node = {
.node = BGP_IPV6_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6m_node = {BGP_IPV6M_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv6m_node = {
.node = BGP_IPV6M_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# "};
static struct cmd_node ospf_node = {
.node = OSPF_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ripng_node = {RIPNG_NODE, "%s(config-router)# "};
static struct cmd_node ripng_node = {
.node = RIPNG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ospf6_node = {OSPF6_NODE, "%s(config-ospf6)# "};
static struct cmd_node ospf6_node = {
.node = OSPF6_NODE,
.prompt = "%s(config-ospf6)# ",
};
static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# "};
static struct cmd_node keychain_node = {
.node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain)# ",
};
static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE,
"%s(config-keychain-key)# "};
static struct cmd_node keychain_key_node = {
.node = KEYCHAIN_KEY_NODE,
.prompt = "%s(config-keychain-key)# ",
};
static int test_callback(const struct cmd_element *cmd, struct vty *vty,
int argc, struct cmd_token *argv[])

View file

@ -744,9 +744,23 @@ static int vrrp_config_write_interface(struct vty *vty)
return write;
}
static struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1};
static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
static struct cmd_node vrrp_node = {VRRP_NODE, "", 1};
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static struct cmd_node vrrp_node = {
.node = VRRP_NODE,
.prompt = "",
.vtysh = 1,
};
void vrrp_vty_init(void)
{

View file

@ -1173,141 +1173,235 @@ static char **new_completion(const char *text, int start, int end)
/* Vty node structures. */
static struct cmd_node bgp_node = {
BGP_NODE, "%s(config-router)# ",
.node = BGP_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node rip_node = {
RIP_NODE, "%s(config-router)# ",
.node = RIP_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node isis_node = {
ISIS_NODE, "%s(config-router)# ",
.node = ISIS_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node openfabric_node = {
OPENFABRIC_NODE, "%s(config-router)# ",
.node = OPENFABRIC_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node interface_node = {
INTERFACE_NODE, "%s(config-if)# ",
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
};
static struct cmd_node pw_node = {
PW_NODE, "%s(config-pw)# ",
.node = PW_NODE,
.prompt = "%s(config-pw)# ",
};
static struct cmd_node vrf_node = {
VRF_NODE, "%s(config-vrf)# ",
.node = VRF_NODE,
.prompt = "%s(config-vrf)# ",
};
static struct cmd_node nh_group_node = {
NH_GROUP_NODE,
"%s(config-nh-group)# ",
.node = NH_GROUP_NODE,
.prompt = "%s(config-nh-group)# ",
};
static struct cmd_node rmap_node = {RMAP_NODE, "%s(config-route-map)# "};
static struct cmd_node rmap_node = {
.node = RMAP_NODE,
.prompt = "%s(config-route-map)# ",
};
static struct cmd_node pbr_map_node = {PBRMAP_NODE, "%s(config-pbr-map)# "};
static struct cmd_node pbr_map_node = {
.node = PBRMAP_NODE,
.prompt = "%s(config-pbr-map)# ",
};
static struct cmd_node zebra_node = {ZEBRA_NODE, "%s(config-router)# "};
static struct cmd_node zebra_node = {
.node = ZEBRA_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node bgp_vpnv4_node = {BGP_VPNV4_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_vpnv4_node = {
.node = BGP_VPNV4_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vpnv6_node = {BGP_VPNV6_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_vpnv6_node = {
.node = BGP_VPNV6_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv4_node = {BGP_FLOWSPECV4_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_flowspecv4_node = {
.node = BGP_FLOWSPECV4_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_flowspecv6_node = {BGP_FLOWSPECV6_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_flowspecv6_node = {
.node = BGP_FLOWSPECV6_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4_node = {BGP_IPV4_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv4_node = {
.node = BGP_IPV4_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4m_node = {BGP_IPV4M_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv4m_node = {
.node = BGP_IPV4M_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv4l_node = {BGP_IPV4L_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv4l_node = {
.node = BGP_IPV4L_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6_node = {BGP_IPV6_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv6_node = {
.node = BGP_IPV6_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_ipv6m_node = {BGP_IPV6M_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv6m_node = {
.node = BGP_IPV6M_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_evpn_node = {BGP_EVPN_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_evpn_node = {
.node = BGP_EVPN_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_evpn_vni_node = {BGP_EVPN_VNI_NODE,
"%s(config-router-af-vni)# "};
static struct cmd_node bgp_evpn_vni_node = {
.node = BGP_EVPN_VNI_NODE,
.prompt = "%s(config-router-af-vni)# ",
};
static struct cmd_node bgp_ipv6l_node = {BGP_IPV6L_NODE,
"%s(config-router-af)# "};
static struct cmd_node bgp_ipv6l_node = {
.node = BGP_IPV6L_NODE,
.prompt = "%s(config-router-af)# ",
};
static struct cmd_node bgp_vnc_defaults_node = {
BGP_VNC_DEFAULTS_NODE, "%s(config-router-vnc-defaults)# "};
static struct cmd_node bgp_vnc_nve_group_node = {
BGP_VNC_NVE_GROUP_NODE, "%s(config-router-vnc-nve-group)# "};
static struct cmd_node bgp_vrf_policy_node = {BGP_VRF_POLICY_NODE,
"%s(config-router-vrf-policy)# "};
static struct cmd_node bgp_vnc_l2_group_node = {
BGP_VNC_L2_GROUP_NODE, "%s(config-router-vnc-l2-group)# "};
static struct cmd_node bmp_node = {BMP_NODE, "%s(config-bgp-bmp)# "};
static struct cmd_node ospf_node = {OSPF_NODE, "%s(config-router)# "};
static struct cmd_node eigrp_node = {EIGRP_NODE, "%s(config-router)# "};
static struct cmd_node babel_node = {BABEL_NODE, "%s(config-router)# "};
static struct cmd_node ripng_node = {RIPNG_NODE, "%s(config-router)# "};
static struct cmd_node ospf6_node = {OSPF6_NODE, "%s(config-ospf6)# "};
static struct cmd_node ldp_node = {LDP_NODE, "%s(config-ldp)# "};
static struct cmd_node ldp_ipv4_node = {LDP_IPV4_NODE, "%s(config-ldp-af)# "};
static struct cmd_node ldp_ipv6_node = {LDP_IPV6_NODE, "%s(config-ldp-af)# "};
static struct cmd_node ldp_ipv4_iface_node = {LDP_IPV4_IFACE_NODE,
"%s(config-ldp-af-if)# "};
static struct cmd_node ldp_ipv6_iface_node = {LDP_IPV6_IFACE_NODE,
"%s(config-ldp-af-if)# "};
static struct cmd_node ldp_l2vpn_node = {LDP_L2VPN_NODE, "%s(config-l2vpn)# "};
static struct cmd_node ldp_pseudowire_node = {LDP_PSEUDOWIRE_NODE,
"%s(config-l2vpn-pw)# "};
static struct cmd_node keychain_node = {KEYCHAIN_NODE, "%s(config-keychain)# "};
static struct cmd_node keychain_key_node = {KEYCHAIN_KEY_NODE,
"%s(config-keychain-key)# "};
struct cmd_node link_params_node = {
LINK_PARAMS_NODE, "%s(config-link-params)# ",
.node = BGP_VNC_DEFAULTS_NODE,
.prompt = "%s(config-router-vnc-defaults)# ",
};
static struct cmd_node rpki_node = {RPKI_NODE, "%s(config-rpki)# ", 1};
static struct cmd_node bgp_vnc_nve_group_node = {
.node = BGP_VNC_NVE_GROUP_NODE,
.prompt = "%s(config-router-vnc-nve-group)# ",
};
static struct cmd_node bgp_vrf_policy_node = {
.node = BGP_VRF_POLICY_NODE,
.prompt = "%s(config-router-vrf-policy)# ",
};
static struct cmd_node bgp_vnc_l2_group_node = {
.node = BGP_VNC_L2_GROUP_NODE,
.prompt = "%s(config-router-vnc-l2-group)# ",
};
static struct cmd_node bmp_node = {
.node = BMP_NODE,
.prompt = "%s(config-bgp-bmp)# "
};
static struct cmd_node ospf_node = {
.node = OSPF_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node eigrp_node = {
.node = EIGRP_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node babel_node = {
.node = BABEL_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ripng_node = {
.node = RIPNG_NODE,
.prompt = "%s(config-router)# ",
};
static struct cmd_node ospf6_node = {
.node = OSPF6_NODE,
.prompt = "%s(config-ospf6)# ",
};
static struct cmd_node ldp_node = {
.node = LDP_NODE,
.prompt = "%s(config-ldp)# ",
};
static struct cmd_node ldp_ipv4_node = {
.node = LDP_IPV4_NODE,
.prompt = "%s(config-ldp-af)# ",
};
static struct cmd_node ldp_ipv6_node = {
.node = LDP_IPV6_NODE,
.prompt = "%s(config-ldp-af)# ",
};
static struct cmd_node ldp_ipv4_iface_node = {
.node = LDP_IPV4_IFACE_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
static struct cmd_node ldp_ipv6_iface_node = {
.node = LDP_IPV6_IFACE_NODE,
.prompt = "%s(config-ldp-af-if)# ",
};
static struct cmd_node ldp_l2vpn_node = {
.node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn)# ",
};
static struct cmd_node ldp_pseudowire_node = {
.node = LDP_PSEUDOWIRE_NODE,
.prompt = "%s(config-l2vpn-pw)# ",
};
static struct cmd_node keychain_node = {
.node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain)# ",
};
static struct cmd_node keychain_key_node = {
.node = KEYCHAIN_KEY_NODE,
.prompt = "%s(config-keychain-key)# ",
};
struct cmd_node link_params_node = {
.node = LINK_PARAMS_NODE,
.prompt = "%s(config-link-params)# ",
};
static struct cmd_node rpki_node = {
.node = RPKI_NODE,
.prompt = "%s(config-rpki)# ",
.vtysh = 1,
};
#if HAVE_BFDD > 0
static struct cmd_node bfd_node = {
BFD_NODE,
"%s(config-bfd)# ",
.node = BFD_NODE,
.prompt = "%s(config-bfd)# ",
};
static struct cmd_node bfd_peer_node = {
BFD_PEER_NODE,
"%s(config-bfd-peer)# ",
.node = BFD_PEER_NODE,
.prompt = "%s(config-bfd-peer)# ",
};
#endif /* HAVE_BFDD */

View file

@ -471,8 +471,11 @@ DEFPY (debug_zebra_nexthop,
}
/* Debug node. */
struct cmd_node debug_node = {DEBUG_NODE, "", /* Debug node has no interface. */
1};
struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
.vtysh = 1,
};
static int config_write_debug(struct vty *vty)
{

View file

@ -1664,7 +1664,11 @@ static void interface_update_stats(void)
#endif /* HAVE_NET_RT_IFLIST */
}
struct cmd_node interface_node = {INTERFACE_NODE, "%s(config-if)# ", 1};
struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
.vtysh = 1,
};
#ifndef VTYSH_EXTRACT_PL
#include "zebra/interface_clippy.c"
@ -2074,7 +2078,9 @@ DEFUN (no_bandwidth_if,
struct cmd_node link_params_node = {
LINK_PARAMS_NODE, "%s(config-link-params)# ", 1,
.node = LINK_PARAMS_NODE,
.prompt = "%s(config-link-params)# ",
.vtysh = 1,
};
static void link_param_cmd_set_uint32(struct interface *ifp, uint32_t *field,

View file

@ -1939,7 +1939,11 @@ static int fpm_remote_srv_write(struct vty *vty)
/* Zebra node */
static struct cmd_node zebra_node = {ZEBRA_NODE, "", 1};
static struct cmd_node zebra_node = {
.node = ZEBRA_NODE,
.prompt = "",
.vtysh = 1,
};
/**

View file

@ -450,7 +450,11 @@ DEFUN (no_mpls_label_global_block,
}
/* MPLS node for MPLS LSP. */
static struct cmd_node mpls_node = {MPLS_NODE, "", 1};
static struct cmd_node mpls_node = {
.node = MPLS_NODE,
.prompt = "",
.vtysh = 1,
};
/* MPLS VTY. */
void zebra_mpls_vty_init(void)

View file

@ -548,7 +548,9 @@ static int zebra_pw_config(struct vty *vty)
}
static struct cmd_node pw_node = {
PW_NODE, "%s(config-pw)# ", 1,
.node = PW_NODE,
.prompt = "%s(config-pw)# ",
.vtysh = 1,
};
void zebra_pw_vty_init(void)

View file

@ -3478,15 +3478,27 @@ DEFUN_HIDDEN (show_frr,
}
/* IP node for static routes. */
static struct cmd_node ip_node = {IP_NODE, "", 1};
static struct cmd_node protocol_node = {PROTOCOL_NODE, "", 1};
static struct cmd_node ip_node = {
.node = IP_NODE,
.prompt = "",
.vtysh = 1,
};
static struct cmd_node protocol_node = {
.node = PROTOCOL_NODE,
.prompt = "",
.vtysh = 1,
};
/* table node for routing tables. */
static struct cmd_node table_node = {TABLE_NODE,
"", /* This node has no interface. */
1};
static struct cmd_node forwarding_node = {FORWARDING_NODE,
"", /* This node has no interface. */
1};
static struct cmd_node table_node = {
.node = TABLE_NODE,
.prompt = "",
.vtysh = 1,
};
static struct cmd_node forwarding_node = {
.node = FORWARDING_NODE,
.prompt = "",
.vtysh = 1,
};
/* Route VTY. */
void zebra_vty_init(void)