summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-09-03 21:55:49 +0200
committerDinesh G Dutt <5016467+ddutt@users.noreply.github.com>2019-09-03 21:55:49 +0200
commit05912a17e6b5b74e0d5e8a7ccd6af1aa9dc35b82 (patch)
treee6c02f5e1d746644e008bb8e599bde110c36fb95
parentMerge pull request #4907 from donaldsharp/ospf_write_q (diff)
downloadfrr-05912a17e6b5b74e0d5e8a7ccd6af1aa9dc35b82.tar.xz
frr-05912a17e6b5b74e0d5e8a7ccd6af1aa9dc35b82.zip
bgpd: Fixes to error message printed for failed peerings
There was a silly bug introduced when the command to show failed sessions was added. A missing "," caused the wrong error message to be printed. Debugging this led down a path that: - Led to discovering one more error message that needed to be added - Providing the error code along with the string in the JSON output to allow programs to key off numbers rather than strings. - Fixing the missing "," - Changing the error message to "Waiting for Peer IPv6 LLA" to make it clear that we're waiting for the link local addr. Signed-off-by: Dinesh G Dutt <5016467+ddutt@users.noreply.github.com>
-rw-r--r--bgpd/bgp_fsm.c7
-rw-r--r--bgpd/bgp_vty.c2
-rw-r--r--bgpd/bgpd.c6
-rw-r--r--bgpd/bgpd.h1
4 files changed, 13 insertions, 3 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 4d395e374..1304a26ca 100644
--- a/bgpd/bgp_fsm.c
+++ b/bgpd/bgp_fsm.c
@@ -552,10 +552,11 @@ const char *peer_down_str[] = {"",
"Intf peering v6only config change",
"BFD down received",
"Interface down",
- "Neighbor address lost"
+ "Neighbor address lost",
"Waiting for NHT",
- "Waiting for Peer IPv6 Addr",
- "Waiting for VRF to be initialized"};
+ "Waiting for Peer IPv6 LLA",
+ "Waiting for VRF to be initialized",
+ "No AFI/SAFI activated for peer"};
static int bgp_graceful_restart_timer_expire(struct thread *thread)
{
diff --git a/bgpd/bgp_vty.c b/bgpd/bgp_vty.c
index 7e7c0ea2d..17bc83ed2 100644
--- a/bgpd/bgp_vty.c
+++ b/bgpd/bgp_vty.c
@@ -7921,6 +7921,8 @@ static void bgp_show_peer_reset(struct vty * vty, struct peer *peer,
}
json_object_string_add(json_peer, "lastResetDueTo",
peer_down_str[(int)peer->last_reset]);
+ json_object_int_add(json_peer, "lastResetCode",
+ peer->last_reset);
} else {
if (peer->last_reset == PEER_DOWN_NOTIFY_SEND
|| peer->last_reset == PEER_DOWN_NOTIFY_RECEIVED) {
diff --git a/bgpd/bgpd.c b/bgpd/bgpd.c
index fed8cd4d8..5b31fbb3a 100644
--- a/bgpd/bgpd.c
+++ b/bgpd/bgpd.c
@@ -1582,6 +1582,12 @@ struct peer *peer_create(union sockunion *su, const char *conf_if,
}
active = peer_active(peer);
+ if (!active) {
+ if (peer->su.sa.sa_family == AF_UNSPEC)
+ peer->last_reset = PEER_DOWN_NBR_ADDR;
+ else
+ peer->last_reset = PEER_DOWN_NOAFI_ACTIVATED;
+ }
/* Last read and reset time set */
peer->readtime = peer->resettime = bgp_clock();
diff --git a/bgpd/bgpd.h b/bgpd/bgpd.h
index 880fceb8f..477c03600 100644
--- a/bgpd/bgpd.h
+++ b/bgpd/bgpd.h
@@ -1197,6 +1197,7 @@ struct peer {
#define PEER_DOWN_WAITING_NHT 27 /* Waiting for NHT to resolve */
#define PEER_DOWN_NBR_ADDR 28 /* Waiting for peer IPv6 IP Addr */
#define PEER_DOWN_VRF_UNINIT 29 /* Associated VRF is not init yet */
+#define PEER_DOWN_NOAFI_ACTIVATED 30 /* No AFI/SAFI activated for peer */
size_t last_reset_cause_size;
uint8_t last_reset_cause[BGP_MAX_PACKET_SIZE];