There is really no reason to not put this in the cmd_node.
And while we're add it, rename from pointless ".func" to ".config_write".
[v2: fix forgotten ldpd config_write]
Signed-off-by: David Lamparter <equinox@diac24.net>
static vector babel_enable_if; /* enable interfaces (by cmd). */
+static int interface_config_write(struct vty *vty);
static struct cmd_node babel_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = interface_config_write,
};
babel_enable_if = vector_init (1);
/* install interface node and commands */
- install_node (&babel_interface_node, interface_config_write);
+ install_node(&babel_interface_node);
if_cmd_init();
install_element(BABEL_NODE, &babel_network_cmd);
static time_t source_expiry_time;
/* Babel node structure. */
+static int babel_config_write (struct vty *vty);
static struct cmd_node cmd_babel_node =
{
.node = BABEL_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = babel_config_write,
};
/* print current babel configuration on vty */
babeld_quagga_init(void)
{
- install_node(&cmd_babel_node, &babel_config_write);
+ install_node(&cmd_babel_node);
install_element(CONFIG_NODE, &router_babel_cmd);
install_element(CONFIG_NODE, &no_router_babel_cmd);
return CMD_SUCCESS;
}
+static int bfdd_write_config(struct vty *vty);
struct cmd_node bfd_node = {
.node = BFD_NODE,
.prompt = "%s(config-bfd)# ",
+ .config_write = bfdd_write_config,
};
struct cmd_node bfd_peer_node = {
install_element(CONFIG_NODE, &bfd_debug_network_cmd);
/* Install BFD node and commands. */
- install_node(&bfd_node, bfdd_write_config);
+ install_node(&bfd_node);
install_default(BFD_NODE);
/* Install BFD peer node. */
- install_node(&bfd_peer_node, NULL);
+ install_node(&bfd_peer_node);
install_default(BFD_PEER_NODE);
bfdd_cli_init();
static int bgp_bmp_init(struct thread_master *tm)
{
- install_node(&bmp_node, NULL);
+ install_node(&bmp_node);
install_default(BMP_NODE);
install_element(BGP_NODE, &bmp_targets_cmd);
install_element(BGP_NODE, &no_bmp_targets_cmd);
return write;
}
+static int bgp_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = bgp_config_write_debug,
};
void bgp_debug_init(void)
{
- install_node(&debug_node, bgp_config_write_debug);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &show_debugging_bgp_cmd);
return bgp_dump_unset(bgp_dump_struct);
}
+static int config_write_bgp_dump(struct vty *vty);
/* BGP node structure. */
static struct cmd_node bgp_dump_node = {
.node = DUMP_NODE,
.prompt = "",
+ .config_write = config_write_bgp_dump,
};
#if 0
stream_new((BGP_MAX_PACKET_SIZE << 1) + BGP_DUMP_MSG_HEADER
+ BGP_DUMP_HEADER_SIZE);
- install_node(&bgp_dump_node, config_write_bgp_dump);
+ install_node(&bgp_dump_node);
install_element(CONFIG_NODE, &dump_bgp_all_cmd);
install_element(CONFIG_NODE, &no_dump_bgp_all_cmd);
return write;
}
+static int config_write_as_list(struct vty *vty);
static struct cmd_node as_list_node = {
.node = AS_LIST_NODE,
.prompt = "",
+ .config_write = config_write_as_list,
};
/* Register functions. */
void bgp_filter_init(void)
{
- install_node(&as_list_node, config_write_as_list);
+ install_node(&as_list_node);
install_element(CONFIG_NODE, &bgp_as_path_cmd);
install_element(CONFIG_NODE, &no_bgp_as_path_cmd);
static struct cmd_node rpki_node = {
.node = RPKI_NODE,
.prompt = "%s(config-rpki)# ",
+ .config_write = config_write,
};
static const struct route_map_rule_cmd route_match_rpki_cmd = {
"rpki", route_match, route_match_compile, route_match_free};
static void install_cli_commands(void)
{
// TODO: make config write work
- install_node(&rpki_node, &config_write);
+ install_node(&rpki_node);
install_default(RPKI_NODE);
overwrite_exit_commands();
install_element(CONFIG_NODE, &rpki_cmd);
static struct cmd_node bgp_node = {
.node = BGP_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = bgp_config_write,
};
static struct cmd_node bgp_ipv4_unicast_node = {
cmd_variable_handler_register(bgp_var_peergroup);
/* Install bgp top node. */
- install_node(&bgp_node, bgp_config_write);
- install_node(&bgp_ipv4_unicast_node, NULL);
- install_node(&bgp_ipv4_multicast_node, NULL);
- install_node(&bgp_ipv4_labeled_unicast_node, NULL);
- install_node(&bgp_ipv6_unicast_node, NULL);
- install_node(&bgp_ipv6_multicast_node, NULL);
- install_node(&bgp_ipv6_labeled_unicast_node, NULL);
- install_node(&bgp_vpnv4_node, NULL);
- install_node(&bgp_vpnv6_node, NULL);
- install_node(&bgp_evpn_node, NULL);
- install_node(&bgp_evpn_vni_node, NULL);
- install_node(&bgp_flowspecv4_node, NULL);
- install_node(&bgp_flowspecv6_node, NULL);
+ install_node(&bgp_node);
+ install_node(&bgp_ipv4_unicast_node);
+ install_node(&bgp_ipv4_multicast_node);
+ install_node(&bgp_ipv4_labeled_unicast_node);
+ install_node(&bgp_ipv6_unicast_node);
+ install_node(&bgp_ipv6_multicast_node);
+ install_node(&bgp_ipv6_labeled_unicast_node);
+ install_node(&bgp_vpnv4_node);
+ install_node(&bgp_vpnv6_node);
+ install_node(&bgp_evpn_node);
+ install_node(&bgp_evpn_vni_node);
+ install_node(&bgp_flowspecv4_node);
+ install_node(&bgp_flowspecv6_node);
/* Install default VTY commands to new nodes. */
install_default(BGP_NODE);
return write;
}
+static int community_list_config_write(struct vty *vty);
static struct cmd_node community_list_node = {
.node = COMMUNITY_LIST_NODE,
.prompt = "",
+ .config_write = community_list_config_write,
};
static void community_list_vty(void)
{
- install_node(&community_list_node, community_list_config_write);
+ install_node(&community_list_node);
/* Community-list. */
install_element(CONFIG_NODE, &bgp_community_list_standard_cmd);
void bgp_rfapi_cfg_init(void)
{
- install_node(&bgp_vnc_defaults_node, NULL);
- install_node(&bgp_vnc_nve_group_node, NULL);
- install_node(&bgp_vrf_policy_node, NULL);
- install_node(&bgp_vnc_l2_group_node, NULL);
+ install_node(&bgp_vnc_defaults_node);
+ install_node(&bgp_vnc_nve_group_node);
+ install_node(&bgp_vrf_policy_node);
+ install_node(&bgp_vnc_l2_group_node);
install_default(BGP_VRF_POLICY_NODE);
install_default(BGP_VNC_DEFAULTS_NODE);
install_default(BGP_VNC_NVE_GROUP_NODE);
return write;
}
+static int bgp_vnc_config_write_debug(struct vty *vty);
static struct cmd_node debug_node = {
.node = DEBUG_VNC_NODE,
.prompt = "",
+ .config_write = bgp_vnc_config_write_debug,
};
void vnc_debug_init(void)
{
- install_node(&debug_node, bgp_vnc_config_write_debug);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &show_debugging_bgp_vnc_cmd);
install_element(ENABLE_NODE, &debug_bgp_vnc_cmd);
/*
* CLI installation procedures.
*/
+static int eigrp_config_write(struct vty *vty);
static struct cmd_node eigrp_node = {
.node = EIGRP_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = eigrp_config_write,
};
static int eigrp_config_write(struct vty *vty)
return written;
}
+static int eigrp_write_interface(struct vty *vty);
static struct cmd_node eigrp_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = eigrp_write_interface,
};
install_element(CONFIG_NODE, &router_eigrp_cmd);
install_element(CONFIG_NODE, &no_router_eigrp_cmd);
- install_node(&eigrp_node, eigrp_config_write);
+ install_node(&eigrp_node);
install_default(EIGRP_NODE);
install_element(EIGRP_NODE, &eigrp_router_id_cmd);
install_element(EIGRP_NODE, &eigrp_neighbor_cmd);
install_element(EIGRP_NODE, &eigrp_redistribute_source_metric_cmd);
- install_node(&eigrp_interface_node, eigrp_write_interface);
+ install_node(&eigrp_interface_node);
if_cmd_init();
install_element(INTERFACE_NODE, &eigrp_if_delay_cmd);
}
/* Debug node. */
+static int config_write_debug(struct vty *vty);
static struct cmd_node eigrp_debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_debug,
};
/* Initialize debug commands. */
void eigrp_debug_init(void)
{
- install_node(&eigrp_debug_node, config_write_debug);
+ install_node(&eigrp_debug_node);
install_element(ENABLE_NODE, &show_debugging_eigrp_cmd);
install_element(ENABLE_NODE, &debug_eigrp_packets_all_cmd);
/*
* Prototypes.
*/
-int isis_interface_config_write(struct vty *);
int isis_if_new_hook(struct interface *);
int isis_if_delete_hook(struct interface *);
(circuit, vty))
#ifdef FABRICD
-int isis_interface_config_write(struct vty *vty)
+static int isis_interface_config_write(struct vty *vty)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
int write = 0;
return write;
}
#else
-int isis_interface_config_write(struct vty *vty)
+static int isis_interface_config_write(struct vty *vty)
{
struct vrf *vrf = vrf_lookup_by_id(VRF_DEFAULT);
int write = 0;
struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = isis_interface_config_write,
};
void isis_circuit_circ_type_set(struct isis_circuit *circuit, int circ_type)
hook_register_prio(if_del, 0, isis_if_delete_hook);
/* Install interface node */
- install_node(&interface_node, isis_interface_config_write);
+ install_node(&interface_node);
if_cmd_init();
if_zapi_callbacks(isis_ifp_create, isis_ifp_up,
isis_ifp_down, isis_ifp_destroy);
int show_isis_interface_common(struct vty *, const char *ifname, char);
int show_isis_neighbor_common(struct vty *, const char *id, char);
int clear_isis_neighbor_common(struct vty *, const char *id);
-int isis_config_write(struct vty *);
void isis_new(unsigned long process_id, vrf_id_t vrf_id)
return CMD_SUCCESS;
}
+static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_debug,
};
static int config_write_debug(struct vty *vty)
#endif /* ifdef FABRICD */
#ifdef FABRICD
/* IS-IS configuration write function */
-int isis_config_write(struct vty *vty)
+static int isis_config_write(struct vty *vty)
{
int write = 0;
#else
/* IS-IS configuration write function */
-int isis_config_write(struct vty *vty)
+static int isis_config_write(struct vty *vty)
{
int write = 0;
struct lyd_node *dnode;
struct cmd_node router_node = {
.node = ROUTER_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = isis_config_write,
};
void isis_init(void)
{
/* Install IS-IS top node */
- install_node(&router_node, isis_config_write);
+ install_node(&router_node);
install_element(VIEW_NODE, &show_isis_summary_cmd);
install_element(ENABLE_NODE, &show_debugging_isis_cmd);
- install_node(&debug_node, config_write_debug);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &debug_isis_adj_cmd);
install_element(ENABLE_NODE, &no_debug_isis_adj_cmd);
struct ldp_debug conf_ldp_debug;
struct ldp_debug ldp_debug;
+static int ldp_debug_config_write(struct vty *);
+
/* Debug node. */
struct cmd_node ldp_debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = ldp_debug_config_write,
};
int
return (CMD_SUCCESS);
}
-int
+static int
ldp_debug_config_write(struct vty *vty)
{
int write = 0;
union ldpd_addr;
int ldp_get_address(const char *, int *, union ldpd_addr *);
-int ldp_config_write(struct vty *);
-int ldp_l2vpn_config_write(struct vty *);
-int ldp_debug_config_write(struct vty *);
int ldp_vty_mpls_ldp (struct vty *, const char *);
int ldp_vty_address_family (struct vty *, const char *, const char *);
int ldp_vty_disc_holdtime(struct vty *, const char *, enum hello_type, long);
{
cmd_variable_handler_register(l2vpn_var_handlers);
- install_node(&ldp_node, ldp_config_write);
- install_node(&ldp_ipv4_node, NULL);
- install_node(&ldp_ipv6_node, NULL);
- install_node(&ldp_ipv4_iface_node, NULL);
- install_node(&ldp_ipv6_iface_node, NULL);
- install_node(&ldp_l2vpn_node, ldp_l2vpn_config_write);
- install_node(&ldp_pseudowire_node, NULL);
- install_node(&ldp_debug_node, ldp_debug_config_write);
+ install_node(&ldp_node);
+ install_node(&ldp_ipv4_node);
+ install_node(&ldp_ipv6_node);
+ install_node(&ldp_ipv4_iface_node);
+ install_node(&ldp_ipv6_iface_node);
+ install_node(&ldp_l2vpn_node);
+ install_node(&ldp_pseudowire_node);
+ install_node(&ldp_debug_node);
install_default(LDP_NODE);
install_default(LDP_IPV4_NODE);
install_default(LDP_IPV6_NODE);
#include "vty.h"
#include "ldp_vty.h"
+static int ldp_config_write(struct vty *);
static void ldp_af_iface_config_write(struct vty *, int);
static void ldp_af_config_write(struct vty *, int, struct ldpd_conf *,
struct ldpd_af_conf *);
+static int ldp_l2vpn_config_write(struct vty *);
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 = {
.node = LDP_NODE,
.prompt = "%s(config-ldp)# ",
+ .config_write = ldp_config_write,
};
struct cmd_node ldp_ipv4_node = {
struct cmd_node ldp_l2vpn_node = {
.node = LDP_L2VPN_NODE,
.prompt = "%s(config-l2vpn)# ",
+ .config_write = ldp_l2vpn_config_write,
};
struct cmd_node ldp_pseudowire_node = {
vty_out(vty, " exit-address-family\n");
}
-int
+static int
ldp_config_write(struct vty *vty)
{
struct nbr_params *nbrp;
vty_out (vty," ! Incomplete config, specify a pw-id\n");
}
-int
+static int
ldp_l2vpn_config_write(struct vty *vty)
{
struct l2vpn *l2vpn;
}
/* AgentX node. */
+static int config_write_agentx(struct vty *vty);
static struct cmd_node agentx_node = {
.node = SMUX_NODE,
.prompt = "",
+ .config_write = config_write_agentx,
};
/* Logging NetSNMP messages */
agentx_log_callback, NULL);
init_agent(FRR_SMUX_NAME);
- install_node(&agentx_node, config_write_agentx);
+ install_node(&agentx_node);
install_element(CONFIG_NODE, &agentx_enable_cmd);
install_element(CONFIG_NODE, &no_agentx_cmd);
}
.prompt = "%s# ",
};
+static int config_write_host(struct vty *vty);
static struct cmd_node config_node = {
.node = CONFIG_NODE,
.prompt = "%s(config)# ",
+ .config_write = config_write_host,
};
static const struct facility_map {
}
/* Install top node of command vector. */
-void install_node(struct cmd_node *node, int (*func)(struct vty *))
+void install_node(struct cmd_node *node)
{
vector_set_index(cmdvec, node->node, node);
- node->func = func;
node->cmdgraph = graph_new();
node->cmd_vector = vector_init(VECTOR_MIN_SIZE);
// add start node
vty_out(vty, "!\n");
for (i = 0; i < vector_active(cmdvec); i++)
- if ((node = vector_slot(cmdvec, i)) && node->func) {
- if ((*node->func)(vty))
+ if ((node = vector_slot(cmdvec, i)) && node->config_write) {
+ if ((*node->config_write)(vty))
vty_out(vty, "!\n");
}
host.motdfile = NULL;
/* Install top nodes. */
- install_node(&view_node, NULL);
- install_node(&enable_node, NULL);
- install_node(&auth_node, NULL);
- install_node(&auth_enable_node, NULL);
- install_node(&config_node, config_write_host);
+ install_node(&view_node);
+ install_node(&enable_node);
+ install_node(&auth_node);
+ install_node(&auth_enable_node);
+ install_node(&config_node);
/* Each node's basic commands. */
install_element(VIEW_NODE, &show_version_cmd);
const char *prompt;
/* Node's configuration write function */
- int (*func)(struct vty *);
+ int (*config_write)(struct vty *);
/* Node's command graph */
struct graph *cmdgraph;
#define NO_GR_NEIGHBOR_HELPER_CMD "Undo Graceful Restart Helper command for a neighbor\n"
/* Prototypes. */
-extern void install_node(struct cmd_node *node, int (*)(struct vty *));
+extern void install_node(struct cmd_node *node);
extern void install_default(enum node_type);
extern void install_element(enum node_type, const struct cmd_element *);
return write;
}
+static int config_write_access_mac(struct vty *vty);
static struct cmd_node access_mac_node = {
.node = ACCESS_MAC_NODE,
.prompt = "",
+ .config_write = config_write_access_mac,
};
static int config_write_access_mac(struct vty *vty)
/* Install vty related command. */
static void access_list_init_mac(void)
{
- install_node(&access_mac_node, config_write_access_mac);
+ install_node(&access_mac_node);
install_element(ENABLE_NODE, &show_mac_access_list_cmd);
install_element(ENABLE_NODE, &show_mac_access_list_name_cmd);
}
/* Access-list node. */
+static int config_write_access_ipv4(struct vty *vty);
static struct cmd_node access_node = {
.node = ACCESS_NODE,
.prompt = "",
+ .config_write = config_write_access_ipv4,
};
static int config_write_access_ipv4(struct vty *vty)
/* Install vty related command. */
static void access_list_init_ipv4(void)
{
- install_node(&access_node, config_write_access_ipv4);
+ install_node(&access_node);
install_element(ENABLE_NODE, &show_ip_access_list_cmd);
install_element(ENABLE_NODE, &show_ip_access_list_name_cmd);
install_element(CONFIG_NODE, &no_access_list_remark_comment_cmd);
}
+static int config_write_access_ipv6(struct vty *vty);
static struct cmd_node access_ipv6_node = {
.node = ACCESS_IPV6_NODE,
.prompt = "",
+ .config_write = config_write_access_ipv6,
};
static int config_write_access_ipv6(struct vty *vty)
static void access_list_init_ipv6(void)
{
- install_node(&access_ipv6_node, config_write_access_ipv6);
+ install_node(&access_ipv6_node);
install_element(ENABLE_NODE, &show_ipv6_access_list_cmd);
install_element(ENABLE_NODE, &show_ipv6_access_list_name_cmd);
return CMD_SUCCESS;
}
+static int keychain_config_write(struct vty *vty);
static struct cmd_node keychain_node = {
.node = KEYCHAIN_NODE,
.prompt = "%s(config-keychain)# ",
+ .config_write = keychain_config_write,
};
static struct cmd_node keychain_key_node = {
{
keychain_list = list_new();
- install_node(&keychain_node, keychain_config_write);
- install_node(&keychain_key_node, NULL);
+ install_node(&keychain_node);
+ install_node(&keychain_key_node);
install_default(KEYCHAIN_NODE);
install_default(KEYCHAIN_KEY_NODE);
return CMD_SUCCESS;
}
+static int nexthop_group_write(struct vty *vty);
static struct cmd_node nexthop_group_node = {
.node = NH_GROUP_NODE,
.prompt = "%s(config-nh-group)# ",
+ .config_write = nexthop_group_write,
};
void nexthop_group_write_nexthop(struct vty *vty, struct nexthop *nh)
cmd_variable_handler_register(nhg_name_handlers);
- install_node(&nexthop_group_node, nexthop_group_write);
+ install_node(&nexthop_group_node);
install_element(CONFIG_NODE, &nexthop_group_cmd);
install_element(CONFIG_NODE, &no_nexthop_group_cmd);
static struct cmd_node nb_debug_node = {
.node = NORTHBOUND_DEBUG_NODE,
.prompt = "",
+ .config_write = nb_debug_config_write,
};
void nb_cli_install_default(int node)
debug_init(&nb_dbg_cbs);
- install_node(&nb_debug_node, nb_debug_config_write);
+ install_node(&nb_debug_node);
install_element(ENABLE_NODE, &debug_nb_cmd);
install_element(CONFIG_NODE, &debug_nb_cmd);
}
+static int config_write_prefix_ipv4(struct vty *vty);
/* Prefix-list node. */
static struct cmd_node prefix_node = {
.node = PREFIX_NODE,
.prompt = "",
+ .config_write = config_write_prefix_ipv4,
};
static int config_write_prefix_ipv4(struct vty *vty)
static void prefix_list_init_ipv4(void)
{
- install_node(&prefix_node, config_write_prefix_ipv4);
+ install_node(&prefix_node);
install_element(CONFIG_NODE, &ip_prefix_list_cmd);
install_element(CONFIG_NODE, &no_ip_prefix_list_cmd);
install_element(ENABLE_NODE, &clear_ip_prefix_list_cmd);
}
+static int config_write_prefix_ipv6(struct vty *vty);
/* Prefix-list node. */
static struct cmd_node prefix_ipv6_node = {
.node = PREFIX_IPV6_NODE,
.prompt = "",
+ .config_write = config_write_prefix_ipv6,
};
static int config_write_prefix_ipv6(struct vty *vty)
static void prefix_list_init_ipv6(void)
{
- install_node(&prefix_ipv6_node, config_write_prefix_ipv6);
+ install_node(&prefix_ipv6_node);
install_element(CONFIG_NODE, &ipv6_prefix_list_cmd);
install_element(CONFIG_NODE, &no_ipv6_prefix_list_cmd);
return CMD_SUCCESS;
}
+static int resolver_config_write_debug(struct vty *vty);
static struct cmd_node resolver_debug_node = {
.node = RESOLVER_DEBUG_NODE,
.prompt = "",
+ .config_write = resolver_config_write_debug,
};
static int resolver_config_write_debug(struct vty *vty)
ARES_OPT_SOCK_STATE_CB | ARES_OPT_TIMEOUT
| ARES_OPT_TRIES);
- install_node(&resolver_debug_node, resolver_config_write_debug);
+ install_node(&resolver_debug_node);
install_element(CONFIG_NODE, &debug_resolver_cmd);
install_element(ENABLE_NODE, &debug_resolver_cmd);
}
}
/* Debug node. */
+static int rmap_config_write_debug(struct vty *vty);
static struct cmd_node rmap_debug_node = {
.node = RMAP_DEBUG_NODE,
.prompt = "",
+ .config_write = rmap_config_write_debug,
};
/* Configuration write function. */
route_map_cli_init();
/* Install route map top node. */
- install_node(&rmap_debug_node, rmap_config_write_debug);
+ install_node(&rmap_debug_node);
/* Install route map commands. */
install_element(CONFIG_NODE, &debug_rmap_cmd);
}
/* Route map node structure. */
+static int route_map_config_write(struct vty *vty);
static struct cmd_node rmap_node = {
.node = RMAP_NODE,
.prompt = "%s(config-route-map)# ",
+ .config_write = route_map_config_write,
};
static void rmap_autocomplete(vector comps, struct cmd_token *token)
cmd_variable_handler_register(rmap_var_handlers);
/* CLI commands. */
- install_node(&rmap_node, route_map_config_write);
+ install_node(&rmap_node);
install_default(RMAP_NODE);
install_element(CONFIG_NODE, &route_map_cmd);
install_element(CONFIG_NODE, &no_route_map_cmd);
return 1;
}
+static int vrf_write_host(struct vty *vty);
static struct cmd_node vrf_debug_node = {
.node = VRF_DEBUG_NODE,
.prompt = "",
+ .config_write = vrf_write_host,
};
void vrf_install_commands(void)
{
- install_node(&vrf_debug_node, vrf_write_host);
+ install_node(&vrf_debug_node);
install_element(CONFIG_NODE, &vrf_debug_cmd);
install_element(ENABLE_NODE, &vrf_debug_cmd);
{
install_element(CONFIG_NODE, &vrf_cmd);
install_element(CONFIG_NODE, &no_vrf_cmd);
- install_node(&vrf_node, writefunc);
+ vrf_node.config_write = writefunc;
+ install_node(&vrf_node);
install_default(VRF_NODE);
install_element(VRF_NODE, &vrf_exit_cmd);
if (vrf_is_backend_netns() && ns_have_netns()) {
return CMD_SUCCESS;
}
+static int vty_config_write(struct vty *vty);
struct cmd_node vty_node = {
.node = VTY_NODE,
.prompt = "%s(config-line)# ",
+ .config_write = vty_config_write,
};
/* Reset all VTY status. */
Vvty_serv_thread = vector_init(VECTOR_MIN_SIZE);
/* Install bgp top node. */
- install_node(&vty_node, vty_config_write);
+ install_node(&vty_node);
install_element(VIEW_NODE, &config_who_cmd);
install_element(VIEW_NODE, &show_history_cmd);
#include "nhrpd.h"
#include "netlink.h"
+static int nhrp_config_write(struct vty *vty);
static struct cmd_node zebra_node = {
.node = ZEBRA_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = nhrp_config_write,
};
+static int interface_config_write(struct vty *vty);
static struct cmd_node nhrp_interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = interface_config_write,
};
#define NHRP_DEBUG_FLAGS_CMD "<all|common|event|interface|kernel|route|vici>"
void nhrp_config_init(void)
{
- install_node(&zebra_node, nhrp_config_write);
+ install_node(&zebra_node);
install_default(ZEBRA_NODE);
/* access-list commands */
install_element(CONFIG_NODE, &no_nhrp_nflog_group_cmd);
/* interface specific commands */
- install_node(&nhrp_interface_node, interface_config_write);
+ install_node(&nhrp_interface_node);
if_cmd_init();
install_element(INTERFACE_NODE, &tunnel_protection_cmd);
return 0;
}
+static int config_write_ospf6_interface(struct vty *vty);
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = config_write_ospf6_interface,
};
static int ospf6_ifp_create(struct interface *ifp)
void ospf6_interface_init(void)
{
/* Install interface node. */
- install_node(&interface_node, config_write_ospf6_interface);
+ install_node(&interface_node);
if_cmd_init();
if_zapi_callbacks(ospf6_ifp_create, ospf6_ifp_up,
ospf6_ifp_down, ospf6_ifp_destroy);
return 0;
}
+static int config_write_ospf6(struct vty *vty);
/* OSPF6 node structure. */
static struct cmd_node ospf6_node = {
.node = OSPF6_NODE,
.prompt = "%s(config-ospf6)# ",
+ .config_write = config_write_ospf6,
};
/* Install ospf related commands. */
void ospf6_top_init(void)
{
/* Install ospf6 top node. */
- install_node(&ospf6_node, config_write_ospf6);
+ install_node(&ospf6_node);
install_element(VIEW_NODE, &show_ipv6_ospf6_cmd);
install_element(CONFIG_NODE, &router_ospf6_cmd);
return prev;
}
+static int config_write_ospf6_debug(struct vty *vty);
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_ospf6_debug,
};
static int config_write_ospf6_debug(struct vty *vty)
prefix_list_delete_hook(ospf6_plist_del);
ospf6_bfd_init();
- install_node(&debug_node, config_write_ospf6_debug);
+ install_node(&debug_node);
install_element_ospf6_debug_message();
install_element_ospf6_debug_lsa();
return show_debugging_ospf_common(vty, ospf);
}
+static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_debug,
};
static int config_write_debug(struct vty *vty)
/* Initialize debug commands. */
void ospf_debug_init(void)
{
- install_node(&debug_node, config_write_debug);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &show_debugging_ospf_cmd);
install_element(ENABLE_NODE, &debug_ospf_ism_cmd);
}
+static int config_write_interface(struct vty *vty);
/* ospfd's interface node. */
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = config_write_interface,
};
/* Initialization of OSPF interface. */
static void ospf_vty_if_init(void)
{
/* Install interface node. */
- install_node(&interface_node, config_write_interface);
+ install_node(&interface_node);
if_cmd_init();
/* "ip ospf authentication" commands. */
#endif /* 0 */
}
+static int ospf_config_write(struct vty *vty);
static struct cmd_node ospf_node = {
.node = OSPF_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = ospf_config_write,
};
static void ospf_interface_clear(struct interface *ifp)
void ospf_vty_init(void)
{
/* Install ospf top node. */
- install_node(&ospf_node, ospf_config_write);
+ install_node(&ospf_node);
/* "router ospf" commands. */
install_element(CONFIG_NODE, &router_ospf_cmd);
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = pbr_debug_config_write,
};
DEFPY(debug_pbr,
/* ------------------------------------------------------------------------- */
+static int pbr_interface_config_write(struct vty *vty);
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = pbr_interface_config_write,
};
static int pbr_interface_config_write(struct vty *vty)
return 1;
}
+static int pbr_vty_map_config_write(struct vty *vty);
/* PBR map node structure. */
static struct cmd_node pbr_map_node = {
.node = PBRMAP_NODE,
.prompt = "%s(config-pbr-map)# ",
+ .config_write = pbr_vty_map_config_write,
};
static int pbr_vty_map_config_write_sequence(struct vty *vty,
{
cmd_variable_handler_register(pbr_map_name);
- install_node(&interface_node,
- pbr_interface_config_write);
+ install_node(&interface_node);
if_cmd_init();
- install_node(&pbr_map_node,
- pbr_vty_map_config_write);
+ install_node(&pbr_map_node);
/* debug */
- install_node(&debug_node, pbr_debug_config_write);
+ install_node(&debug_node);
install_element(VIEW_NODE, &debug_pbr_cmd);
install_element(CONFIG_NODE, &debug_pbr_cmd);
install_element(VIEW_NODE, &show_debugging_pbr_cmd);
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = pim_interface_config_write,
};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = pim_debug_config_write,
};
static struct vrf *pim_cmd_lookup_vrf(struct vty *vty, struct cmd_token *argv[],
void pim_cmd_init(void)
{
- install_node(&interface_node,
- pim_interface_config_write); /* INTERFACE_NODE */
+ install_node(&interface_node); /* INTERFACE_NODE */
if_cmd_init();
- install_node(&debug_node, pim_debug_config_write);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &pim_test_sg_keepalive_cmd);
return CMD_SUCCESS;
}
+static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_debug,
};
static int config_write_debug(struct vty *vty)
rip_debug_packet = 0;
rip_debug_zebra = 0;
- install_node(&debug_node, config_write_debug);
+ install_node(&debug_node);
install_element(ENABLE_NODE, &show_debugging_rip_cmd);
install_element(ENABLE_NODE, &debug_rip_events_cmd);
return 0;
}
+static int rip_interface_config_write(struct vty *vty);
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = rip_interface_config_write,
};
void rip_interface_sync(struct interface *ifp)
hook_register_prio(if_del, 0, rip_interface_delete_hook);
/* Install interface node. */
- install_node(&interface_node, rip_interface_config_write);
+ install_node(&interface_node);
if_cmd_init();
if_zapi_callbacks(rip_ifp_create, rip_ifp_up,
rip_ifp_down, rip_ifp_destroy);
return write;
}
+static int config_write_rip(struct vty *vty);
/* RIP node structure. */
static struct cmd_node rip_node = {
.node = RIP_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = config_write_rip,
};
/* Distribute-list update functions. */
void rip_init(void)
{
/* Install top nodes. */
- install_node(&rip_node, config_write_rip);
+ install_node(&rip_node);
/* Install rip commands. */
install_element(VIEW_NODE, &show_ip_rip_cmd);
return CMD_SUCCESS;
}
+static int config_write_debug(struct vty *vty);
/* Debug node. */
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_debug,
};
static int config_write_debug(struct vty *vty)
ripng_debug_packet = 0;
ripng_debug_zebra = 0;
- install_node(&debug_node, config_write_debug);
+ install_node(&debug_node);
install_element(VIEW_NODE, &show_debugging_ripng_cmd);
return write;
}
+static int interface_config_write(struct vty *vty);
/* ripngd's interface node. */
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = interface_config_write,
};
/* Initialization of interface. */
hook_register_prio(if_del, 0, ripng_if_delete_hook);
/* Install interface node. */
- install_node(&interface_node, interface_config_write);
+ install_node(&interface_node);
if_cmd_init();
if_zapi_callbacks(ripng_ifp_create, ripng_ifp_up,
ripng_ifp_down, ripng_ifp_destroy);
return write;
}
+static int ripng_config_write(struct vty *vty);
/* RIPng node structure. */
static struct cmd_node cmd_ripng_node = {
.node = RIPNG_NODE,
.prompt = "%s(config-router)# ",
+ .config_write = ripng_config_write,
};
static void ripng_distribute_update(struct distribute_ctx *ctx,
void ripng_init(void)
{
/* Install RIPNG_NODE. */
- install_node(&cmd_ripng_node, ripng_config_write);
+ install_node(&cmd_ripng_node);
/* Install ripng commands. */
install_element(VIEW_NODE, &show_ipv6_ripng_cmd);
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = static_config_write_debug,
};
void static_vty_init(void)
{
- install_node(&debug_node, static_config_write_debug);
+ install_node(&debug_node);
install_element(CONFIG_NODE, &ip_mroute_dist_cmd);
yang_init(true);
nb_init(master, NULL, 0);
- install_node(&bgp_node, NULL);
- install_node(&rip_node, NULL);
- install_node(&interface_node, NULL);
- install_node(&rmap_node, NULL);
- install_node(&zebra_node, NULL);
- install_node(&bgp_vpnv4_node, NULL);
- install_node(&bgp_ipv4_node, NULL);
- install_node(&bgp_ipv4m_node, NULL);
- install_node(&bgp_ipv6_node, NULL);
- install_node(&bgp_ipv6m_node, NULL);
- install_node(&ospf_node, NULL);
- install_node(&ripng_node, NULL);
- install_node(&ospf6_node, NULL);
- install_node(&keychain_node, NULL);
- install_node(&keychain_key_node, NULL);
- install_node(&isis_node, NULL);
- install_node(&vty_node, NULL);
+ install_node(&bgp_node);
+ install_node(&rip_node);
+ install_node(&interface_node);
+ install_node(&rmap_node);
+ install_node(&zebra_node);
+ install_node(&bgp_vpnv4_node);
+ install_node(&bgp_ipv4_node);
+ install_node(&bgp_ipv4m_node);
+ install_node(&bgp_ipv6_node);
+ install_node(&bgp_ipv6m_node);
+ install_node(&ospf_node);
+ install_node(&ripng_node);
+ install_node(&ospf6_node);
+ install_node(&keychain_node);
+ install_node(&keychain_key_node);
+ install_node(&isis_node);
+ install_node(&vty_node);
test_init_cmd();
static struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = vrrp_config_write_interface,
};
static struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = vrrp_config_write_debug,
};
static struct cmd_node vrrp_node = {
.node = VRRP_NODE,
.prompt = "",
+ .config_write = vrrp_config_write_global,
};
void vrrp_vty_init(void)
{
- install_node(&debug_node, vrrp_config_write_debug);
- install_node(&interface_node, vrrp_config_write_interface);
- install_node(&vrrp_node, vrrp_config_write_global);
+ install_node(&debug_node);
+ install_node(&interface_node);
+ install_node(&vrrp_node);
if_cmd_init();
install_element(VIEW_NODE, &vrrp_vrid_show_cmd);
cmd_variable_handler_register(vtysh_var_handler);
/* Install nodes. */
- install_node(&bgp_node, NULL);
- install_node(&rip_node, NULL);
- install_node(&interface_node, NULL);
- install_node(&pw_node, NULL);
- install_node(&link_params_node, NULL);
- install_node(&vrf_node, NULL);
- install_node(&nh_group_node, NULL);
- install_node(&rmap_node, NULL);
- install_node(&pbr_map_node, NULL);
- install_node(&zebra_node, NULL);
- install_node(&bgp_vpnv4_node, NULL);
- install_node(&bgp_vpnv6_node, NULL);
- install_node(&bgp_flowspecv4_node, NULL);
- install_node(&bgp_flowspecv6_node, NULL);
- install_node(&bgp_ipv4_node, NULL);
- install_node(&bgp_ipv4m_node, NULL);
- install_node(&bgp_ipv4l_node, NULL);
- install_node(&bgp_ipv6_node, NULL);
- install_node(&bgp_ipv6m_node, NULL);
- install_node(&bgp_ipv6l_node, NULL);
- install_node(&bgp_vrf_policy_node, NULL);
- install_node(&bgp_evpn_node, NULL);
- install_node(&bgp_evpn_vni_node, NULL);
- install_node(&bgp_vnc_defaults_node, NULL);
- install_node(&bgp_vnc_nve_group_node, NULL);
- install_node(&bgp_vnc_l2_group_node, NULL);
- install_node(&ospf_node, NULL);
- install_node(&eigrp_node, NULL);
- install_node(&babel_node, NULL);
- install_node(&ripng_node, NULL);
- install_node(&ospf6_node, NULL);
- install_node(&ldp_node, NULL);
- install_node(&ldp_ipv4_node, NULL);
- install_node(&ldp_ipv6_node, NULL);
- install_node(&ldp_ipv4_iface_node, NULL);
- install_node(&ldp_ipv6_iface_node, NULL);
- install_node(&ldp_l2vpn_node, NULL);
- install_node(&ldp_pseudowire_node, NULL);
- install_node(&keychain_node, NULL);
- install_node(&keychain_key_node, NULL);
- install_node(&isis_node, NULL);
- install_node(&openfabric_node, NULL);
- install_node(&vty_node, NULL);
- install_node(&rpki_node, NULL);
- install_node(&bmp_node, NULL);
+ install_node(&bgp_node);
+ install_node(&rip_node);
+ install_node(&interface_node);
+ install_node(&pw_node);
+ install_node(&link_params_node);
+ install_node(&vrf_node);
+ install_node(&nh_group_node);
+ install_node(&rmap_node);
+ install_node(&pbr_map_node);
+ install_node(&zebra_node);
+ install_node(&bgp_vpnv4_node);
+ install_node(&bgp_vpnv6_node);
+ install_node(&bgp_flowspecv4_node);
+ install_node(&bgp_flowspecv6_node);
+ install_node(&bgp_ipv4_node);
+ install_node(&bgp_ipv4m_node);
+ install_node(&bgp_ipv4l_node);
+ install_node(&bgp_ipv6_node);
+ install_node(&bgp_ipv6m_node);
+ install_node(&bgp_ipv6l_node);
+ install_node(&bgp_vrf_policy_node);
+ install_node(&bgp_evpn_node);
+ install_node(&bgp_evpn_vni_node);
+ install_node(&bgp_vnc_defaults_node);
+ install_node(&bgp_vnc_nve_group_node);
+ install_node(&bgp_vnc_l2_group_node);
+ install_node(&ospf_node);
+ install_node(&eigrp_node);
+ install_node(&babel_node);
+ install_node(&ripng_node);
+ install_node(&ospf6_node);
+ install_node(&ldp_node);
+ install_node(&ldp_ipv4_node);
+ install_node(&ldp_ipv6_node);
+ install_node(&ldp_ipv4_iface_node);
+ install_node(&ldp_ipv6_iface_node);
+ install_node(&ldp_l2vpn_node);
+ install_node(&ldp_pseudowire_node);
+ install_node(&keychain_node);
+ install_node(&keychain_key_node);
+ install_node(&isis_node);
+ install_node(&openfabric_node);
+ install_node(&vty_node);
+ install_node(&rpki_node);
+ install_node(&bmp_node);
#if HAVE_BFDD > 0
- install_node(&bfd_node, NULL);
- install_node(&bfd_peer_node, NULL);
+ install_node(&bfd_node);
+ install_node(&bfd_peer_node);
#endif /* HAVE_BFDD */
struct cmd_node *node;
}
/* Debug node. */
+static int config_write_debug(struct vty *vty);
struct cmd_node debug_node = {
.node = DEBUG_NODE,
.prompt = "",
+ .config_write = config_write_debug,
};
static int config_write_debug(struct vty *vty)
zebra_debug_nht = 0;
zebra_debug_nexthop = 0;
- install_node(&debug_node, config_write_debug);
+ install_node(&debug_node);
install_element(VIEW_NODE, &show_debugging_zebra_cmd);
return written;
}
-struct cmd_node fpm_node = {
+static struct cmd_node fpm_node = {
.node = VTY_NODE,
.prompt = "",
+ .config_write = fpm_write_config,
};
/*
if (IS_ZEBRA_DEBUG_DPLANE)
zlog_debug("%s register status: %d", prov_name, rv);
- install_node(&fpm_node, fpm_write_config);
+ install_node(&fpm_node);
install_element(ENABLE_NODE, &fpm_show_counters_cmd);
install_element(ENABLE_NODE, &fpm_show_counters_json_cmd);
install_element(ENABLE_NODE, &fpm_reset_counters_cmd);
#endif /* HAVE_NET_RT_IFLIST */
}
+static int if_config_write(struct vty *vty);
struct cmd_node interface_node = {
.node = INTERFACE_NODE,
.prompt = "%s(config-if)# ",
+ .config_write = if_config_write,
};
#ifndef VTYSH_EXTRACT_PL
hook_register_prio(if_del, 0, if_zebra_delete_hook);
/* Install configuration write function. */
- install_node(&interface_node, if_config_write);
- install_node(&link_params_node, NULL);
+ install_node(&interface_node);
+ install_node(&link_params_node);
if_cmd_init();
/*
* This is *intentionally* setting this to NULL, signaling
}
+static int fpm_remote_srv_write(struct vty *vty);
/* Zebra node */
static struct cmd_node zebra_node = {
.node = ZEBRA_NODE,
.prompt = "",
+ .config_write = fpm_remote_srv_write,
};
zfpm_stats_init(&zfpm_g->last_ivl_stats);
zfpm_stats_init(&zfpm_g->cumulative_stats);
- install_node(&zebra_node, fpm_remote_srv_write);
+ install_node(&zebra_node);
install_element(ENABLE_NODE, &show_zebra_fpm_stats_cmd);
install_element(ENABLE_NODE, &clear_zebra_fpm_stats_cmd);
install_element(CONFIG_NODE, &fpm_remote_ip_cmd);
return zebra_mpls_global_block(vty, 0, NULL, NULL);
}
+static int zebra_mpls_config(struct vty *vty);
/* MPLS node for MPLS LSP. */
static struct cmd_node mpls_node = {
.node = MPLS_NODE,
.prompt = "",
+ .config_write = zebra_mpls_config,
};
/* MPLS VTY. */
{
install_element(VIEW_NODE, &show_mpls_status_cmd);
- install_node(&mpls_node, zebra_mpls_config);
+ install_node(&mpls_node);
install_element(CONFIG_NODE, &mpls_transit_lsp_cmd);
install_element(CONFIG_NODE, &no_mpls_transit_lsp_cmd);
return write;
}
+static int zebra_pw_config(struct vty *vty);
static struct cmd_node pw_node = {
.node = PW_NODE,
.prompt = "%s(config-pw)# ",
+ .config_write = zebra_pw_config,
};
void zebra_pw_vty_init(void)
{
- install_node(&pw_node, zebra_pw_config);
+ install_node(&pw_node);
install_default(PW_NODE);
install_element(CONFIG_NODE, &pseudowire_if_cmd);
}
/* IP node for static routes. */
+static int zebra_ip_config(struct vty *vty);
static struct cmd_node ip_node = {
.node = IP_NODE,
.prompt = "",
+ .config_write = zebra_ip_config,
};
+static int config_write_protocol(struct vty *vty);
static struct cmd_node protocol_node = {
.node = PROTOCOL_NODE,
.prompt = "",
+ .config_write = config_write_protocol,
};
/* table node for routing tables. */
+static int config_write_table(struct vty *vty);
static struct cmd_node table_node = {
.node = TABLE_NODE,
.prompt = "",
+ .config_write = config_write_table,
};
+static int config_write_forwarding(struct vty *vty);
static struct cmd_node forwarding_node = {
.node = FORWARDING_NODE,
.prompt = "",
+ .config_write = config_write_forwarding,
};
/* Route VTY. */
void zebra_vty_init(void)
{
/* Install configuration write function. */
- install_node(&table_node, config_write_table);
- install_node(&forwarding_node, config_write_forwarding);
+ install_node(&table_node);
+ install_node(&forwarding_node);
install_element(VIEW_NODE, &show_ip_forwarding_cmd);
install_element(CONFIG_NODE, &ip_forwarding_cmd);
/* Route-map */
zebra_route_map_init();
- install_node(&ip_node, zebra_ip_config);
- install_node(&protocol_node, config_write_protocol);
+ install_node(&ip_node);
+ install_node(&protocol_node);
install_element(CONFIG_NODE, &allow_external_route_update_cmd);
install_element(CONFIG_NODE, &no_allow_external_route_update_cmd);