From 16cd3d9d4a393f504608445a631c87bef6e83cfa Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Tue, 3 Oct 2017 10:27:05 -0300 Subject: [PATCH] ldpd: remove the "discovery targeted-hello" commands from the interface node These commands belong only in the global LDP node and in the LDP address-family nodes. Signed-off-by: Renato Westphal --- ldpd/ldp_vty.h | 4 +-- ldpd/ldp_vty_cmds.c | 64 ++++++++++++++++++++++++++++++++------------- ldpd/ldp_vty_conf.c | 19 +++----------- 3 files changed, 51 insertions(+), 36 deletions(-) diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h index 3d2072f1e5..baf9db51d4 100644 --- a/ldpd/ldp_vty.h +++ b/ldpd/ldp_vty.h @@ -38,8 +38,8 @@ 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 *, const char *, long); -int ldp_vty_disc_interval(struct vty *, const char *, const char *, long); +int ldp_vty_disc_holdtime(struct vty *, const char *, enum hello_type, long); +int ldp_vty_disc_interval(struct vty *, const char *, enum hello_type, long); int ldp_vty_targeted_hello_accept(struct vty *, const char *, const char *); int ldp_vty_nbr_session_holdtime(struct vty *, const char *, struct in_addr, long); int ldp_vty_af_session_holdtime(struct vty *, const char *, long); diff --git a/ldpd/ldp_vty_cmds.c b/ldpd/ldp_vty_cmds.c index cd92958d4c..00151a4d99 100644 --- a/ldpd/ldp_vty_cmds.c +++ b/ldpd/ldp_vty_cmds.c @@ -112,30 +112,52 @@ DEFUN_NOSH(ldp_exit_address_family, return CMD_SUCCESS; } -DEFPY (ldp_discovery_holdtime, - ldp_discovery_holdtime_cmd, - "[no] discovery $hello_type holdtime (1-65535)$holdtime", +DEFPY (ldp_discovery_link_holdtime, + ldp_discovery_link_holdtime_cmd, + "[no] discovery hello holdtime (1-65535)$holdtime", NO_STR "Configure discovery parameters\n" "LDP Link Hellos\n" + "Hello holdtime\n" + "Time (seconds) - 65535 implies infinite\n") +{ + return (ldp_vty_disc_holdtime(vty, no, HELLO_LINK, holdtime)); +} + +DEFPY (ldp_discovery_targeted_holdtime, + ldp_discovery_targeted_holdtime_cmd, + "[no] discovery targeted-hello holdtime (1-65535)$holdtime", + NO_STR + "Configure discovery parameters\n" "LDP Targeted Hellos\n" "Hello holdtime\n" "Time (seconds) - 65535 implies infinite\n") { - return (ldp_vty_disc_holdtime(vty, no, hello_type, holdtime)); + return (ldp_vty_disc_holdtime(vty, no, HELLO_TARGETED, holdtime)); } -DEFPY (ldp_discovery_interval, - ldp_discovery_interval_cmd, - "[no] discovery $hello_type interval (1-65535)$interval", +DEFPY (ldp_discovery_link_interval, + ldp_discovery_link_interval_cmd, + "[no] discovery hello interval (1-65535)$interval", NO_STR "Configure discovery parameters\n" "LDP Link Hellos\n" + "Hello interval\n" + "Time (seconds)\n") +{ + return (ldp_vty_disc_interval(vty, no, HELLO_LINK, interval)); +} + +DEFPY (ldp_discovery_targeted_interval, + ldp_discovery_targeted_interval_cmd, + "[no] discovery targeted-hello interval (1-65535)$interval", + NO_STR + "Configure discovery parameters\n" "LDP Targeted Hellos\n" "Hello interval\n" "Time (seconds)\n") { - return (ldp_vty_disc_interval(vty, no, hello_type, interval)); + return (ldp_vty_disc_interval(vty, no, HELLO_TARGETED, interval)); } DEFPY (ldp_dual_stack_transport_connection_prefer_ipv4, @@ -747,8 +769,10 @@ ldp_vty_init (void) install_element(LDP_NODE, &ldp_address_family_cmd); install_element(LDP_NODE, &no_ldp_address_family_cmd); - install_element(LDP_NODE, &ldp_discovery_holdtime_cmd); - install_element(LDP_NODE, &ldp_discovery_interval_cmd); + install_element(LDP_NODE, &ldp_discovery_link_holdtime_cmd); + install_element(LDP_NODE, &ldp_discovery_targeted_holdtime_cmd); + install_element(LDP_NODE, &ldp_discovery_link_interval_cmd); + install_element(LDP_NODE, &ldp_discovery_targeted_interval_cmd); install_element(LDP_NODE, &ldp_dual_stack_transport_connection_prefer_ipv4_cmd); install_element(LDP_NODE, &ldp_dual_stack_cisco_interop_cmd); install_element(LDP_NODE, &ldp_neighbor_password_cmd); @@ -756,8 +780,10 @@ ldp_vty_init (void) install_element(LDP_NODE, &ldp_neighbor_ttl_security_cmd); install_element(LDP_NODE, &ldp_router_id_cmd); - install_element(LDP_IPV4_NODE, &ldp_discovery_holdtime_cmd); - install_element(LDP_IPV4_NODE, &ldp_discovery_interval_cmd); + install_element(LDP_IPV4_NODE, &ldp_discovery_link_holdtime_cmd); + install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_holdtime_cmd); + install_element(LDP_IPV4_NODE, &ldp_discovery_link_interval_cmd); + install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_interval_cmd); install_element(LDP_IPV4_NODE, &ldp_discovery_targeted_hello_accept_cmd); install_element(LDP_IPV4_NODE, &ldp_discovery_transport_address_ipv4_cmd); install_element(LDP_IPV4_NODE, &ldp_label_local_advertise_cmd); @@ -771,8 +797,10 @@ ldp_vty_init (void) install_element(LDP_IPV4_NODE, &ldp_neighbor_ipv4_targeted_cmd); install_element(LDP_IPV4_NODE, &ldp_exit_address_family_cmd); - install_element(LDP_IPV6_NODE, &ldp_discovery_holdtime_cmd); - install_element(LDP_IPV6_NODE, &ldp_discovery_interval_cmd); + install_element(LDP_IPV6_NODE, &ldp_discovery_link_holdtime_cmd); + install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_holdtime_cmd); + install_element(LDP_IPV6_NODE, &ldp_discovery_link_interval_cmd); + install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_interval_cmd); install_element(LDP_IPV6_NODE, &ldp_discovery_targeted_hello_accept_cmd); install_element(LDP_IPV6_NODE, &ldp_discovery_transport_address_ipv6_cmd); install_element(LDP_IPV6_NODE, &ldp_label_local_advertise_cmd); @@ -785,11 +813,11 @@ ldp_vty_init (void) install_element(LDP_IPV6_NODE, &ldp_neighbor_ipv6_targeted_cmd); install_element(LDP_IPV6_NODE, &ldp_exit_address_family_cmd); - install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_holdtime_cmd); - install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_interval_cmd); + install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd); + install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd); - install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_holdtime_cmd); - install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_interval_cmd); + install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd); + install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd); install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd); install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd); diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c index e938582d0d..f43370af2b 100644 --- a/ldpd/ldp_vty_conf.c +++ b/ldpd/ldp_vty_conf.c @@ -459,20 +459,13 @@ ldp_vty_address_family(struct vty *vty, const char *negate, const char *af_str) return (CMD_SUCCESS); } -int -ldp_vty_disc_holdtime(struct vty *vty, const char *negate, - const char *hello_type_str, long secs) +int ldp_vty_disc_holdtime(struct vty *vty, const char *negate, + enum hello_type hello_type, long secs) { struct ldpd_af_conf *af_conf; struct iface *iface; struct iface_af *ia; int af; - enum hello_type hello_type; - - if (hello_type_str[0] == 'h') - hello_type = HELLO_LINK; - else - hello_type = HELLO_TARGETED; switch (vty->node) { case LDP_NODE: @@ -547,18 +540,12 @@ ldp_vty_disc_holdtime(struct vty *vty, const char *negate, int ldp_vty_disc_interval(struct vty *vty, const char *negate, - const char *hello_type_str, long secs) + enum hello_type hello_type, long secs) { struct ldpd_af_conf *af_conf; struct iface *iface; struct iface_af *ia; int af; - enum hello_type hello_type; - - if (hello_type_str[0] == 'h') - hello_type = HELLO_LINK; - else - hello_type = HELLO_TARGETED; switch (vty->node) { case LDP_NODE: -- 2.39.5