Skip to content

Commit bdb5ae8

Browse files
committed
bgpd: Make suppress-fib-pending clear peering
When a peer has come up and already started installing routes into the rib and `suppress-fib-pending` is either turned on or off. BGP is left with some routes that may need to be withdrawn from peers and routes that it does not know the status of. Clear the BGP peers for the interesting parties and let's let us come up to speed as needed. Signed-off-by: Donald Sharp <[email protected]>
1 parent 315262c commit bdb5ae8

File tree

3 files changed

+78
-36
lines changed

3 files changed

+78
-36
lines changed

bgpd/bgp_fsm.c

Lines changed: 39 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -562,42 +562,45 @@ void bgp_delayopen_timer(struct event *thread)
562562
}
563563

564564
/* BGP Peer Down Cause */
565-
const char *const peer_down_str[] = {"",
566-
"Router ID changed",
567-
"Remote AS changed",
568-
"Local AS change",
569-
"Cluster ID changed",
570-
"Confederation identifier changed",
571-
"Confederation peer changed",
572-
"RR client config change",
573-
"RS client config change",
574-
"Update source change",
575-
"Address family activated",
576-
"Admin. shutdown",
577-
"User reset",
578-
"BGP Notification received",
579-
"BGP Notification send",
580-
"Peer closed the session",
581-
"Neighbor deleted",
582-
"Peer-group add member",
583-
"Peer-group delete member",
584-
"Capability changed",
585-
"Passive config change",
586-
"Multihop config change",
587-
"NSF peer closed the session",
588-
"Intf peering v6only config change",
589-
"BFD down received",
590-
"Interface down",
591-
"Neighbor address lost",
592-
"No path to specified Neighbor",
593-
"Waiting for Peer IPv6 LLA",
594-
"Waiting for VRF to be initialized",
595-
"No AFI/SAFI activated for peer",
596-
"AS Set config change",
597-
"Waiting for peer OPEN",
598-
"Reached received prefix count",
599-
"Socket Error",
600-
"Admin. shutdown (RTT)"};
565+
const char *const peer_down_str[] = {
566+
"",
567+
"Router ID changed",
568+
"Remote AS changed",
569+
"Local AS change",
570+
"Cluster ID changed",
571+
"Confederation identifier changed",
572+
"Confederation peer changed",
573+
"RR client config change",
574+
"RS client config change",
575+
"Update source change",
576+
"Address family activated",
577+
"Admin. shutdown",
578+
"User reset",
579+
"BGP Notification received",
580+
"BGP Notification send",
581+
"Peer closed the session",
582+
"Neighbor deleted",
583+
"Peer-group add member",
584+
"Peer-group delete member",
585+
"Capability changed",
586+
"Passive config change",
587+
"Multihop config change",
588+
"NSF peer closed the session",
589+
"Intf peering v6only config change",
590+
"BFD down received",
591+
"Interface down",
592+
"Neighbor address lost",
593+
"No path to specified Neighbor",
594+
"Waiting for Peer IPv6 LLA",
595+
"Waiting for VRF to be initialized",
596+
"No AFI/SAFI activated for peer",
597+
"AS Set config change",
598+
"Waiting for peer OPEN",
599+
"Reached received prefix count",
600+
"Socket Error",
601+
"Admin. shutdown (RTT)",
602+
"Suppress Fib Turned On or Off",
603+
};
601604

602605
static void bgp_graceful_restart_timer_off(struct peer_connection *connection,
603606
struct peer *peer)

bgpd/bgpd.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,9 @@ void bgp_router_id_static_set(struct bgp *bgp, struct in_addr id)
410410
void bm_wait_for_fib_set(bool set)
411411
{
412412
bool send_msg = false;
413+
struct bgp *bgp;
414+
struct peer *peer;
415+
struct listnode *next, *node;
413416

414417
if (bm->wait_for_fib == set)
415418
return;
@@ -428,12 +431,32 @@ void bm_wait_for_fib_set(bool set)
428431
if (send_msg && zclient)
429432
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
430433
zclient, set);
434+
435+
/*
436+
* If this is configed at a time when peers are already set
437+
* FRR needs to reset the connection(s) as that some installs
438+
* may have already happened in some shape fashion or form
439+
* let's just start over
440+
*/
441+
for (ALL_LIST_ELEMENTS_RO(bm->bgp, next, bgp)) {
442+
for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
443+
if (!BGP_IS_VALID_STATE_FOR_NOTIF(
444+
peer->connection->status))
445+
continue;
446+
447+
peer->last_reset = PEER_DOWN_SUPPRESS_FIB_PENDING;
448+
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
449+
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
450+
}
451+
}
431452
}
432453

433454
/* Set the suppress fib pending for the bgp configuration */
434455
void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
435456
{
436457
bool send_msg = false;
458+
struct peer *peer;
459+
struct listnode *node;
437460

438461
if (bgp->inst_type == BGP_INSTANCE_TYPE_VIEW)
439462
return;
@@ -465,6 +488,21 @@ void bgp_suppress_fib_pending_set(struct bgp *bgp, bool set)
465488
zebra_route_notify_send(ZEBRA_ROUTE_NOTIFY_REQUEST,
466489
zclient, set);
467490
}
491+
492+
/*
493+
* If this is configed at a time when peers are already set
494+
* FRR needs to reset the connection as that some installs
495+
* may have already happened in some shape fashion or form
496+
* let's just start over
497+
*/
498+
for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
499+
if (!BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
500+
continue;
501+
502+
peer->last_reset = PEER_DOWN_SUPPRESS_FIB_PENDING;
503+
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
504+
BGP_NOTIFY_CEASE_CONFIG_CHANGE);
505+
}
468506
}
469507

470508
/* BGP's cluster-id control. */

bgpd/bgpd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1757,6 +1757,7 @@ struct peer {
17571757
#define PEER_DOWN_PFX_COUNT 33U /* Reached received prefix count */
17581758
#define PEER_DOWN_SOCKET_ERROR 34U /* Some socket error happened */
17591759
#define PEER_DOWN_RTT_SHUTDOWN 35U /* Automatically shutdown due to RTT */
1760+
#define PEER_DOWN_SUPPRESS_FIB_PENDING 36U /* Suppress fib pending changed */
17601761
/*
17611762
* Remember to update peer_down_str in bgp_fsm.c when you add
17621763
* a new value to the last_reset reason

0 commit comments

Comments
 (0)