|
| 1 | +From 9f0dc1829119ea180c2ee2ebe7dcd847556c6fda Mon Sep 17 00:00:00 2001 |
| 2 | +From: Andrii Melnychenko < [email protected]> |
| 3 | +Date: Mon, 17 Mar 2025 13:25:20 +0100 |
| 4 | +Subject: [PATCH 1/1] T7226 Option for disabled LDP hello message during TCP |
| 5 | + |
| 6 | +Added option "disable-establish-hello" that disableds |
| 7 | +sending additional LDP hello multicast messages during |
| 8 | +TCP session establishment. |
| 9 | +This option enables per interface: "(config-ldp-af-if)". |
| 10 | +--- |
| 11 | + ldpd/interface.c | 2 ++ |
| 12 | + ldpd/ldp_vty.h | 1 + |
| 13 | + ldpd/ldp_vty_cmds.c | 11 +++++++++++ |
| 14 | + ldpd/ldp_vty_conf.c | 32 ++++++++++++++++++++++++++++++++ |
| 15 | + ldpd/ldpd.c | 1 + |
| 16 | + ldpd/ldpd.h | 1 + |
| 17 | + ldpd/neighbor.c | 5 +++-- |
| 18 | + 7 files changed, 51 insertions(+), 2 deletions(-) |
| 19 | + |
| 20 | +diff --git a/ldpd/interface.c b/ldpd/interface.c |
| 21 | +index f0e70cbac..6fccd4af5 100644 |
| 22 | +--- a/ldpd/interface.c |
| 23 | ++++ b/ldpd/interface.c |
| 24 | +@@ -63,11 +63,13 @@ if_new(const char *name) |
| 25 | + iface->ipv4.af = AF_INET; |
| 26 | + iface->ipv4.iface = iface; |
| 27 | + iface->ipv4.enabled = 0; |
| 28 | ++ iface->ipv4.disable_establish_hello = 0; |
| 29 | + |
| 30 | + /* ipv6 */ |
| 31 | + iface->ipv6.af = AF_INET6; |
| 32 | + iface->ipv6.iface = iface; |
| 33 | + iface->ipv6.enabled = 0; |
| 34 | ++ iface->ipv6.disable_establish_hello = 0; |
| 35 | + |
| 36 | + return (iface); |
| 37 | + } |
| 38 | +diff --git a/ldpd/ldp_vty.h b/ldpd/ldp_vty.h |
| 39 | +index 5c83d1c56..196d05c93 100644 |
| 40 | +--- a/ldpd/ldp_vty.h |
| 41 | ++++ b/ldpd/ldp_vty.h |
| 42 | +@@ -24,6 +24,7 @@ int ldp_vty_allow_broken_lsp(struct vty *, const char *); |
| 43 | + int ldp_vty_address_family (struct vty *, const char *, const char *); |
| 44 | + int ldp_vty_disc_holdtime(struct vty *, const char *, enum hello_type, long); |
| 45 | + int ldp_vty_disc_interval(struct vty *, const char *, enum hello_type, long); |
| 46 | ++int ldp_vty_disable_establish_hello(struct vty *, const char *); |
| 47 | + int ldp_vty_targeted_hello_accept(struct vty *, const char *, const char *); |
| 48 | + int ldp_vty_nbr_session_holdtime(struct vty *, const char *, struct in_addr, long); |
| 49 | + int ldp_vty_af_session_holdtime(struct vty *, const char *, long); |
| 50 | +diff --git a/ldpd/ldp_vty_cmds.c b/ldpd/ldp_vty_cmds.c |
| 51 | +index e046ae996..d6c36c35b 100644 |
| 52 | +--- a/ldpd/ldp_vty_cmds.c |
| 53 | ++++ b/ldpd/ldp_vty_cmds.c |
| 54 | +@@ -122,6 +122,15 @@ DEFPY (ldp_discovery_link_interval, |
| 55 | + return (ldp_vty_disc_interval(vty, no, HELLO_LINK, interval)); |
| 56 | + } |
| 57 | + |
| 58 | ++DEFPY (ldp_disable_establish_hello, |
| 59 | ++ ldp_disable_establish_hello_cmd, |
| 60 | ++ "[no] disable-establish-hello", |
| 61 | ++ NO_STR |
| 62 | ++ "Disable sending additional LDP hello message on establishing LDP tcp connection\n") |
| 63 | ++{ |
| 64 | ++ return ldp_vty_disable_establish_hello(vty, no); |
| 65 | ++} |
| 66 | ++ |
| 67 | + DEFPY (ldp_discovery_targeted_interval, |
| 68 | + ldp_discovery_targeted_interval_cmd, |
| 69 | + "[no] discovery targeted-hello interval (1-65535)$interval", |
| 70 | +@@ -866,9 +875,11 @@ ldp_vty_init (void) |
| 71 | + |
| 72 | + install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd); |
| 73 | + install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd); |
| 74 | ++ install_element(LDP_IPV4_IFACE_NODE, &ldp_disable_establish_hello_cmd); |
| 75 | + |
| 76 | + install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd); |
| 77 | + install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd); |
| 78 | ++ install_element(LDP_IPV6_IFACE_NODE, &ldp_disable_establish_hello_cmd); |
| 79 | + |
| 80 | + install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd); |
| 81 | + install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd); |
| 82 | +diff --git a/ldpd/ldp_vty_conf.c b/ldpd/ldp_vty_conf.c |
| 83 | +index ffff67683..56ad071c8 100644 |
| 84 | +--- a/ldpd/ldp_vty_conf.c |
| 85 | ++++ b/ldpd/ldp_vty_conf.c |
| 86 | +@@ -119,6 +119,8 @@ ldp_af_iface_config_write(struct vty *vty, int af) |
| 87 | + ia->hello_interval != 0) |
| 88 | + vty_out (vty, " discovery hello interval %u\n", |
| 89 | + ia->hello_interval); |
| 90 | ++ if (ia->disable_establish_hello) |
| 91 | ++ vty_out (vty, " disable-establish-hello\n"); |
| 92 | + |
| 93 | + vty_out (vty, " exit\n"); |
| 94 | + } |
| 95 | +@@ -632,6 +634,36 @@ ldp_vty_disc_interval(struct vty *vty, const char *negate, |
| 96 | + return (CMD_SUCCESS); |
| 97 | + } |
| 98 | + |
| 99 | ++int |
| 100 | ++ldp_vty_disable_establish_hello(struct vty *vty, |
| 101 | ++ const char *negate) |
| 102 | ++{ |
| 103 | ++ struct iface *iface; |
| 104 | ++ struct iface_af *ia; |
| 105 | ++ int af; |
| 106 | ++ |
| 107 | ++ switch (vty->node) { |
| 108 | ++ case LDP_IPV4_IFACE_NODE: |
| 109 | ++ case LDP_IPV6_IFACE_NODE: |
| 110 | ++ af = ldp_vty_get_af(vty); |
| 111 | ++ iface = VTY_GET_CONTEXT(iface); |
| 112 | ++ VTY_CHECK_CONTEXT(iface); |
| 113 | ++ |
| 114 | ++ ia = iface_af_get(iface, af); |
| 115 | ++ if (negate) |
| 116 | ++ ia->disable_establish_hello = 0; |
| 117 | ++ else |
| 118 | ++ ia->disable_establish_hello = 1; |
| 119 | ++ |
| 120 | ++ ldp_config_apply(vty, vty_conf); |
| 121 | ++ break; |
| 122 | ++ default: |
| 123 | ++ fatalx("ldp_vty_disable_establish_hello: unexpected node"); |
| 124 | ++ } |
| 125 | ++ |
| 126 | ++ return (CMD_SUCCESS); |
| 127 | ++} |
| 128 | ++ |
| 129 | + int |
| 130 | + ldp_vty_targeted_hello_accept(struct vty *vty, const char *negate, |
| 131 | + const char *acl_from_str) |
| 132 | +diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c |
| 133 | +index 4d38fdcd0..9a5667c26 100644 |
| 134 | +--- a/ldpd/ldpd.c |
| 135 | ++++ b/ldpd/ldpd.c |
| 136 | +@@ -1604,6 +1604,7 @@ merge_iface_af(struct iface_af *ia, struct iface_af *xi) |
| 137 | + } |
| 138 | + ia->hello_holdtime = xi->hello_holdtime; |
| 139 | + ia->hello_interval = xi->hello_interval; |
| 140 | ++ ia->disable_establish_hello = xi->disable_establish_hello; |
| 141 | + } |
| 142 | + |
| 143 | + static void |
| 144 | +diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h |
| 145 | +index ad831a6ea..40a1e8c3c 100644 |
| 146 | +--- a/ldpd/ldpd.h |
| 147 | ++++ b/ldpd/ldpd.h |
| 148 | +@@ -332,6 +332,7 @@ struct iface_af { |
| 149 | + struct event *hello_timer; |
| 150 | + uint16_t hello_holdtime; |
| 151 | + uint16_t hello_interval; |
| 152 | ++ int disable_establish_hello; |
| 153 | + }; |
| 154 | + |
| 155 | + struct iface_ldp_sync { |
| 156 | +diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c |
| 157 | +index 2596c7948..b9199f0d9 100644 |
| 158 | +--- a/ldpd/neighbor.c |
| 159 | ++++ b/ldpd/neighbor.c |
| 160 | +@@ -630,8 +630,9 @@ nbr_establish_connection(struct nbr *nbr) |
| 161 | + * an adjacency as well. |
| 162 | + */ |
| 163 | + RB_FOREACH(adj, nbr_adj_head, &nbr->adj_tree) |
| 164 | +- send_hello(adj->source.type, adj->source.link.ia, |
| 165 | +- adj->source.target); |
| 166 | ++ if (!adj->source.link.ia->disable_establish_hello) |
| 167 | ++ send_hello(adj->source.type, adj->source.link.ia, |
| 168 | ++ adj->source.target); |
| 169 | + |
| 170 | + if (connect(nbr->fd, &remote_su.sa, sockaddr_len(&remote_su.sa)) == -1) { |
| 171 | + if (errno == EINPROGRESS) { |
| 172 | +-- |
| 173 | +2.43.0 |
| 174 | + |
0 commit comments