diff options
-rw-r--r-- | babeld/babel_interface.c | 1 | ||||
-rw-r--r-- | babeld/babeld.c | 1 | ||||
-rw-r--r-- | bfdd/bfdd_vty.c | 2 | ||||
-rw-r--r-- | bgpd/bgp_bmp.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_rpki.c | 1 | ||||
-rw-r--r-- | bgpd/bgp_vty.c | 13 | ||||
-rw-r--r-- | bgpd/rfapi/bgp_rfapi_cfg.c | 4 | ||||
-rw-r--r-- | eigrpd/eigrp_cli.c | 2 | ||||
-rw-r--r-- | isisd/isis_circuit.c | 1 | ||||
-rw-r--r-- | isisd/isisd.c | 1 | ||||
-rw-r--r-- | ldpd/ldp_vty_conf.c | 7 | ||||
-rw-r--r-- | lib/command.c | 72 | ||||
-rw-r--r-- | lib/command.h | 1 | ||||
-rw-r--r-- | lib/keychain.c | 2 | ||||
-rw-r--r-- | lib/nexthop_group.c | 1 | ||||
-rw-r--r-- | lib/routemap_cli.c | 1 | ||||
-rw-r--r-- | lib/vrf.c | 1 | ||||
-rw-r--r-- | lib/vty.c | 19 | ||||
-rw-r--r-- | nhrpd/nhrp_vty.c | 2 | ||||
-rw-r--r-- | ospf6d/ospf6_interface.c | 1 | ||||
-rw-r--r-- | ospf6d/ospf6_top.c | 1 | ||||
-rw-r--r-- | ospfd/ospf_vty.c | 2 | ||||
-rw-r--r-- | pbrd/pbr_vty.c | 2 | ||||
-rw-r--r-- | pimd/pim_cmd.c | 1 | ||||
-rw-r--r-- | ripd/rip_interface.c | 1 | ||||
-rw-r--r-- | ripd/ripd.c | 1 | ||||
-rw-r--r-- | ripngd/ripng_interface.c | 1 | ||||
-rw-r--r-- | ripngd/ripngd.c | 1 | ||||
-rw-r--r-- | tests/lib/cli/test_commands.c | 16 | ||||
-rw-r--r-- | vrrpd/vrrp_vty.c | 1 | ||||
-rw-r--r-- | vtysh/vtysh.c | 46 | ||||
-rw-r--r-- | zebra/interface.c | 2 | ||||
-rw-r--r-- | zebra/zebra_fpm.c | 1 | ||||
-rw-r--r-- | zebra/zebra_pw.c | 1 |
34 files changed, 144 insertions, 67 deletions
diff --git a/babeld/babel_interface.c b/babeld/babel_interface.c index 4360ec8e8..072ad7060 100644 --- a/babeld/babel_interface.c +++ b/babeld/babel_interface.c @@ -61,6 +61,7 @@ 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, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = interface_config_write, }; diff --git a/babeld/babeld.c b/babeld/babeld.c index 2eaa9c968..6a83fa102 100644 --- a/babeld/babeld.c +++ b/babeld/babeld.c @@ -73,6 +73,7 @@ static int babel_config_write (struct vty *vty); static struct cmd_node cmd_babel_node = { .node = BABEL_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = babel_config_write, }; diff --git a/bfdd/bfdd_vty.c b/bfdd/bfdd_vty.c index 62a0016a1..5a4ce22b2 100644 --- a/bfdd/bfdd_vty.c +++ b/bfdd/bfdd_vty.c @@ -888,12 +888,14 @@ DEFUN_NOSH(show_debugging_bfd, static int bfdd_write_config(struct vty *vty); struct cmd_node bfd_node = { .node = BFD_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-bfd)# ", .config_write = bfdd_write_config, }; struct cmd_node bfd_peer_node = { .node = BFD_PEER_NODE, + .parent_node = BFD_NODE, .prompt = "%s(config-bfd-peer)# ", }; diff --git a/bgpd/bgp_bmp.c b/bgpd/bgp_bmp.c index 7a97ff19d..0a0271dd1 100644 --- a/bgpd/bgp_bmp.c +++ b/bgpd/bgp_bmp.c @@ -1774,6 +1774,7 @@ static void bmp_active_setup(struct bmp_active *ba) static struct cmd_node bmp_node = { .node = BMP_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-bgp-bmp)# " }; diff --git a/bgpd/bgp_rpki.c b/bgpd/bgp_rpki.c index 9bffa65c4..2d11718b5 100644 --- a/bgpd/bgp_rpki.c +++ b/bgpd/bgp_rpki.c @@ -145,6 +145,7 @@ static int rpki_sync_socket_bgpd; static struct cmd_node rpki_node = { .node = RPKI_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-rpki)# ", .config_write = config_write, }; diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c index 78cbe250c..e44f51518 100644 --- a/bgpd/bgp_vty.c +++ b/bgpd/bgp_vty.c @@ -15336,67 +15336,80 @@ int bgp_config_write(struct vty *vty) /* BGP node structure. */ static struct cmd_node bgp_node = { .node = BGP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = bgp_config_write, }; static struct cmd_node bgp_ipv4_unicast_node = { .node = BGP_IPV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4_multicast_node = { .node = BGP_IPV4M_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4_labeled_unicast_node = { .node = BGP_IPV4L_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6_unicast_node = { .node = BGP_IPV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6_multicast_node = { .node = BGP_IPV6M_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6_labeled_unicast_node = { .node = BGP_IPV6L_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_vpnv4_node = { .node = BGP_VPNV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_vpnv6_node = { .node = BGP_VPNV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af-vpnv6)# ", }; static struct cmd_node bgp_evpn_node = { .node = BGP_EVPN_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-evpn)# ", }; static struct cmd_node bgp_evpn_vni_node = { .node = BGP_EVPN_VNI_NODE, + .parent_node = BGP_EVPN_NODE, .prompt = "%s(config-router-af-vni)# ", }; static struct cmd_node bgp_flowspecv4_node = { .node = BGP_FLOWSPECV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_flowspecv6_node = { .node = BGP_FLOWSPECV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af-vpnv6)# ", }; diff --git a/bgpd/rfapi/bgp_rfapi_cfg.c b/bgpd/rfapi/bgp_rfapi_cfg.c index 38d4ff9a4..929165aa6 100644 --- a/bgpd/rfapi/bgp_rfapi_cfg.c +++ b/bgpd/rfapi/bgp_rfapi_cfg.c @@ -2966,11 +2966,13 @@ DEFUN_NOSH (exit_vnc, static struct cmd_node bgp_vnc_defaults_node = { .node = BGP_VNC_DEFAULTS_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vnc-defaults)# ", }; static struct cmd_node bgp_vnc_nve_group_node = { .node = BGP_VNC_NVE_GROUP_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vnc-nve-group)# ", }; @@ -3393,6 +3395,7 @@ DEFUN_NOSH (exit_vrf_policy, static struct cmd_node bgp_vrf_policy_node = { .node = BGP_VRF_POLICY_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vrf-policy)# ", }; @@ -3631,6 +3634,7 @@ DEFUN (vnc_l2_group_rt, static struct cmd_node bgp_vnc_l2_group_node = { .node = BGP_VNC_L2_GROUP_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vnc-l2-group)# ", }; diff --git a/eigrpd/eigrp_cli.c b/eigrpd/eigrp_cli.c index 511195286..502d29ebf 100644 --- a/eigrpd/eigrp_cli.c +++ b/eigrpd/eigrp_cli.c @@ -841,6 +841,7 @@ void eigrp_cli_show_keychain(struct vty *vty, struct lyd_node *dnode, static int eigrp_config_write(struct vty *vty); static struct cmd_node eigrp_node = { .node = EIGRP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = eigrp_config_write, }; @@ -862,6 +863,7 @@ static int eigrp_config_write(struct vty *vty) static int eigrp_write_interface(struct vty *vty); static struct cmd_node eigrp_interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = eigrp_write_interface, }; diff --git a/isisd/isis_circuit.c b/isisd/isis_circuit.c index 10874fad3..47e91ac10 100644 --- a/isisd/isis_circuit.c +++ b/isisd/isis_circuit.c @@ -1336,6 +1336,7 @@ ferr_r isis_circuit_passwd_hmac_md5_set(struct isis_circuit *circuit, struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = isis_interface_config_write, }; diff --git a/isisd/isisd.c b/isisd/isisd.c index 29d7f914f..a776e2da0 100644 --- a/isisd/isisd.c +++ b/isisd/isisd.c @@ -2147,6 +2147,7 @@ static int isis_config_write(struct vty *vty) struct cmd_node router_node = { .node = ROUTER_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = isis_config_write, }; diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c index 69aa3220b..ca82263b7 100644 --- a/ldpd/ldp_vty_conf.c +++ b/ldpd/ldp_vty_conf.c @@ -41,38 +41,45 @@ static int ldp_iface_is_configured(struct ldpd_conf *, const char *); struct cmd_node ldp_node = { .node = LDP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-ldp)# ", .config_write = ldp_config_write, }; struct cmd_node ldp_ipv4_node = { .node = LDP_IPV4_NODE, + .parent_node = LDP_NODE, .prompt = "%s(config-ldp-af)# ", }; struct cmd_node ldp_ipv6_node = { .node = LDP_IPV6_NODE, + .parent_node = LDP_NODE, .prompt = "%s(config-ldp-af)# ", }; struct cmd_node ldp_ipv4_iface_node = { .node = LDP_IPV4_IFACE_NODE, + .parent_node = LDP_IPV4_NODE, .prompt = "%s(config-ldp-af-if)# ", }; struct cmd_node ldp_ipv6_iface_node = { .node = LDP_IPV6_IFACE_NODE, + .parent_node = LDP_IPV6_NODE, .prompt = "%s(config-ldp-af-if)# ", }; struct cmd_node ldp_l2vpn_node = { .node = LDP_L2VPN_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-l2vpn)# ", .config_write = ldp_l2vpn_config_write, }; struct cmd_node ldp_pseudowire_node = { .node = LDP_PSEUDOWIRE_NODE, + .parent_node = LDP_L2VPN_NODE, .prompt = "%s(config-l2vpn-pw)# ", }; diff --git a/lib/command.c b/lib/command.c index 7d46202da..dad35bfbf 100644 --- a/lib/command.c +++ b/lib/command.c @@ -203,6 +203,7 @@ static struct cmd_node enable_node = { static int config_write_host(struct vty *vty); static struct cmd_node config_node = { .node = CONFIG_NODE, + .parent_node = ENABLE_NODE, .prompt = "%s(config)# ", .config_write = config_write_host, }; @@ -1458,6 +1459,8 @@ DEFUN (config_exit, void cmd_exit(struct vty *vty) { + struct cmd_node *cnode = vector_lookup(cmdvec, vty->node); + switch (vty->node) { case VIEW_NODE: case ENABLE_NODE: @@ -1470,73 +1473,9 @@ void cmd_exit(struct vty *vty) vty->node = ENABLE_NODE; vty_config_exit(vty); break; - case INTERFACE_NODE: - case PW_NODE: - case VRF_NODE: - case NH_GROUP_NODE: - case ZEBRA_NODE: - case BGP_NODE: - case RIP_NODE: - case EIGRP_NODE: - case BABEL_NODE: - case RIPNG_NODE: - case OSPF_NODE: - case OSPF6_NODE: - case LDP_NODE: - case LDP_L2VPN_NODE: - case ISIS_NODE: - case OPENFABRIC_NODE: - case KEYCHAIN_NODE: - case RMAP_NODE: - case PBRMAP_NODE: - case VTY_NODE: - case BFD_NODE: - vty->node = CONFIG_NODE; - break; - case BGP_IPV4_NODE: - case BGP_IPV4M_NODE: - case BGP_IPV4L_NODE: - case BGP_VPNV4_NODE: - case BGP_VPNV6_NODE: - case BGP_FLOWSPECV4_NODE: - case BGP_FLOWSPECV6_NODE: - case BGP_VRF_POLICY_NODE: - case BGP_VNC_DEFAULTS_NODE: - case BGP_VNC_NVE_GROUP_NODE: - case BGP_VNC_L2_GROUP_NODE: - case BGP_IPV6_NODE: - case BGP_IPV6M_NODE: - case BGP_EVPN_NODE: - case BGP_IPV6L_NODE: - case BMP_NODE: - vty->node = BGP_NODE; - break; - case BGP_EVPN_VNI_NODE: - vty->node = BGP_EVPN_NODE; - break; - case LDP_IPV4_NODE: - case LDP_IPV6_NODE: - vty->node = LDP_NODE; - break; - case LDP_IPV4_IFACE_NODE: - vty->node = LDP_IPV4_NODE; - break; - case LDP_IPV6_IFACE_NODE: - vty->node = LDP_IPV6_NODE; - break; - case LDP_PSEUDOWIRE_NODE: - vty->node = LDP_L2VPN_NODE; - break; - case KEYCHAIN_KEY_NODE: - vty->node = KEYCHAIN_NODE; - break; - case LINK_PARAMS_NODE: - vty->node = INTERFACE_NODE; - break; - case BFD_PEER_NODE: - vty->node = BFD_NODE; - break; default: + if (cnode->parent_node) + vty->node = cnode->parent_node; break; } @@ -1564,7 +1503,6 @@ DEFUN (config_end, vty_config_exit(vty); vty->node = ENABLE_NODE; } - return CMD_SUCCESS; } diff --git a/lib/command.h b/lib/command.h index ed7706c30..c1de67e10 100644 --- a/lib/command.h +++ b/lib/command.h @@ -172,6 +172,7 @@ extern const char *const node_names[]; struct cmd_node { /* Node index. */ enum node_type node; + enum node_type parent_node; /* Prompt character at vty interface. */ const char *prompt; diff --git a/lib/keychain.c b/lib/keychain.c index bbe2070b1..bfeaa7fec 100644 --- a/lib/keychain.c +++ b/lib/keychain.c @@ -962,12 +962,14 @@ DEFUN (no_send_lifetime, static int keychain_config_write(struct vty *vty); static struct cmd_node keychain_node = { .node = KEYCHAIN_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-keychain)# ", .config_write = keychain_config_write, }; static struct cmd_node keychain_key_node = { .node = KEYCHAIN_KEY_NODE, + .parent_node = KEYCHAIN_NODE, .prompt = "%s(config-keychain-key)# ", }; diff --git a/lib/nexthop_group.c b/lib/nexthop_group.c index cce5af1e7..554460529 100644 --- a/lib/nexthop_group.c +++ b/lib/nexthop_group.c @@ -936,6 +936,7 @@ DEFPY(ecmp_nexthops, ecmp_nexthops_cmd, static int nexthop_group_write(struct vty *vty); static struct cmd_node nexthop_group_node = { .node = NH_GROUP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-nh-group)# ", .config_write = nexthop_group_write, }; diff --git a/lib/routemap_cli.c b/lib/routemap_cli.c index b97948d5c..16ecd1194 100644 --- a/lib/routemap_cli.c +++ b/lib/routemap_cli.c @@ -1067,6 +1067,7 @@ static int route_map_config_write(struct vty *vty) static int route_map_config_write(struct vty *vty); static struct cmd_node rmap_node = { .node = RMAP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-route-map)# ", .config_write = route_map_config_write, }; @@ -760,6 +760,7 @@ DEFUN (no_vrf, static struct cmd_node vrf_node = { .node = VRF_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-vrf)# ", }; @@ -2605,6 +2605,24 @@ int vty_config_enter(struct vty *vty, bool private_config, bool exclusive) void vty_config_exit(struct vty *vty) { + enum node_type node = vty->node; + struct cmd_node *cnode; + + /* unlock and jump up to ENABLE_NODE if -and only if- we're + * somewhere below CONFIG_NODE */ + while (node && node != CONFIG_NODE) { + cnode = vector_lookup(cmdvec, node); + node = cnode->parent_node; + } + if (node != CONFIG_NODE) { + vty_out(vty, + "WARNING: vty_config_exit() from outside CONFIG_NODE!\n"); + return; + } + + while (vty->node != ENABLE_NODE) + cmd_exit(vty); + /* Check if there's a pending confirmed commit. */ if (vty->t_confirmed_commit_timeout) { vty_out(vty, @@ -2992,6 +3010,7 @@ static int vty_config_write(struct vty *vty) static int vty_config_write(struct vty *vty); struct cmd_node vty_node = { .node = VTY_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-line)# ", .config_write = vty_config_write, }; diff --git a/nhrpd/nhrp_vty.c b/nhrpd/nhrp_vty.c index f9ed1e96c..bf29d0218 100644 --- a/nhrpd/nhrp_vty.c +++ b/nhrpd/nhrp_vty.c @@ -20,6 +20,7 @@ static int nhrp_config_write(struct vty *vty); static struct cmd_node zebra_node = { .node = ZEBRA_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = nhrp_config_write, }; @@ -27,6 +28,7 @@ static struct cmd_node zebra_node = { static int interface_config_write(struct vty *vty); static struct cmd_node nhrp_interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = interface_config_write, }; diff --git a/ospf6d/ospf6_interface.c b/ospf6d/ospf6_interface.c index 3d1c6f9fa..8ed9c6797 100644 --- a/ospf6d/ospf6_interface.c +++ b/ospf6d/ospf6_interface.c @@ -1946,6 +1946,7 @@ static int config_write_ospf6_interface(struct vty *vty) static int config_write_ospf6_interface(struct vty *vty); static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = config_write_ospf6_interface, }; diff --git a/ospf6d/ospf6_top.c b/ospf6d/ospf6_top.c index 616865621..75c0460ec 100644 --- a/ospf6d/ospf6_top.c +++ b/ospf6d/ospf6_top.c @@ -1116,6 +1116,7 @@ static int config_write_ospf6(struct vty *vty); /* OSPF6 node structure. */ static struct cmd_node ospf6_node = { .node = OSPF6_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-ospf6)# ", .config_write = config_write_ospf6, }; diff --git a/ospfd/ospf_vty.c b/ospfd/ospf_vty.c index ab12c3818..25bd41001 100644 --- a/ospfd/ospf_vty.c +++ b/ospfd/ospf_vty.c @@ -10559,6 +10559,7 @@ static int config_write_interface(struct vty *vty); /* ospfd's interface node. */ static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = config_write_interface, }; @@ -10676,6 +10677,7 @@ static void ospf_vty_zebra_init(void) static int ospf_config_write(struct vty *vty); static struct cmd_node ospf_node = { .node = OSPF_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = ospf_config_write, }; diff --git a/pbrd/pbr_vty.c b/pbrd/pbr_vty.c index 2f5d4dcbc..35dbb24d1 100644 --- a/pbrd/pbr_vty.c +++ b/pbrd/pbr_vty.c @@ -732,6 +732,7 @@ DEFUN_NOSH(show_debugging_pbr, static int pbr_interface_config_write(struct vty *vty); static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = pbr_interface_config_write, }; @@ -765,6 +766,7 @@ static int pbr_vty_map_config_write(struct vty *vty); /* PBR map node structure. */ static struct cmd_node pbr_map_node = { .node = PBRMAP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-pbr-map)# ", .config_write = pbr_vty_map_config_write, }; diff --git a/pimd/pim_cmd.c b/pimd/pim_cmd.c index a386e33d2..895072a89 100644 --- a/pimd/pim_cmd.c +++ b/pimd/pim_cmd.c @@ -71,6 +71,7 @@ static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = pim_interface_config_write, }; diff --git a/ripd/rip_interface.c b/ripd/rip_interface.c index 87899e468..924eb8334 100644 --- a/ripd/rip_interface.c +++ b/ripd/rip_interface.c @@ -1196,6 +1196,7 @@ int rip_show_network_config(struct vty *vty, struct rip *rip) static int rip_interface_config_write(struct vty *vty); static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = rip_interface_config_write, }; diff --git a/ripd/ripd.c b/ripd/ripd.c index 71511deb1..b6bbfb253 100644 --- a/ripd/ripd.c +++ b/ripd/ripd.c @@ -3331,6 +3331,7 @@ static int config_write_rip(struct vty *vty); /* RIP node structure. */ static struct cmd_node rip_node = { .node = RIP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = config_write_rip, }; diff --git a/ripngd/ripng_interface.c b/ripngd/ripng_interface.c index efaabdb6d..e45bbbe21 100644 --- a/ripngd/ripng_interface.c +++ b/ripngd/ripng_interface.c @@ -958,6 +958,7 @@ static int interface_config_write(struct vty *vty); /* ripngd's interface node. */ static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = interface_config_write, }; diff --git a/ripngd/ripngd.c b/ripngd/ripngd.c index cde8d860e..47083f947 100644 --- a/ripngd/ripngd.c +++ b/ripngd/ripngd.c @@ -2438,6 +2438,7 @@ static int ripng_config_write(struct vty *vty); /* RIPng node structure. */ static struct cmd_node cmd_ripng_node = { .node = RIPNG_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", .config_write = ripng_config_write, }; diff --git a/tests/lib/cli/test_commands.c b/tests/lib/cli/test_commands.c index d269e51be..54417f495 100644 --- a/tests/lib/cli/test_commands.c +++ b/tests/lib/cli/test_commands.c @@ -50,81 +50,97 @@ static char test_buf[32768]; static struct cmd_node bgp_node = { .node = BGP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node rip_node = { .node = RIP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node isis_node = { .node = ISIS_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", }; static struct cmd_node rmap_node = { .node = RMAP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-route-map)# ", }; static struct cmd_node zebra_node = { .node = ZEBRA_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node bgp_vpnv4_node = { .node = BGP_VPNV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4_node = { .node = BGP_IPV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4m_node = { .node = BGP_IPV4M_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6_node = { .node = BGP_IPV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6m_node = { .node = BGP_IPV6M_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node ospf_node = { .node = OSPF_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node ripng_node = { .node = RIPNG_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node ospf6_node = { .node = OSPF6_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-ospf6)# ", }; static struct cmd_node keychain_node = { .node = KEYCHAIN_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-keychain)# ", }; static struct cmd_node keychain_key_node = { .node = KEYCHAIN_KEY_NODE, + .parent_node = KEYCHAIN_NODE, .prompt = "%s(config-keychain-key)# ", }; diff --git a/vrrpd/vrrp_vty.c b/vrrpd/vrrp_vty.c index 98ce74593..f2048db98 100644 --- a/vrrpd/vrrp_vty.c +++ b/vrrpd/vrrp_vty.c @@ -746,6 +746,7 @@ static int vrrp_config_write_interface(struct vty *vty) static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = vrrp_config_write_interface, }; diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 028a9c7e0..ddb40a572 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1174,232 +1174,278 @@ static char **new_completion(const char *text, int start, int end) /* Vty node structures. */ static struct cmd_node bgp_node = { .node = BGP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node rip_node = { .node = RIP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node isis_node = { .node = ISIS_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node openfabric_node = { .node = OPENFABRIC_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", }; static struct cmd_node pw_node = { .node = PW_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-pw)# ", }; static struct cmd_node vrf_node = { .node = VRF_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-vrf)# ", }; static struct cmd_node nh_group_node = { .node = NH_GROUP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-nh-group)# ", }; static struct cmd_node rmap_node = { .node = RMAP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-route-map)# ", }; static struct cmd_node pbr_map_node = { .node = PBRMAP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-pbr-map)# ", }; static struct cmd_node zebra_node = { .node = ZEBRA_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node bgp_vpnv4_node = { .node = BGP_VPNV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_vpnv6_node = { .node = BGP_VPNV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_flowspecv4_node = { .node = BGP_FLOWSPECV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_flowspecv6_node = { .node = BGP_FLOWSPECV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4_node = { .node = BGP_IPV4_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4m_node = { .node = BGP_IPV4M_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv4l_node = { .node = BGP_IPV4L_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6_node = { .node = BGP_IPV6_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_ipv6m_node = { .node = BGP_IPV6M_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_evpn_node = { .node = BGP_EVPN_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_evpn_vni_node = { .node = BGP_EVPN_VNI_NODE, + .parent_node = BGP_EVPN_NODE, .prompt = "%s(config-router-af-vni)# ", }; static struct cmd_node bgp_ipv6l_node = { .node = BGP_IPV6L_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-af)# ", }; static struct cmd_node bgp_vnc_defaults_node = { .node = BGP_VNC_DEFAULTS_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vnc-defaults)# ", }; static struct cmd_node bgp_vnc_nve_group_node = { .node = BGP_VNC_NVE_GROUP_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vnc-nve-group)# ", }; static struct cmd_node bgp_vrf_policy_node = { .node = BGP_VRF_POLICY_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vrf-policy)# ", }; static struct cmd_node bgp_vnc_l2_group_node = { .node = BGP_VNC_L2_GROUP_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-router-vnc-l2-group)# ", }; static struct cmd_node bmp_node = { .node = BMP_NODE, + .parent_node = BGP_NODE, .prompt = "%s(config-bgp-bmp)# " }; static struct cmd_node ospf_node = { .node = OSPF_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node eigrp_node = { .node = EIGRP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node babel_node = { .node = BABEL_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node ripng_node = { .node = RIPNG_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-router)# ", }; static struct cmd_node ospf6_node = { .node = OSPF6_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-ospf6)# ", }; static struct cmd_node ldp_node = { .node = LDP_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-ldp)# ", }; static struct cmd_node ldp_ipv4_node = { .node = LDP_IPV4_NODE, + .parent_node = LDP_NODE, .prompt = "%s(config-ldp-af)# ", }; static struct cmd_node ldp_ipv6_node = { .node = LDP_IPV6_NODE, + .parent_node = LDP_NODE, .prompt = "%s(config-ldp-af)# ", }; static struct cmd_node ldp_ipv4_iface_node = { .node = LDP_IPV4_IFACE_NODE, + .parent_node = LDP_IPV4_NODE, .prompt = "%s(config-ldp-af-if)# ", }; static struct cmd_node ldp_ipv6_iface_node = { .node = LDP_IPV6_IFACE_NODE, + .parent_node = LDP_IPV6_NODE, .prompt = "%s(config-ldp-af-if)# ", }; static struct cmd_node ldp_l2vpn_node = { .node = LDP_L2VPN_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-l2vpn)# ", }; static struct cmd_node ldp_pseudowire_node = { .node = LDP_PSEUDOWIRE_NODE, + .parent_node = LDP_L2VPN_NODE, .prompt = "%s(config-l2vpn-pw)# ", }; static struct cmd_node keychain_node = { .node = KEYCHAIN_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-keychain)# ", }; static struct cmd_node keychain_key_node = { .node = KEYCHAIN_KEY_NODE, + .parent_node = KEYCHAIN_NODE, .prompt = "%s(config-keychain-key)# ", }; struct cmd_node link_params_node = { .node = LINK_PARAMS_NODE, + .parent_node = INTERFACE_NODE, .prompt = "%s(config-link-params)# ", }; static struct cmd_node rpki_node = { .node = RPKI_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-rpki)# ", }; #if HAVE_BFDD > 0 static struct cmd_node bfd_node = { .node = BFD_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-bfd)# ", }; static struct cmd_node bfd_peer_node = { .node = BFD_PEER_NODE, + .parent_node = BFD_NODE, .prompt = "%s(config-bfd-peer)# ", }; #endif /* HAVE_BFDD */ diff --git a/zebra/interface.c b/zebra/interface.c index 8d119eac7..f4b330d8a 100644 --- a/zebra/interface.c +++ b/zebra/interface.c @@ -1667,6 +1667,7 @@ static void interface_update_stats(void) static int if_config_write(struct vty *vty); struct cmd_node interface_node = { .node = INTERFACE_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-if)# ", .config_write = if_config_write, }; @@ -2080,6 +2081,7 @@ DEFUN (no_bandwidth_if, struct cmd_node link_params_node = { .node = LINK_PARAMS_NODE, + .parent_node = INTERFACE_NODE, .prompt = "%s(config-link-params)# ", }; diff --git a/zebra/zebra_fpm.c b/zebra/zebra_fpm.c index beb6fcb2e..462a75b55 100644 --- a/zebra/zebra_fpm.c +++ b/zebra/zebra_fpm.c @@ -1942,6 +1942,7 @@ static int fpm_remote_srv_write(struct vty *vty); /* Zebra node */ static struct cmd_node zebra_node = { .node = ZEBRA_NODE, + .parent_node = CONFIG_NODE, .prompt = "", .config_write = fpm_remote_srv_write, }; diff --git a/zebra/zebra_pw.c b/zebra/zebra_pw.c index 9717805d0..188540128 100644 --- a/zebra/zebra_pw.c +++ b/zebra/zebra_pw.c @@ -550,6 +550,7 @@ static int zebra_pw_config(struct vty *vty) static int zebra_pw_config(struct vty *vty); static struct cmd_node pw_node = { .node = PW_NODE, + .parent_node = CONFIG_NODE, .prompt = "%s(config-pw)# ", .config_write = zebra_pw_config, }; |