forked from Mirror/frr
bgpd: Do not start BGP session if BFD profile is in shutdown state
If we do: ``` bfd profile foo shutdown ``` The session is dropped, but immediately established again because we don't have a proper check on BFD. If BFD is administratively shutdown, ignore starting the session. Fixes: https://github.com/FRRouting/frr/issues/16186 Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
parent
ae1f3a4851
commit
1fb48f5d13
|
@ -4507,6 +4507,12 @@ bool peer_active(struct peer *peer)
|
||||||
{
|
{
|
||||||
if (BGP_CONNECTION_SU_UNSPEC(peer->connection))
|
if (BGP_CONNECTION_SU_UNSPEC(peer->connection))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (peer->bfd_config) {
|
||||||
|
if (bfd_session_is_down(peer->bfd_config->session))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (peer->afc[AFI_IP][SAFI_UNICAST] || peer->afc[AFI_IP][SAFI_MULTICAST]
|
if (peer->afc[AFI_IP][SAFI_UNICAST] || peer->afc[AFI_IP][SAFI_MULTICAST]
|
||||||
|| peer->afc[AFI_IP][SAFI_LABELED_UNICAST]
|
|| peer->afc[AFI_IP][SAFI_LABELED_UNICAST]
|
||||||
|| peer->afc[AFI_IP][SAFI_MPLS_VPN] || peer->afc[AFI_IP][SAFI_ENCAP]
|
|| peer->afc[AFI_IP][SAFI_MPLS_VPN] || peer->afc[AFI_IP][SAFI_ENCAP]
|
||||||
|
|
|
@ -1334,3 +1334,9 @@ int bfd_nht_update(const struct prefix *match, const struct zapi_route *route)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool bfd_session_is_down(const struct bfd_session_params *session)
|
||||||
|
{
|
||||||
|
return session->bss.state == BSS_DOWN ||
|
||||||
|
session->bss.state == BSS_ADMIN_DOWN;
|
||||||
|
}
|
||||||
|
|
|
@ -464,6 +464,8 @@ extern bool bfd_protocol_integration_shutting_down(void);
|
||||||
extern int bfd_nht_update(const struct prefix *match,
|
extern int bfd_nht_update(const struct prefix *match,
|
||||||
const struct zapi_route *route);
|
const struct zapi_route *route);
|
||||||
|
|
||||||
|
extern bool bfd_session_is_down(const struct bfd_session_params *session);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue