From: Donatas Abraitis Date: Fri, 14 Feb 2020 21:21:55 +0000 (+0200) Subject: bgpd: Show the real reason why the peer is failed X-Git-Tag: base_7.4~346^2 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=07d1e5d99d80979f5892ce87a208a6f171298c44;p=matthieu%2Ffrr.git bgpd: Show the real reason why the peer is failed If the peer was shutdown locally, it doesn't show up as admin. shutdown. Instead it's treated as "Waiting for peer OPEN". The same applies to when the peer reaches maximum-prefix count. Signed-off-by: Donatas Abraitis --- diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index e0a9e3e4f0..b483d39bba 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -578,7 +578,8 @@ const char *const peer_down_str[] = {"", "Waiting for VRF to be initialized", "No AFI/SAFI activated for peer", "AS Set config change", - "Waiting for peer OPEN"}; + "Waiting for peer OPEN", + "Reached received prefix count"}; static int bgp_graceful_restart_timer_expire(struct thread *thread) { @@ -1512,6 +1513,10 @@ int bgp_start(struct peer *peer) "%s [FSM] Trying to start suppressed peer" " - this is never supposed to happen!", peer->host); + if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN)) + peer->last_reset = PEER_DOWN_USER_SHUTDOWN; + else if (CHECK_FLAG(peer->sflags, PEER_STATUS_PREFIX_OVERFLOW)) + peer->last_reset = PEER_DOWN_PFX_COUNT; return -1; } diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h index d47ae71582..8fe58f33b7 100644 --- a/bgpd/bgpd.h +++ b/bgpd/bgpd.h @@ -1351,6 +1351,7 @@ struct peer { #define PEER_DOWN_NOAFI_ACTIVATED 30 /* No AFI/SAFI activated for peer */ #define PEER_DOWN_AS_SETS_REJECT 31 /* Reject routes with AS_SET */ #define PEER_DOWN_WAITING_OPEN 32 /* Waiting for open to succeed */ +#define PEER_DOWN_PFX_COUNT 33 /* Reached received prefix count */ /* * Remember to update peer_down_str in bgp_fsm.c when you add * a new value to the last_reset reason