Skip to content

Commit e9f9c16

Browse files
authored
Merge pull request #22135 from FRRouting/mergify/bp/stable/10.4/pr-20223
bgpd: Start BFD hold timer ONLY if hold-time is configured (not zero) (backport #20223)
2 parents e48eb66 + ed8692b commit e9f9c16

1 file changed

Lines changed: 13 additions & 4 deletions

File tree

bgpd/bgp_bfd.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ static void bfd_session_status_update(struct bfd_session_params *bsp,
8585
* when the source address is changed, e.g. 0.0.0.0 -> 10.0.0.1.
8686
*/
8787
if (bss->last_event > peer->uptime) {
88-
if (!peer->holdtime) {
88+
if ((CHECK_FLAG(peer->flags, PEER_FLAG_TIMER) && !peer->holdtime) ||
89+
!peer->bgp->default_holdtime) {
8990
event_add_timer(bm->master, bgp_bfd_strict_holdtime_expire, peer,
9091
peer->bfd_config->hold_time,
9192
&peer->bfd_config->t_hold_timer);
@@ -118,8 +119,13 @@ void bgp_peer_config_apply(struct peer *p, struct peer_group *pg)
118119

119120
/* When called on a group, apply to all peers. */
120121
if (CHECK_FLAG(p->sflags, PEER_STATUS_GROUP)) {
121-
for (ALL_LIST_ELEMENTS_RO(p->group->peer, n, pn))
122+
for (ALL_LIST_ELEMENTS_RO(p->group->peer, n, pn)) {
123+
if (peergroup_flag_check(pn, PEER_FLAG_BFD_STRICT))
124+
peer_flag_set(pn, PEER_FLAG_BFD_STRICT);
125+
else
126+
peer_flag_unset(pn, PEER_FLAG_BFD_STRICT);
122127
bgp_peer_config_apply(pn, pg);
128+
}
123129
return;
124130
}
125131

@@ -649,10 +655,13 @@ DEFPY (neighbor_bfd_strict_hold_time,
649655

650656
event_cancel(&peer->bfd_config->t_hold_timer);
651657

652-
if (no)
658+
if (no) {
653659
peer->bfd_config->hold_time = BFD_DEF_STRICT_HOLD_TIME;
654-
else
660+
peer_flag_unset(peer, PEER_FLAG_BFD_STRICT);
661+
} else {
655662
peer->bfd_config->hold_time = hold_time;
663+
peer_flag_set(peer, PEER_FLAG_BFD_STRICT);
664+
}
656665

657666
bgp_peer_config_apply(peer, peer->group);
658667

0 commit comments

Comments
 (0)