bgpd: Set the last_reset if we change the password also

```
donatas.net(config-router)# do show ip bgp summary failed

IPv4 Unicast Summary:
BGP router identifier 1.1.1.1, local AS number 65001 VRF default vrf-id 0
BGP table version 0
RIB entries 0, using 0 bytes of memory
Peers 1, using 24 KiB of memory

Neighbor        EstdCnt DropCnt ResetTime Reason
127.0.0.1             2       2  00:02:02 Password config change (GoBGP/3.26.0)

Displayed neighbors 1
Total number of neighbors 1
```

Signed-off-by: Donatas Abraitis <donatas@opensourcerouting.org>
This commit is contained in:
Donatas Abraitis 2024-07-25 13:06:46 +03:00
parent bd86964db8
commit 743b169384
3 changed files with 4 additions and 0 deletions

View File

@ -602,6 +602,7 @@ const char *const peer_down_str[] = {
"Socket Error",
"Admin. shutdown (RTT)",
"Suppress Fib Turned On or Off",
"Password config change",
};
static void bgp_graceful_restart_timer_off(struct peer_connection *connection,

View File

@ -6790,6 +6790,7 @@ int peer_password_set(struct peer *peer, const char *password)
/* Check if handling a regular peer. */
if (!CHECK_FLAG(peer->sflags, PEER_STATUS_GROUP)) {
peer->last_reset = PEER_DOWN_PASSWORD_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(peer->connection->status))
bgp_notify_send(peer->connection, BGP_NOTIFY_CEASE,
@ -6827,6 +6828,7 @@ int peer_password_set(struct peer *peer, const char *password)
XFREE(MTYPE_PEER_PASSWORD, member->password);
member->password = XSTRDUP(MTYPE_PEER_PASSWORD, password);
member->last_reset = PEER_DOWN_PASSWORD_CHANGE;
/* Send notification or reset peer depending on state. */
if (BGP_IS_VALID_STATE_FOR_NOTIF(member->connection->status))
bgp_notify_send(member->connection, BGP_NOTIFY_CEASE,

View File

@ -1819,6 +1819,7 @@ struct peer {
#define PEER_DOWN_SOCKET_ERROR 34U /* Some socket error happened */
#define PEER_DOWN_RTT_SHUTDOWN 35U /* Automatically shutdown due to RTT */
#define PEER_DOWN_SUPPRESS_FIB_PENDING 36U /* Suppress fib pending changed */
#define PEER_DOWN_PASSWORD_CHANGE 37U /* neighbor password command */
/*
* Remember to update peer_down_str in bgp_fsm.c when you add
* a new value to the last_reset reason