diff options
author | Donald Sharp <sharpd@cumulusnetworks.com> | 2017-10-04 02:19:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-04 02:19:11 +0200 |
commit | c996743b78190935d453c22cea37840e71a0172d (patch) | |
tree | 4f35a9e2f3c2493e5c51c2edb3b33c9ed8e71bb0 /ldpd | |
parent | Merge pull request #1267 from opensourcerouting/ldpd_cli_show (diff) | |
parent | ldpd: detach stdin/stdout/stderr from the child processes (diff) | |
download | frr-c996743b78190935d453c22cea37840e71a0172d.tar.xz frr-c996743b78190935d453c22cea37840e71a0172d.zip |
Merge pull request #1282 from opensourcerouting/ldpd-minor-issues
ldpd minor issues
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/ldp_vty.h | 4 | ||||
-rw-r--r-- | ldpd/ldp_vty_cmds.c | 64 | ||||
-rw-r--r-- | ldpd/ldp_vty_conf.c | 20 | ||||
-rw-r--r-- | ldpd/ldpd.c | 10 |
4 files changed, 60 insertions, 38 deletions
diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h index d73bafe15..5e9df4aaf 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 3d8b4306c..aa2e06dfb 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|targeted-hello>$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|targeted-hello>$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, @@ -797,8 +819,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); @@ -806,8 +830,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); @@ -821,8 +847,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); @@ -835,11 +863,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 e938582d0..76c602afb 100644 --- a/ldpd/ldp_vty_conf.c +++ b/ldpd/ldp_vty_conf.c @@ -233,6 +233,7 @@ ldp_af_config_write(struct vty *vty, int af, struct ldpd_conf *conf, ldp_af_iface_config_write(vty, af); + vty_out(vty, " !\n"); vty_out(vty, " exit-address-family\n"); } @@ -459,20 +460,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 +541,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: diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index d31c57592..a79e63229 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -206,7 +206,7 @@ main(int argc, char *argv[]) frr_preinit(&ldpd_di, argc, argv); frr_opt_add("LEn:", longopts, " --ctl_socket Override ctl socket path\n" - "-n, --instance Instance id\n"); + " -n, --instance Instance id\n"); while (1) { int opt; @@ -435,7 +435,7 @@ static pid_t start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync) { char *argv[3]; - int argc = 0; + int argc = 0, nullfd; pid_t pid; switch (pid = fork()) { @@ -449,6 +449,12 @@ start_child(enum ldpd_process p, char *argv0, int fd_async, int fd_sync) return (pid); } + nullfd = open("/dev/null", O_RDONLY | O_NOCTTY); + dup2(nullfd, 0); + dup2(nullfd, 1); + dup2(nullfd, 2); + close(nullfd); + if (dup2(fd_async, LDPD_FD_ASYNC) == -1) fatal("cannot setup imsg async fd"); if (dup2(fd_sync, LDPD_FD_SYNC) == -1) |