summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bgpd/bgp_fsm.c18
-rw-r--r--bgpd/bgpd.h10
2 files changed, 21 insertions, 7 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 45e9aad1ba..c2e3d02230 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -662,6 +662,14 @@ static void bgp_graceful_restart_timer_off(struct peer *peer)
UNSET_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT);
BGP_TIMER_OFF(peer->t_gr_stale);
+
+ if (peer_dynamic_neighbor(peer) &&
+ !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
+ if (bgp_debug_neighbor_events(peer))
+ zlog_debug("%s (dynamic neighbor) deleted", peer->host);
+ peer_delete(peer);
+ }
+
bgp_timer_set(peer);
}
@@ -1380,8 +1388,8 @@ int bgp_stop(struct peer *peer)
&& peer->last_reset == PEER_DOWN_UPDATE_SOURCE_CHANGE)
bfd_sess_uninstall(peer->bfd_config->session);
- if (peer_dynamic_neighbor(peer)
- && !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
+ if (peer_dynamic_neighbor_no_nsf(peer) &&
+ !(CHECK_FLAG(peer->flags, PEER_FLAG_DELETE))) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s (dynamic neighbor) deleted", peer->host);
peer_delete(peer);
@@ -1602,7 +1610,7 @@ static int bgp_stop_with_error(struct peer *peer)
if (peer->v_start >= (60 * 2))
peer->v_start = (60 * 2);
- if (peer_dynamic_neighbor(peer)) {
+ if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s (dynamic neighbor) deleted", peer->host);
peer_delete(peer);
@@ -1620,7 +1628,7 @@ static int bgp_stop_with_notify(struct peer *peer, uint8_t code,
/* Send notify to remote peer */
bgp_notify_send(peer, code, sub_code);
- if (peer_dynamic_neighbor(peer)) {
+ if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s (dynamic neighbor) deleted", peer->host);
peer_delete(peer);
@@ -1781,7 +1789,7 @@ static int bgp_connect_success_w_delayopen(struct peer *peer)
/* TCP connect fail */
static int bgp_connect_fail(struct peer *peer)
{
- if (peer_dynamic_neighbor(peer)) {
+ if (peer_dynamic_neighbor_no_nsf(peer)) {
if (bgp_debug_neighbor_events(peer))
zlog_debug("%s (dynamic neighbor) deleted", peer->host);
peer_delete(peer);
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 747c185e39..57d135e781 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -2380,9 +2380,15 @@ static inline bool peer_established(struct peer *peer)
return peer->status == Established;
}
-static inline int peer_dynamic_neighbor(struct peer *peer)
+static inline bool peer_dynamic_neighbor(struct peer *peer)
{
- return (CHECK_FLAG(peer->flags, PEER_FLAG_DYNAMIC_NEIGHBOR)) ? 1 : 0;
+ return CHECK_FLAG(peer->flags, PEER_FLAG_DYNAMIC_NEIGHBOR);
+}
+
+static inline bool peer_dynamic_neighbor_no_nsf(struct peer *peer)
+{
+ return (peer_dynamic_neighbor(peer) &&
+ !CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT));
}
static inline int peer_cap_enhe(struct peer *peer, afi_t afi, safi_t safi)