]> git.proxmox.com Git - mirror_frr.git/commitdiff
bgpd: fix output of show bgp vrf all neighbor x.x.x.x
authorDon Slice <dslice@cumulusnetworks.com>
Thu, 25 Jan 2018 16:06:27 +0000 (16:06 +0000)
committerDon Slice <dslice@cumulusnetworks.com>
Tue, 30 Jan 2018 12:30:35 +0000 (12:30 +0000)
Problem reported with output of the command "show bgp vrf all
neighbor x.x.x.x" not limiting the output to that peer in any vrf.
This fix corrects the logic to display by neighbor
(ipv4/ipv6/interface) in any vrf.

Ticket: CM-17377
Signed-off-by: Don Slice <dslice@cumulusnetworks.com>
bgpd/bgp_vty.c

index c98cf9c327d7723e2c1ce22368588b364253b96d..6d03984d1cb6aec72266bfbc4a093144dfecc75d 100644 (file)
@@ -9859,12 +9859,15 @@ static int bgp_show_neighbor(struct vty *vty, struct bgp *bgp,
 }
 
 static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
+                                                enum show_type type,
+                                                const char *ip_str,
                                                 u_char use_json)
 {
        struct listnode *node, *nnode;
        struct bgp *bgp;
+       union sockunion su;
        json_object *json = NULL;
-       int is_first = 1;
+       int ret, is_first = 1;
 
        if (use_json)
                vty_out(vty, "{\n");
@@ -9903,8 +9906,19 @@ static void bgp_show_all_instances_neighbors_vty(struct vty *vty,
                                        ? "Default"
                                        : bgp->name);
                }
-               bgp_show_neighbor(vty, bgp, show_all, NULL, NULL, use_json,
-                                 json);
+
+               if (type == show_peer) {
+                       ret = str2sockunion(ip_str, &su);
+                       if (ret < 0)
+                               bgp_show_neighbor(vty, bgp, type, NULL, ip_str,
+                                                 use_json, json);
+                       else
+                               bgp_show_neighbor(vty, bgp, type, &su, NULL,
+                                                 use_json, json);
+               } else {
+                       bgp_show_neighbor(vty, bgp, show_all, NULL, NULL,
+                                         use_json, json);
+               }
        }
 
        if (use_json)
@@ -9922,7 +9936,8 @@ static int bgp_show_neighbor_vty(struct vty *vty, const char *name,
 
        if (name) {
                if (strmatch(name, "all")) {
-                       bgp_show_all_instances_neighbors_vty(vty, use_json);
+                       bgp_show_all_instances_neighbors_vty(vty, type, ip_str,
+                                                            use_json);
                        return CMD_SUCCESS;
                } else {
                        bgp = bgp_lookup_by_name(name);