Commit d3d86fc666 for frr
commit d3d86fc666f64d5fb117dbfa049afb047b1444e6
Author: Manpreet Kaur <manpreetk@nvidia.com>
Date: Wed Oct 21 16:00:39 2026 +0530
bgpd: remove stale peer when deleting peer-group membership
Removing a neighbor from a peer-group deletes its configured peer but
leaves an accepted connection in OpenConfirm running. A delayed
KEEPALIVE can establish this detached peer and leave an unconfigured
session alive.
Notify and delete the accepted peer along with the configured peer,
matching the other neighbor removal paths.
Signed-off-by: Manpreet Kaur <manpreetk@nvidia.com>
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index f42134670a..89c5ea98a9 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -6317,7 +6317,7 @@ DEFUN (no_neighbor_set_peer_group,
int idx_peer = 2;
int idx_word = 4;
int ret;
- struct peer *peer;
+ struct peer *peer, *other;
struct peer_group *group;
peer = peer_lookup_vty(vty, argv[idx_peer]->arg);
@@ -6333,8 +6333,13 @@ DEFUN (no_neighbor_set_peer_group,
if (CHECK_FLAG(peer->flags, PEER_FLAG_CAPABILITY_ENHE))
bgp_zebra_terminate_radv(peer->bgp, peer);
+ other = peer->doppelganger;
peer_notify_unconfig(peer->connection);
ret = peer_delete(peer);
+ if (other && other->connection->status != Deleted) {
+ peer_notify_unconfig(other->connection);
+ peer_delete(other);
+ }
/*
* if need stop listening