Merge pull request #14982 from donaldsharp/bgp_suppress_fib_clear_peers

bgpd: Make `suppress-fib-pending` clear peering
This commit is contained in:
Russ White 2023-12-12 14:31:37 -05:00 committed by GitHub
commit c45a9dabe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 78 additions and 36 deletions

View File

@ -562,7 +562,8 @@ void bgp_delayopen_timer(struct event *thread)
}
/* BGP Peer Down Cause */
const char *const peer_down_str[] = {"",
const char *const peer_down_str[] = {
"",
"Router ID changed",
"Remote AS changed",
"Local AS change",
@ -597,7 +598,9 @@ const char *const peer_down_str[] = {"",
"Waiting for peer OPEN",
"Reached received prefix count",
"Socket Error",
"Admin. shutdown (RTT)"};
"Admin. shutdown (RTT)",
"Suppress Fib Turned On or Off",
};
static void bgp_graceful_restart_timer_off(struct peer_connection *connection,
struct peer *peer)

View File

@ -410,6 +410,9 @@ void bgp_router_id_static_set(struct bgp *bgp, struct in_addr id)
void bm_wait_for_fib_set(bool set)
{
bool send_msg = false;
struct bgp *bgp;
struct peer *peer;
struct listnode *next, *node;
if (bm->wait_for_fib == set)
return;
@ -428,12 +431,32 @@ void bm_wait_for_fib_set(bool set)
if (send_msg && zclient)
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
zclient, set);
/*
* If this is configed at a time when peers are already set
* FRR needs to reset the connection(s) as that some installs
* may have already happened in some shape fashion or form
* let's just start over
*/
for (ALL_LIST_ELEMENTS_RO(bm->bgp, next, bgp)) {
for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
if (!BGP_IS_VALID_STATE_FOR_NOTIF(
peer->connection->status))
continue;
peer->last_reset = PEER_DOWN_SUPPRESS_FIB_PENDING;
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
}
/* Set the suppress fib pending for the bgp configuration */
void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
{
bool send_msg = false;
struct peer *peer;
struct listnode *node;
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
return;
@ -465,6 +488,21 @@ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
zclient, set);
}
/*
* If this is configed at a time when peers are already set
* FRR needs to reset the connection as that some installs
* may have already happened in some shape fashion or form
* let's just start over
*/
for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
if (!BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
continue;
peer->last_reset = PEER_DOWN_SUPPRESS_FIB_PENDING;
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
}
}
/* BGP's cluster-id control. */

View File

@ -1757,6 +1757,7 @@ struct peer {
#define PEER_DOWN_PFX_COUNT 33U /* Reached received prefix count */
#define PEER_DOWN_SOCKET_ERROR 34U /* Some socket error happened */
#define PEER_DOWN_RTT_SHUTDOWN 35U /* Automatically shutdown due to RTT */
#define PEER_DOWN_SUPPRESS_FIB_PENDING 36U /* Suppress fib pending changed */
/*
* Remember to update peer_down_str in bgp_fsm.c when you add
* a new value to the last_reset reason