Skip to content

Commit bdb5f51

Browse files
author
Andrii Melnychenko
committed
T7226 Added FRR patch with option that disables LDP hello
1 parent 1d1105c commit bdb5f51

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
From c50e14ab2d85d0ec4446686a349618c9daed3d35 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 | 30 ++++++++++++++++++++++++++++++
15+
ldpd/ldpd.c | 1 +
16+
ldpd/ldpd.h | 1 +
17+
ldpd/neighbor.c | 5 +++--
18+
7 files changed, 49 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..9a96f0ed3 100644
84+
--- a/ldpd/ldp_vty_conf.c
85+
+++ b/ldpd/ldp_vty_conf.c
86+
@@ -632,6 +632,36 @@ ldp_vty_disc_interval(struct vty *vty, const char *negate,
87+
return (CMD_SUCCESS);
88+
}
89+
90+
+int
91+
+ldp_vty_disable_establish_hello(struct vty *vty,
92+
+ const char *negate)
93+
+{
94+
+ struct iface *iface;
95+
+ struct iface_af *ia;
96+
+ int af;
97+
+
98+
+ switch (vty->node) {
99+
+ case LDP_IPV4_IFACE_NODE:
100+
+ case LDP_IPV6_IFACE_NODE:
101+
+ af = ldp_vty_get_af(vty);
102+
+ iface = VTY_GET_CONTEXT(iface);
103+
+ VTY_CHECK_CONTEXT(iface);
104+
+
105+
+ ia = iface_af_get(iface, af);
106+
+ if (negate)
107+
+ ia->disable_establish_hello = 0;
108+
+ else
109+
+ ia->disable_establish_hello = 1;
110+
+
111+
+ ldp_config_apply(vty, vty_conf);
112+
+ break;
113+
+ default:
114+
+ fatalx("ldp_vty_disable_establish_hello: unexpected node");
115+
+ }
116+
+
117+
+ return (CMD_SUCCESS);
118+
+}
119+
+
120+
int
121+
ldp_vty_targeted_hello_accept(struct vty *vty, const char *negate,
122+
const char *acl_from_str)
123+
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c
124+
index 4d38fdcd0..9a5667c26 100644
125+
--- a/ldpd/ldpd.c
126+
+++ b/ldpd/ldpd.c
127+
@@ -1604,6 +1604,7 @@ merge_iface_af(struct iface_af *ia, struct iface_af *xi)
128+
}
129+
ia->hello_holdtime = xi->hello_holdtime;
130+
ia->hello_interval = xi->hello_interval;
131+
+ ia->disable_establish_hello = xi->disable_establish_hello;
132+
}
133+
134+
static void
135+
diff --git a/ldpd/ldpd.h b/ldpd/ldpd.h
136+
index ad831a6ea..40a1e8c3c 100644
137+
--- a/ldpd/ldpd.h
138+
+++ b/ldpd/ldpd.h
139+
@@ -332,6 +332,7 @@ struct iface_af {
140+
struct event *hello_timer;
141+
uint16_t hello_holdtime;
142+
uint16_t hello_interval;
143+
+ int disable_establish_hello;
144+
};
145+
146+
struct iface_ldp_sync {
147+
diff --git a/ldpd/neighbor.c b/ldpd/neighbor.c
148+
index 2596c7948..b9199f0d9 100644
149+
--- a/ldpd/neighbor.c
150+
+++ b/ldpd/neighbor.c
151+
@@ -630,8 +630,9 @@ nbr_establish_connection(struct nbr *nbr)
152+
* an adjacency as well.
153+
*/
154+
RB_FOREACH(adj, nbr_adj_head, &nbr->adj_tree)
155+
- send_hello(adj->source.type, adj->source.link.ia,
156+
- adj->source.target);
157+
+ if (!adj->source.link.ia->disable_establish_hello)
158+
+ send_hello(adj->source.type, adj->source.link.ia,
159+
+ adj->source.target);
160+
161+
if (connect(nbr->fd, &remote_su.sa, sockaddr_len(&remote_su.sa)) == -1) {
162+
if (errno == EINPROGRESS) {
163+
--
164+
2.43.0
165+

0 commit comments

Comments
 (0)