Skip to content

Commit

Permalink
bgpd: Show the real reason why the peer is failed
Browse files Browse the repository at this point in the history
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 <donatas.abraitis@gmail.com>
  • Loading branch information
ton31337 committed Mar 2, 2020
1 parent 2b5eda4 commit 4098f79
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,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)
{
Expand Down Expand Up @@ -1431,6 +1432,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;
}

Expand Down
1 change: 1 addition & 0 deletions bgpd/bgpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1213,6 +1213,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
Expand Down

0 comments on commit 4098f79

Please sign in to comment.