]> git.puffer.fish Git - mirror/frr.git/commitdiff
*: remove second parameter on install_node()
authorDavid Lamparter <equinox@opensourcerouting.org>
Sat, 8 Sep 2018 20:31:43 +0000 (22:31 +0200)
committerDavid Lamparter <equinox@diac24.net>
Thu, 16 Apr 2020 10:53:00 +0000 (12:53 +0200)
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>
57 files changed:
babeld/babel_interface.c
babeld/babeld.c
bfdd/bfdd_vty.c
bgpd/bgp_bmp.c
bgpd/bgp_debug.c
bgpd/bgp_dump.c
bgpd/bgp_filter.c
bgpd/bgp_rpki.c
bgpd/bgp_vty.c
bgpd/rfapi/bgp_rfapi_cfg.c
bgpd/rfapi/vnc_debug.c
eigrpd/eigrp_cli.c
eigrpd/eigrp_dump.c
isisd/isis_circuit.c
isisd/isisd.c
ldpd/ldp_debug.c
ldpd/ldp_vty.h
ldpd/ldp_vty_cmds.c
ldpd/ldp_vty_conf.c
lib/agentx.c
lib/command.c
lib/command.h
lib/filter.c
lib/keychain.c
lib/nexthop_group.c
lib/northbound_cli.c
lib/plist.c
lib/resolver.c
lib/routemap.c
lib/routemap_cli.c
lib/vrf.c
lib/vty.c
nhrpd/nhrp_vty.c
ospf6d/ospf6_interface.c
ospf6d/ospf6_top.c
ospf6d/ospf6d.c
ospfd/ospf_dump.c
ospfd/ospf_vty.c
pbrd/pbr_vty.c
pimd/pim_cmd.c
ripd/rip_debug.c
ripd/rip_interface.c
ripd/ripd.c
ripngd/ripng_debug.c
ripngd/ripng_interface.c
ripngd/ripngd.c
staticd/static_vty.c
tests/lib/cli/test_commands.c
vrrpd/vrrp_vty.c
vtysh/vtysh.c
zebra/debug.c
zebra/dplane_fpm_nl.c
zebra/interface.c
zebra/zebra_fpm.c
zebra/zebra_mpls_vty.c
zebra/zebra_pw.c
zebra/zebra_vty.c

index ee7a06c8ad7c170223a6941c41b6bfcd2dceff95..4360ec8e8862b9303c9b4e4f8596dad0f0e9d68f 100644 (file)
@@ -58,9 +58,11 @@ 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 = {
     .node = INTERFACE_NODE,
     .prompt = "%s(config-if)# ",
+    .config_write = interface_config_write,
 };
 
 
@@ -1245,7 +1247,7 @@ babel_if_init(void)
     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);
index 6d853c527092b2daca03982e3481f9cc4bf7d1af..2eaa9c9681567c11521dffcbbf7c77626cb302ef 100644 (file)
@@ -69,10 +69,12 @@ static time_t expiry_time;
 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 */
@@ -718,7 +720,7 @@ void
 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);
index ee0898d86c2781b4da5641230da4f3e33c2b1cf7..62a0016a137d3de4d085eb924a722f9bd03229dc 100644 (file)
@@ -885,9 +885,11 @@ DEFUN_NOSH(show_debugging_bfd,
        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 = {
@@ -943,11 +945,11 @@ void bfdd_vty_init(void)
        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();
index 871a693bc83ed30a50be01d696a994b93e65d281..7a97ff19dc52119268106c4bb5f06ff3b6f2d399 100644 (file)
@@ -2269,7 +2269,7 @@ static int bmp_config_write(struct bgp *bgp, struct vty *vty)
 
 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);
index f2f4ebf9265b93112ed8c330f2b8717ba07414d1..a20015bbce33aad86f6939a9ef61ea0cf7f68077 100644 (file)
@@ -2282,14 +2282,16 @@ static int bgp_config_write_debug(struct vty *vty)
        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);
 
index 498950f5475733d5a420260171f794d6ba2aff19..36efcd5380741717697807938e93253564ae011d 100644 (file)
@@ -777,10 +777,12 @@ DEFUN (no_dump_bgp_all,
        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
@@ -860,7 +862,7 @@ void bgp_dump_init(void)
                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);
index 2a19597e49ba7b7bf3f726a09918cb7614b3594d..0f70e6e5ae63216cfe4c943c5931bdcf081c93b5 100644 (file)
@@ -667,15 +667,17 @@ static int config_write_as_list(struct vty *vty)
        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);
index 49d3f25ae93736e9ca66d6613addd9077ee1b769..9bffa65c4ec569494d06c9ca910844e7ab528f03 100644 (file)
@@ -146,6 +146,7 @@ static int rpki_sync_socket_bgpd;
 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};
@@ -1542,7 +1543,7 @@ static void overwrite_exit_commands(void)
 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);
index a9123abd18fb09f6a520aab008d49b4eeecb97a2..78cbe250c5861e39d3c28085fe8562a750f72dfe 100644 (file)
@@ -15337,6 +15337,7 @@ int bgp_config_write(struct vty *vty)
 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 = {
@@ -15460,19 +15461,19 @@ void bgp_vty_init(void)
        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);
@@ -17877,14 +17878,16 @@ static int community_list_config_write(struct vty *vty)
        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);
index e9b7ae1c60be4b153db868bf27f8cd7dda9a00f0..38d4ff9a4f984dab794ebc689039e9b87a862446 100644 (file)
@@ -3689,10 +3689,10 @@ bgp_rfapi_get_ecommunity_by_lni_label(struct bgp *bgp, uint32_t is_import,
 
 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);
index 9a2ab9bb562b17cfa7f4cb374bf299c02ddb764a..5839d96f4c9a2c741c1ef6f7be9cb5b497b155c4 100644 (file)
@@ -173,14 +173,16 @@ static int bgp_vnc_config_write_debug(struct vty *vty)
        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);
index 6d324d47e8a64d46b6b6a694632ff899ee35d5ae..51119528605ecbcaee78bb5ae96690d6dd699f78 100644 (file)
@@ -838,9 +838,11 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode,
 /*
  * 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)
@@ -857,9 +859,11 @@ 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,
 };
 
 
@@ -893,7 +897,7 @@ eigrp_cli_init(void)
        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);
@@ -911,7 +915,7 @@ eigrp_cli_init(void)
        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);
index 3aaac4f5345bde8e29ae00efb975b1ea958d046b..05a25a433fa8c3374369f80f50d734606256eff4 100644 (file)
@@ -555,15 +555,17 @@ DEFUN (no_debug_eigrp_packets,
 }
 
 /* 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);
index 24d0408e37de5f7b086a33592b82b9ef4e9d2127..10874fad31abbda9d62ad11da890bad4ef878c0e 100644 (file)
@@ -67,7 +67,6 @@ DEFINE_HOOK(isis_if_new_hook, (struct interface *ifp), (ifp))
 /*
  * Prototypes.
  */
-int isis_interface_config_write(struct vty *);
 int isis_if_new_hook(struct interface *);
 int isis_if_delete_hook(struct interface *);
 
@@ -969,7 +968,7 @@ DEFINE_HOOK(isis_circuit_config_write,
            (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;
@@ -1192,7 +1191,7 @@ int isis_interface_config_write(struct vty *vty)
        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;
@@ -1338,6 +1337,7 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit,
 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)
@@ -1442,7 +1442,7 @@ void isis_circuit_init(void)
        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);
index 3341bd4419e5a80ba4dd1718795df17e4d7297b9..29d7f914f9685822b1da9bad1012b4440a000019 100644 (file)
@@ -73,7 +73,6 @@ int area_clear_net_title(struct vty *, const char *);
 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)
@@ -784,10 +783,12 @@ DEFUN_NOSH (show_debugging,
        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)
@@ -1855,7 +1856,7 @@ DEFUN (no_log_adj_changes,
 #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;
 
@@ -2129,7 +2130,7 @@ int isis_config_write(struct vty *vty)
 
 #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;
@@ -2147,12 +2148,13 @@ int isis_config_write(struct vty *vty)
 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);
 
@@ -2173,7 +2175,7 @@ void isis_init(void)
 
        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);
index 77ec8c69960e97940a722863b1d5a5e8ee06e188..59d8676ec2035413de42d1234b6d4d45bd2601ca 100644 (file)
 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
@@ -140,7 +143,7 @@ ldp_vty_show_debugging(struct vty *vty)
        return (CMD_SUCCESS);
 }
 
-int
+static int
 ldp_debug_config_write(struct vty *vty)
 {
        int write = 0;
index af5f1d561684e09a670df2d287bc962a711e5d13..f6ba8f8c97c8409757fb972558d0707d7a5396d1 100644 (file)
@@ -33,9 +33,6 @@ extern struct cmd_node ldp_debug_node;
 
 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);
index c10c6ae35c59b1746dfe4331657581eed449a630..fc84c7f76b9333390c4e22c8741839257e2c585b 100644 (file)
@@ -779,14 +779,14 @@ ldp_vty_init (void)
 {
        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);
index dcea6e8923f5675c764e87c7331706974706132b..69aa3220bccc7ba5a9c1d05dfc0cce930e19fe47 100644 (file)
 #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 *);
@@ -40,6 +42,7 @@ 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 = {
@@ -65,6 +68,7 @@ struct cmd_node ldp_ipv6_iface_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 = {
@@ -226,7 +230,7 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf,
        vty_out(vty, " exit-address-family\n");
 }
 
-int
+static int
 ldp_config_write(struct vty *vty)
 {
        struct nbr_params       *nbrp;
@@ -331,7 +335,7 @@ ldp_l2vpn_pw_config_write(struct vty *vty, struct l2vpn_pw *pw)
                vty_out (vty,"  ! Incomplete config, specify a pw-id\n");
 }
 
-int
+static int
 ldp_l2vpn_config_write(struct vty *vty)
 {
        struct l2vpn            *l2vpn;
index 8ce1545243b44a5b466883ed7eee0a08fe218528..42c843bbb1810c08765af25497866dfa3cf84596 100644 (file)
@@ -158,9 +158,11 @@ static void agentx_events_update(void)
 }
 
 /* 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 */
@@ -247,7 +249,7 @@ void smux_init(struct thread_master *tm)
                               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);
 }
index a26ec1a2663688ffb6d135e5f5f2338540b0f5ed..7d46202da86a6c8a5f8fc8c9083870ae3a85a567 100644 (file)
@@ -200,9 +200,11 @@ static struct cmd_node enable_node = {
        .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 {
@@ -352,10 +354,9 @@ static bool cmd_hash_cmp(const void *a, const void *b)
 }
 
 /* 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
@@ -1723,8 +1724,8 @@ static int vty_write_config(struct vty *vty)
        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");
                }
 
@@ -2889,11 +2890,11 @@ void cmd_init(int terminal)
        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);
index 06c7ce7b4d52a7817eb14c205706a07988cf82d2..ed7706c3092b205c6bcea5929b802522a87246fa 100644 (file)
@@ -177,7 +177,7 @@ struct cmd_node {
        const char *prompt;
 
        /* Node's configuration write function */
-       int (*func)(struct vty *);
+       int (*config_write)(struct vty *);
 
        /* Node's command graph */
        struct graph *cmdgraph;
@@ -431,7 +431,7 @@ struct cmd_node {
 #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 *);
 
index 5665dd82b26b56cb41bbd8b82eede553b48d620d..c6cc16d7d95299185c7595dab046d6ea6c7b658c 100644 (file)
@@ -2812,9 +2812,11 @@ static int config_write_access(struct vty *vty, afi_t afi)
        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)
@@ -2851,7 +2853,7 @@ static void access_list_reset_mac(void)
 /* 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);
@@ -2864,9 +2866,11 @@ 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 = {
        .node = ACCESS_NODE,
        .prompt = "",
+       .config_write = config_write_access_ipv4,
 };
 
 static int config_write_access_ipv4(struct vty *vty)
@@ -2903,7 +2907,7 @@ static void access_list_reset_ipv4(void)
 /* 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);
@@ -2950,9 +2954,11 @@ static void access_list_init_ipv4(void)
        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)
@@ -2988,7 +2994,7 @@ static void access_list_reset_ipv6(void)
 
 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);
index c66c1de07791042e3e640a1fd5e428c0c471446a..bbe2070b1d255e3a3ac8c012afd2d726dbad7960 100644 (file)
@@ -959,9 +959,11 @@ DEFUN (no_send_lifetime,
        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 = {
@@ -1046,8 +1048,8 @@ void keychain_init(void)
 {
        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);
index 95087fe3051a89ef5dc7314378a6ea3b52d1b664..cce5af1e785d4f5add67647dfffaa7284f5d1fa3 100644 (file)
@@ -933,9 +933,11 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd,
        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)
@@ -1209,7 +1211,7 @@ void nexthop_group_init(void (*new)(const char *name),
 
        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);
 
index 5803dbd787b6c75b61666b9f06a7be322702e7f9..d0e05990a8815b51140018f5a2b1e7e9bfac6f27 100644 (file)
@@ -1677,6 +1677,7 @@ static struct debug_callbacks nb_dbg_cbs = {.debug_set_all = nb_debug_set_all};
 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)
@@ -1741,7 +1742,7 @@ void nb_cli_init(struct thread_master *tm)
 
        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);
 
index 8f2389a32ebba09d4ab254e478effe2e329d7525..acc4491a008c607fc025d0c0fb23ab817c673006 100644 (file)
@@ -2044,10 +2044,12 @@ 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 = {
        .node = PREFIX_NODE,
        .prompt = "",
+       .config_write = config_write_prefix_ipv4,
 };
 
 static int config_write_prefix_ipv4(struct vty *vty)
@@ -2086,7 +2088,7 @@ static const struct cmd_variable_handler plist_var_handlers[] = {
 
 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);
@@ -2108,10 +2110,12 @@ static void prefix_list_init_ipv4(void)
        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)
@@ -2121,7 +2125,7 @@ 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);
index 9005ee52759621e4db127d2e6ba6b55ed45d4f1b..56b2d6cd66fee9bae3f7bfec89078eee5b587416 100644 (file)
@@ -245,9 +245,11 @@ DEFUN(debug_resolver,
        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)
@@ -277,7 +279,7 @@ void resolver_init(struct thread_master *tm)
                          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);
 }
index 41057c870434cb0b7c119f6c0cf063d63be37ed3..2208a69f94d45e0fc9d6c5db53a803d9348fc123 100644 (file)
@@ -3015,9 +3015,11 @@ DEFUN (no_debug_rmap,
 }
 
 /* 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. */
@@ -3245,7 +3247,7 @@ void route_map_init(void)
        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);
index a53c5429183a37cf63586dfc0ac682b695be9ed4..b97948d5c66a45283a1edfeb9dd6b8482e372391 100644 (file)
@@ -1064,9 +1064,11 @@ 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 = {
        .node = RMAP_NODE,
        .prompt = "%s(config-route-map)# ",
+       .config_write = route_map_config_write,
 };
 
 static void rmap_autocomplete(vector comps, struct cmd_token *token)
@@ -1090,7 +1092,7 @@ void route_map_cli_init(void)
        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);
index fbc45fa18ca88226f36f4c321148acfdf3be3c46..b825ff03ffaed9b799b0aa1a87e16005181ab722 100644 (file)
--- a/lib/vrf.c
+++ b/lib/vrf.c
@@ -851,14 +851,16 @@ static int vrf_write_host(struct vty *vty)
        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);
@@ -871,7 +873,8 @@ void vrf_cmd_init(int (*writefunc)(struct vty *vty),
 {
        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()) {
index 5b86455f6993d1605dc5f75669bbf9c18ad8d5ec..1d94d3d3104360d7884cacc8f6ec1a945f10b7be 100644 (file)
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -2989,9 +2989,11 @@ static int vty_config_write(struct vty *vty)
        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. */
@@ -3085,7 +3087,7 @@ void vty_init(struct thread_master *master_thread, bool do_command_logging)
        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);
index 69be4db90dff43ea0aaf81891566cc7e52e77095..f9ed1e96c0f460c739d80c9ff73377a0e88d30ee 100644 (file)
 #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>"
@@ -1094,7 +1098,7 @@ static int interface_config_write(struct vty *vty)
 
 void nhrp_config_init(void)
 {
-       install_node(&zebra_node, nhrp_config_write);
+       install_node(&zebra_node);
        install_default(ZEBRA_NODE);
 
        /* access-list commands */
@@ -1118,7 +1122,7 @@ void nhrp_config_init(void)
        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);
index 2bcaccc423f4c1bd7e13b68a7a6febe9c32014ae..3d1c6f9fa85d95c938313a15081d9238e53ffa9e 100644 (file)
@@ -1943,9 +1943,11 @@ static int config_write_ospf6_interface(struct vty *vty)
        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)
@@ -2002,7 +2004,7 @@ static int ospf6_ifp_destroy(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);
index ae7ecb55aacfa6f586d0ecfe1f5cb4e704bfa925..6168656211fd79ffaf3d6ddb170e031833ed2a00 100644 (file)
@@ -1112,17 +1112,19 @@ static int config_write_ospf6(struct vty *vty)
        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);
index 8e5406642af9924435097a696c8a2e094bdc56bb..efbb332b6ed5011bfb321093cd62b13c79834b30 100644 (file)
@@ -69,9 +69,11 @@ struct route_node *route_prev(struct route_node *node)
        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)
@@ -1217,7 +1219,7 @@ void ospf6_init(void)
        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();
index 6640c7c4828200cce1b9df44251d9c8194477548..e012326ea918c7919e811a7d3c75ce109aa09bfd 100644 (file)
@@ -1640,10 +1640,12 @@ DEFUN_NOSH (show_debugging_ospf_instance,
        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)
@@ -1784,7 +1786,7 @@ 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);
index b95a984766ac32f5dbd953cc954949146c0a4344..ab12c3818b998b0e09f31cadf2d3c8d97d31c1b0 100644 (file)
@@ -10555,17 +10555,19 @@ void ospf_vty_show_init(void)
 }
 
 
+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. */
@@ -10671,9 +10673,11 @@ static void ospf_vty_zebra_init(void)
 #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)
@@ -10747,7 +10751,7 @@ void ospf_vty_clear_init(void)
 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);
index a60d29e51231a2421f4b652e4cb39b649d457559..2f5d4dcbcc4ce5465df144109a31513b1b744c7b 100644 (file)
@@ -680,6 +680,7 @@ DEFPY (show_pbr_interface,
 static struct cmd_node debug_node = {
        .node = DEBUG_NODE,
        .prompt = "",
+       .config_write = pbr_debug_config_write,
 };
 
 DEFPY(debug_pbr,
@@ -728,9 +729,11 @@ DEFUN_NOSH(show_debugging_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)
@@ -758,10 +761,12 @@ 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,
@@ -840,15 +845,13 @@ void pbr_vty_init(void)
 {
        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);
index 3b590230c315439e332a033f1b9967fe6c7d161b..a386e33d2474ed32004672aaa09f9b155c7e924c 100644 (file)
 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[],
@@ -10831,11 +10833,10 @@ DEFUN_HIDDEN (ip_pim_mlag,
 
 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);
 
index 72cd0c62f1a604e11988018687e8d4e4720ea706..676fc0cca4174d667983a698e7911db6c847392b 100644 (file)
@@ -172,10 +172,12 @@ DEFUN (no_debug_rip_zebra,
        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)
@@ -211,7 +213,7 @@ void rip_debug_init(void)
        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);
index 10e23787e696f066d9ac7e1a0580cfa0db92566c..87899e468d9c5dbf636c7d6aaf51edbe822adc16 100644 (file)
@@ -1193,9 +1193,11 @@ int rip_show_network_config(struct vty *vty, struct rip *rip)
        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)
@@ -1237,7 +1239,7 @@ void rip_if_init(void)
        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);
index 95ea19a98de84450015dbdc4e0348c4d25f48714..71511deb14934167edf43ec8e57d929d1097c127 100644 (file)
@@ -3327,10 +3327,12 @@ static int config_write_rip(struct vty *vty)
        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. */
@@ -3734,7 +3736,7 @@ void rip_vrf_terminate(void)
 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);
index 24da4b00513d351080f5747d66ca17f553ecbee6..117148a3a1fb93f875c43b66f7fd0b7a9b3f3581 100644 (file)
@@ -174,10 +174,12 @@ DEFUN (no_debug_ripng_zebra,
        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)
@@ -213,7 +215,7 @@ void ripng_debug_init(void)
        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);
 
index 3fac88514186b4f20850e6e36075bccb13d26488..efaabdb6de1851ca7d0f9b52e7cb2af37f340ecf 100644 (file)
@@ -954,10 +954,12 @@ static int interface_config_write(struct vty *vty)
        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. */
@@ -968,7 +970,7 @@ void ripng_if_init(void)
        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);
index ad40c0b13f9ee6f65f769ae0cc4b54b80b494659..cde8d860e2255a9ee1b4a733c079341ad0ed3b73 100644 (file)
@@ -2434,10 +2434,12 @@ static int ripng_config_write(struct vty *vty)
        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,
@@ -2851,7 +2853,7 @@ void ripng_vrf_terminate(void)
 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);
index 05c5f7cfe0c5c51349d7f747a81e1d794acab445..733578f86c2c4d1c23d5a440a79a8c6f3bf59864 100644 (file)
@@ -1473,11 +1473,12 @@ DEFUN_NOSH (show_debugging_static,
 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);
 
index 3ebe46a9ab12f0a8a410714ff0d62b9990515dfb..d269e51beab9995cc629473c29525f23fb8bdc7d 100644 (file)
@@ -179,23 +179,23 @@ static void test_init(void)
        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();
 
index e1dd0a2d4c91f759fd77a98f8f604d0f9df128a3..98ce745936add882b02dd61120119e68fa9640e1 100644 (file)
@@ -747,23 +747,26 @@ static int vrrp_config_write_interface(struct vty *vty)
 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);
index 563914af479ce2cf158a4cd77dfac60b31da3c92..028a9c7e0150af52e6b5680225983d7c6ab50849 100644 (file)
@@ -3821,54 +3821,54 @@ void vtysh_init_vty(void)
        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;
index f7ad228a13fcf8cd40cadfe18ec5364be8c3bbf0..a77693d94d860529e08b46897a28ad0b26e6da78 100644 (file)
@@ -471,9 +471,11 @@ DEFPY (debug_zebra_nexthop,
 }
 
 /* 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)
@@ -589,7 +591,7 @@ void zebra_debug_init(void)
        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);
 
index f3bc670a1085d6c3acc87fe27f2cdf146ccd4e61..0a827df1418a9b64a18ed37c74da5149831e1c9d 100644 (file)
@@ -368,9 +368,10 @@ static int fpm_write_config(struct vty *vty)
        return written;
 }
 
-struct cmd_node fpm_node = {
+static struct cmd_node fpm_node = {
        .node = VTY_NODE,
        .prompt = "",
+       .config_write = fpm_write_config,
 };
 
 /*
@@ -1102,7 +1103,7 @@ static int fpm_nl_new(struct thread_master *tm)
        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);
index e330c4c84a6dc361ada6de168ca2a074fca703c4..8d119eac7b779a8f306745a68f5e1bfd9859c8f5 100644 (file)
@@ -1664,9 +1664,11 @@ static void interface_update_stats(void)
 #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
@@ -3315,8 +3317,8 @@ void zebra_if_init(void)
        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
index 03ad89dcb259693500fbc84189bca2ba378c2d9d..beb6fcb2ebe4566260c9df3027f3a5550995ef55 100644 (file)
@@ -1938,10 +1938,12 @@ 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 = {
        .node = ZEBRA_NODE,
        .prompt = "",
+       .config_write = fpm_remote_srv_write,
 };
 
 
@@ -1979,7 +1981,7 @@ static int zfpm_init(struct thread_master *master)
        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);
index 9137f3882c7a03d70289a6b7862a91cedee93b29..148b9c46db2db2467fa2df93fc44bb0eefde1f45 100644 (file)
@@ -449,10 +449,12 @@ DEFUN (no_mpls_label_global_block,
        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.  */
@@ -460,7 +462,7 @@ void zebra_mpls_vty_init(void)
 {
        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);
index 16f39cd0cfbc7089b68485bbb63377db87234ce1..9717805d07d3c18d26fe51bb6545a81f2a2ba5c6 100644 (file)
@@ -547,14 +547,16 @@ static int zebra_pw_config(struct vty *vty)
        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);
index c3199bcb5edc25c00909691200a17b7de0eb16ae..bb8d0c774448dc6f0c4995cbfd5b3dffce7b43da 100644 (file)
@@ -3478,30 +3478,38 @@ DEFUN_HIDDEN (show_frr,
 }
 
 /* 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);
@@ -3515,8 +3523,8 @@ void zebra_vty_init(void)
        /* 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);