]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: identify passive connections in JSON summary 7548/head
authorVincent Bernat <vincent@bernat.ch>
Tue, 17 Nov 2020 19:29:31 +0000 (20:29 +0100)
committerVincent Bernat <vincent@bernat.ch>
Tue, 17 Nov 2020 19:29:31 +0000 (20:29 +0100)
When using non JSON output, passive connections are marked with:

    BGP state = Active (passive)

However, such an information is not available in JSON output. This
commit adds that. It also adds "Active (NSF passive)" flag, like the
regular output.

Signed-off-by: Vincent Bernat <vincent@bernat.ch>
bgpd/bgp_vty.c

index 40e97078661da04b478646e954101f14b5a266e3..72a01fa99c0cd527cb19652a916e5fa8b013865d 100644 (file)
@@ -10832,6 +10832,14 @@ static int bgp_show_summary(struct vty *vty, struct bgp *bgp, int afi, int safi,
                                                  BGP_FLAG_SHUTDOWN))
                                        json_object_string_add(json_peer, "state",
                                                               "Idle (Admin)");
+                               else if (peer->status == Active
+                                   && CHECK_FLAG(peer->flags, PEER_FLAG_PASSIVE))
+                                       json_object_string_add(json_peer, "state",
+                                                              "Active (passive)");
+                               else if (peer->status == Active
+                                   && CHECK_FLAG(peer->sflags, PEER_STATUS_NSF_WAIT))
+                                       json_object_string_add(json_peer, "state",
+                                                              "Active (NSF passive)");
                                else if (peer->afc_recv[afi][safi])
                                        json_object_string_add(
                                                               json_peer, "state",