diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-08-29 13:14:10 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2020-08-31 14:42:09 -0400 |
| commit | fb41c4f32d3f20eb0c8f18d82e5d1f757be8e7bd (patch) | |
| tree | 34e0190897b190d311bf7bbe279c8b0a0272d144 | |
| parent | b1d26a4003bf660ed1a5e2b1530c674a8c401f5a (diff) | |
eigrpd: make `show ip eigrp vrf all neighbor` work correctly
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
| -rw-r--r-- | eigrpd/eigrp_vty.c | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/eigrpd/eigrp_vty.c b/eigrpd/eigrp_vty.c index 199cafffd2..4426cf67e9 100644 --- a/eigrpd/eigrp_vty.c +++ b/eigrpd/eigrp_vty.c @@ -269,6 +269,26 @@ DEFPY (show_ip_eigrp_interfaces, return CMD_SUCCESS; } +static void eigrp_neighbors_helper(struct vty *vty, struct eigrp *eigrp, + const char *ifname, const char *detail) +{ + struct eigrp_interface *ei; + struct listnode *node, *node2, *nnode2; + struct eigrp_neighbor *nbr; + + show_ip_eigrp_neighbor_header(vty, eigrp); + + for (ALL_LIST_ELEMENTS_RO(eigrp->eiflist, node, ei)) { + if (!ifname || strcmp(ei->ifp->name, ifname) == 0) { + for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) { + if (detail || (nbr->state == EIGRP_NEIGHBOR_UP)) + show_ip_eigrp_neighbor_sub(vty, nbr, + !!detail); + } + } + } +} + DEFPY (show_ip_eigrp_neighbors, show_ip_eigrp_neighbors_cmd, "show ip eigrp [vrf NAME] neighbors [IFNAME] [detail]$detail", @@ -281,26 +301,27 @@ DEFPY (show_ip_eigrp_neighbors, "Detailed Information\n") { struct eigrp *eigrp; - struct eigrp_interface *ei; - struct listnode *node, *node2, *nnode2; - struct eigrp_neighbor *nbr; - 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; - show_ip_eigrp_neighbor_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) { - for (ALL_LIST_ELEMENTS(ei->nbrs, node2, nnode2, nbr)) { - if (detail || (nbr->state == EIGRP_NEIGHBOR_UP)) - show_ip_eigrp_neighbor_sub(vty, nbr, - !!detail); - } + vty_out(vty, "VRF %s:\n", vrf->name); + + eigrp_neighbors_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_neighbors_helper(vty, eigrp, ifname, detail); } return CMD_SUCCESS; |
