]> git.puffer.fish Git - mirror/frr.git/commitdiff
eigrpd: Make `show ip eigrp vrf all interfaces` work correctly
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sat, 29 Aug 2020 17:04:46 +0000 (13:04 -0400)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Mon, 31 Aug 2020 18:41:32 +0000 (14:41 -0400)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
eigrpd/eigrp_vty.c

index 9512f03f18fe3d6351a4194e9d438c0161bd3fdc..199cafffd296be82a8e53ebcc6f583491f2c913d 100644 (file)
@@ -212,6 +212,24 @@ DEFPY (show_ip_eigrp_topology,
        return CMD_SUCCESS;
 }
 
+static void eigrp_interface_helper(struct vty *vty, struct eigrp *eigrp,
+                                  const char *ifname, const char *detail)
+{
+       struct eigrp_interface *ei;
+       struct listnode *node;
+
+       if (!ifname)
+               show_ip_eigrp_interface_header(vty, eigrp);
+
+       for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
+               if (!ifname || strcmp(ei->ifp->name, ifname) == 0) {
+                       show_ip_eigrp_interface_sub(vty, eigrp, ei);
+                       if (detail)
+                               show_ip_eigrp_interface_detail(vty, eigrp, ei);
+               }
+       }
+}
+
 DEFPY (show_ip_eigrp_interfaces,
        show_ip_eigrp_interfaces_cmd,
        "show ip eigrp [vrf NAME] interfaces [IFNAME] [detail]$detail",
@@ -223,27 +241,31 @@ DEFPY (show_ip_eigrp_interfaces,
        "Interface name to look at\n"
        "Detailed information\n")
 {
-       struct eigrp_interface *ei;
        struct eigrp *eigrp;
-       struct listnode *node;
 
-       eigrp = eigrp_vty_get_eigrp(vty, vrf);
-       if (eigrp == NULL) {
-               vty_out(vty, "EIGRP Routing Process not enabled\n");
-               return CMD_SUCCESS;
-       }
+       if (vrf && strncmp(vrf, "all", sizeof("all")) == 0) {
+               struct vrf *vrf;
 
-       if (!ifname)
-               show_ip_eigrp_interface_header(vty, eigrp);
+               RB_FOREACH (vrf, vrf_name_head, &vrfs_by_name) {
+                       eigrp = eigrp_lookup(vrf->vrf_id);
+                       if (!eigrp)
+                               continue;
 
-       for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) {
-               if (!ifname || strcmp(ei->ifp->name, ifname) == 0) {
-                       show_ip_eigrp_interface_sub(vty, eigrp, ei);
-                       if (detail)
-                               show_ip_eigrp_interface_detail(vty, eigrp, ei);
+                       vty_out(vty, "VRF %s:\n", vrf->name);
+
+                       eigrp_interface_helper(vty, eigrp, ifname, detail);
+               }
+       } else {
+               eigrp = eigrp_vty_get_eigrp(vty, vrf);
+               if (eigrp == NULL) {
+                       vty_out(vty, "EIGRP Routing Process not enabled\n");
+                       return CMD_SUCCESS;
                }
+
+               eigrp_interface_helper(vty, eigrp, ifname, detail);
        }
 
+
        return CMD_SUCCESS;
 }