Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bgpd: Set last reset reason to admin shutdown if it was manually #16242

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
bgpd: Set last reset reason to admin shutdown if it was manually
Before this patch, we always printed the last reason "Waiting for OPEN", but
if it's a manual shutdown, then we technically are not waiting for OPEN.

Signed-off-by: Donatas Abraitis <[email protected]>
ton31337 committed Jun 19, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
addaleax Anna Henningsen
commit c25c7e929d550c2faca3af74a29593b8c0b75db3
14 changes: 13 additions & 1 deletion bgpd/bgpd.c
Original file line number Diff line number Diff line change
@@ -4829,6 +4829,8 @@ void bgp_shutdown_enable(struct bgp *bgp, const char *msg)

/* iterate through peers of BGP instance */
for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
peer->last_reset = PEER_DOWN_USER_SHUTDOWN;

/* continue, if peer is already in administrative shutdown. */
if (CHECK_FLAG(peer->flags, PEER_FLAG_SHUTDOWN))
continue;
@@ -4883,8 +4885,10 @@ void bgp_shutdown_disable(struct bgp *bgp)
/* clear the BGP instances shutdown flag */
UNSET_FLAG(bgp->flags, BGP_FLAG_SHUTDOWN);

for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer))
for (ALL_LIST_ELEMENTS_RO(bgp->peer, node, peer)) {
bgp_timer_set(peer->connection);
peer->last_reset = PEER_DOWN_WAITING_OPEN;
}
}

/* Change specified peer flag. */
@@ -4956,6 +4960,10 @@ static int peer_flag_modify(struct peer *peer, uint64_t flag, int set)
bgp_zebra_terminate_radv(peer->bgp, peer);
}

if (flag == PEER_FLAG_SHUTDOWN)
peer->last_reset = set ? PEER_DOWN_USER_SHUTDOWN
: PEER_DOWN_WAITING_OPEN;

/* Execute flag action on peer. */
if (action.type == peer_change_reset)
peer_flag_modify_action(peer, flag);
@@ -4991,6 +4999,10 @@ static int peer_flag_modify(struct peer *peer, uint64_t flag, int set)
set ? bgp_zebra_initiate_radv(member->bgp, member)
: bgp_zebra_terminate_radv(member->bgp, member);

if (flag == PEER_FLAG_SHUTDOWN)
member->last_reset = set ? PEER_DOWN_USER_SHUTDOWN
: PEER_DOWN_WAITING_OPEN;

/* Execute flag action on peer-group member. */
if (action.type == peer_change_reset)
peer_flag_modify_action(member, flag);