From 308252d06dfb76edf1477b96416c2e2aa9f90579 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Thu, 30 Mar 2017 20:26:17 -0300 Subject: [PATCH] ldpd: remove the interface vty node ldpd uses a hierarchical configuration model where all commands are defined inside the "mpls ldp" node and its subnodes. The idea is to keep all LDP configuration in a single place to keep things simple. With that said, we can remove the "config-if" node from ldpd because we already have a separate node ("config-ldp-af-if") for LDP-related interface specific commands. Example: vtysh(config)# mpls ldp vtysh(config-ldp)# address-family ipv4 vtysh(config-ldp-af)# interface eth1 vtysh(config-ldp-af-if)# discovery hello ? holdtime Hello holdtime interval Hello interval Signed-off-by: Renato Westphal --- ldpd/ldp_vty.h | 1 - ldpd/ldp_vty_conf.c | 36 ------------------------------------ ldpd/ldpd.c | 1 - vtysh/vtysh.c | 4 ++-- vtysh/vtysh.h | 2 +- 5 files changed, 3 insertions(+), 41 deletions(-) diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h index 0b05e6fbf1..8510a394ec 100644 --- a/ldpd/ldp_vty.h +++ b/ldpd/ldp_vty.h @@ -80,6 +80,5 @@ int ldp_vty_debug(struct vty *, struct vty_arg *[]); int ldp_vty_show_debugging(struct vty *, struct vty_arg *[]); void ldp_vty_init(void); -void ldp_vty_if_init(void); #endif /* _LDP_VTY_H_ */ diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c index bab5e17368..dcf5f52436 100644 --- a/ldpd/ldp_vty_conf.c +++ b/ldpd/ldp_vty_conf.c @@ -32,7 +32,6 @@ #include "vty.h" #include "ldp_vty.h" -static int interface_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 *); @@ -48,13 +47,6 @@ static struct iface *vty_iface; static struct l2vpn *vty_l2vpn; static struct l2vpn_pw *vty_pw; -static struct cmd_node interface_node = -{ - INTERFACE_NODE, - "%s(config-if)# ", - 1 -}; - struct cmd_node ldp_node = { LDP_NODE, @@ -122,26 +114,6 @@ ldp_get_address(const char *str, int *af, union ldpd_addr *addr) return (-1); } -static int -interface_config_write(struct vty *vty) -{ - struct listnode *node; - struct interface *ifp; - int write = 0; - - for (ALL_LIST_ELEMENTS_RO(vrf_iflist (VRF_DEFAULT), node, ifp)) { - vty_out(vty, "!%s", VTY_NEWLINE); - vty_out(vty, "interface %s%s", ifp->name, VTY_NEWLINE); - if (ifp->desc) - vty_out(vty, " description %s%s", ifp->desc, - VTY_NEWLINE); - - write++; - } - - return (write); -} - static void ldp_af_iface_config_write(struct vty *vty, int af) { @@ -1794,14 +1766,6 @@ ldp_vty_l2vpn_pw_pwstatus(struct vty *vty, struct vty_arg *args[]) return (CMD_SUCCESS); } -void -ldp_vty_if_init(void) -{ - /* Install interface node. */ - install_node (&interface_node, interface_config_write); - if_cmd_init (); -} - struct iface * iface_new_api(struct ldpd_conf *conf, const char *name) { diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 3023d94469..3b3a07c28c 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -338,7 +338,6 @@ main(int argc, char *argv[]) vrf_init(); access_list_init(); ldp_vty_init(); - ldp_vty_if_init(); ldp_zebra_init(master); /* create base configuration with sane defaults */ diff --git a/vtysh/vtysh.c b/vtysh/vtysh.c index 114022d199..7d5fa8442b 100644 --- a/vtysh/vtysh.c +++ b/vtysh/vtysh.c @@ -1799,7 +1799,7 @@ DEFUNSH (VTYSH_INTERFACE, } /* TODO Implement "no interface command in isisd. */ -DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD, +DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D, vtysh_no_interface_cmd, "no interface IFNAME", NO_STR @@ -1883,7 +1883,7 @@ DEFUNSH (VTYSH_VRF, /* TODO Implement interface description commands in ripngd, ospf6d * and isisd. */ -DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD|VTYSH_LDPD, +DEFSH (VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_OSPFD, vtysh_interface_desc_cmd, "description LINE...", "Interface specific description\n" diff --git a/vtysh/vtysh.h b/vtysh/vtysh.h index 07ba8367de..6d9e21d8a0 100644 --- a/vtysh/vtysh.h +++ b/vtysh/vtysh.h @@ -44,7 +44,7 @@ DECLARE_MGROUP(MVTYSH) * things like prefix lists are not even initialised) */ #define VTYSH_ALL VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_BGPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD #define VTYSH_RMAP VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_BGPD|VTYSH_PIMD -#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_LDPD|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD +#define VTYSH_INTERFACE VTYSH_ZEBRA|VTYSH_RIPD|VTYSH_RIPNGD|VTYSH_OSPFD|VTYSH_OSPF6D|VTYSH_ISISD|VTYSH_PIMD|VTYSH_NHRPD #define VTYSH_NS VTYSH_ZEBRA #define VTYSH_VRF VTYSH_ZEBRA -- 2.39.5