Skip to content

Commit 2537340

Browse files
author
Andrii Melnychenko
committed
T7226 Option for disabled LDP hello message during TCP
Added option "disable-establish-hello" that disableds sending additional LDP hello multicast messages during TCP session establishment. This option enables per interface: "(config-ldp-af-if)". Signed-off-by: Andrii Melnychenko <[email protected]>
1 parent f3d9bd9 commit 2537340

File tree

7 files changed

+51
-2
lines changed

7 files changed

+51
-2
lines changed

ldpd/interface.c

+2
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ if_new(const char *name)
6363
iface->ipv4.af = AF_INET;
6464
iface->ipv4.iface = iface;
6565
iface->ipv4.enabled = 0;
66+
iface->ipv4.disable_establish_hello = 0;
6667

6768
/* ipv6 */
6869
iface->ipv6.af = AF_INET6;
6970
iface->ipv6.iface = iface;
7071
iface->ipv6.enabled = 0;
72+
iface->ipv6.disable_establish_hello = 0;
7173

7274
return (iface);
7375
}

ldpd/ldp_vty.h

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ int ldp_vty_allow_broken_lsp(struct vty *, const char *);
2424
int ldp_vty_address_family (struct vty *, const char *, const char *);
2525
int ldp_vty_disc_holdtime(struct vty *, const char *, enum hello_type, long);
2626
int ldp_vty_disc_interval(struct vty *, const char *, enum hello_type, long);
27+
int ldp_vty_disable_establish_hello(struct vty *, const char *);
2728
int ldp_vty_targeted_hello_accept(struct vty *, const char *, const char *);
2829
int ldp_vty_nbr_session_holdtime(struct vty *, const char *, struct in_addr, long);
2930
int ldp_vty_af_session_holdtime(struct vty *, const char *, long);

ldpd/ldp_vty_cmds.c

+11
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,15 @@ DEFPY (ldp_discovery_link_interval,
122122
return (ldp_vty_disc_interval(vty, no, HELLO_LINK, interval));
123123
}
124124

125+
DEFPY (ldp_disable_establish_hello,
126+
ldp_disable_establish_hello_cmd,
127+
"[no] disable-establish-hello",
128+
NO_STR
129+
"Disable sending additional LDP hello message on establishing LDP tcp connection\n")
130+
{
131+
return ldp_vty_disable_establish_hello(vty, no);
132+
}
133+
125134
DEFPY (ldp_discovery_targeted_interval,
126135
ldp_discovery_targeted_interval_cmd,
127136
"[no] discovery targeted-hello interval (1-65535)$interval",
@@ -866,9 +875,11 @@ ldp_vty_init (void)
866875

867876
install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
868877
install_element(LDP_IPV4_IFACE_NODE, &ldp_discovery_link_interval_cmd);
878+
install_element(LDP_IPV4_IFACE_NODE, &ldp_disable_establish_hello_cmd);
869879

870880
install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_holdtime_cmd);
871881
install_element(LDP_IPV6_IFACE_NODE, &ldp_discovery_link_interval_cmd);
882+
install_element(LDP_IPV6_IFACE_NODE, &ldp_disable_establish_hello_cmd);
872883

873884
install_element(LDP_L2VPN_NODE, &ldp_bridge_cmd);
874885
install_element(LDP_L2VPN_NODE, &ldp_mtu_cmd);

ldpd/ldp_vty_conf.c

+32
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ ldp_af_iface_config_write(struct vty *vty, int af)
119119
ia->hello_interval != 0)
120120
vty_out (vty, " discovery hello interval %u\n",
121121
ia->hello_interval);
122+
if (ia->disable_establish_hello)
123+
vty_out (vty, " disable-establish-hello\n");
122124

123125
vty_out (vty, " exit\n");
124126
}
@@ -632,6 +634,36 @@ ldp_vty_disc_interval(struct vty *vty, const char *negate,
632634
return (CMD_SUCCESS);
633635
}
634636

637+
int
638+
ldp_vty_disable_establish_hello(struct vty *vty,
639+
const char *negate)
640+
{
641+
struct iface *iface;
642+
struct iface_af *ia;
643+
int af;
644+
645+
switch (vty->node) {
646+
case LDP_IPV4_IFACE_NODE:
647+
case LDP_IPV6_IFACE_NODE:
648+
af = ldp_vty_get_af(vty);
649+
iface = VTY_GET_CONTEXT(iface);
650+
VTY_CHECK_CONTEXT(iface);
651+
652+
ia = iface_af_get(iface, af);
653+
if (negate)
654+
ia->disable_establish_hello = 0;
655+
else
656+
ia->disable_establish_hello = 1;
657+
658+
ldp_config_apply(vty, vty_conf);
659+
break;
660+
default:
661+
fatalx("ldp_vty_disable_establish_hello: unexpected node");
662+
}
663+
664+
return (CMD_SUCCESS);
665+
}
666+
635667
int
636668
ldp_vty_targeted_hello_accept(struct vty *vty, const char *negate,
637669
const char *acl_from_str)

ldpd/ldpd.c

+1
Original file line numberDiff line numberDiff line change
@@ -1604,6 +1604,7 @@ merge_iface_af(struct iface_af *ia, struct iface_af *xi)
16041604
}
16051605
ia->hello_holdtime = xi->hello_holdtime;
16061606
ia->hello_interval = xi->hello_interval;
1607+
ia->disable_establish_hello = xi->disable_establish_hello;
16071608
}
16081609

16091610
static void

ldpd/ldpd.h

+1
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,7 @@ struct iface_af {
332332
struct event *hello_timer;
333333
uint16_t hello_holdtime;
334334
uint16_t hello_interval;
335+
int disable_establish_hello;
335336
};
336337

337338
struct iface_ldp_sync {

ldpd/neighbor.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -630,8 +630,9 @@ nbr_establish_connection(struct nbr *nbr)
630630
* an adjacency as well.
631631
*/
632632
RB_FOREACH(adj, nbr_adj_head, &nbr->adj_tree)
633-
send_hello(adj->source.type, adj->source.link.ia,
634-
adj->source.target);
633+
if (!adj->source.link.ia->disable_establish_hello)
634+
send_hello(adj->source.type, adj->source.link.ia,
635+
adj->source.target);
635636

636637
if (connect(nbr->fd, &remote_su.sa, sockaddr_len(&remote_su.sa)) == -1) {
637638
if (errno == EINPROGRESS) {

0 commit comments

Comments
 (0)