summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonatas Abraitis <donatas@opensourcerouting.org>2024-07-25 13:06:46 +0300
committerDonatas Abraitis <donatas@opensourcerouting.org>2024-07-25 13:06:46 +0300
commit743b16938455efd44f6e59b42d8800c3881f9889 (patch)
treef643356a60135eda6ae820a6fd2609e6b8051597
parentbd86964db816ba1ac628f1b1f5099fd35f157ea5 (diff)
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>
-rw-r--r--bgpd/bgp_fsm.c1
-rw-r--r--bgpd/bgpd.c2
-rw-r--r--bgpd/bgpd.h1
3 files changed, 4 insertions, 0 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index b67cf3b874..e911c2d18e 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -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,
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index 043a6e201c..a59a9b6b0f 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -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,
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 95ddba4cdd..6e6358bac7 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -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