]> git.puffer.fish Git - matthieu/frr.git/commitdiff
eigrpd: Abstract display of an individual entry
authorDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 3 Feb 2019 20:47:53 +0000 (15:47 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Sun, 3 Feb 2019 22:45:08 +0000 (17:45 -0500)
Abstract the individual display of a entry in the eigrp
topology table.

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
eigrpd/eigrp_vty.c

index f1de59e0aaeedb0ac839f90a38711ee4e93d3125..a6e03b22b22edd18ee7010feb654bd80c2712bdf 100644 (file)
@@ -455,6 +455,30 @@ DEFUN (no_eigrp_neighbor,
        return CMD_SUCCESS;
 }
 
+static void eigrp_vty_display_prefix_entry(struct vty *vty,
+                                          struct eigrp *eigrp,
+                                          struct eigrp_prefix_entry *pe,
+                                          bool all)
+{
+       bool first = true;
+       struct eigrp_nexthop_entry *te;
+       struct listnode *node;
+
+       for (ALL_LIST_ELEMENTS_RO(pe->entries, node, te)) {
+               if (all
+                   || (((te->flags
+                         & EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)
+                        == EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)
+                       || ((te->flags
+                            & EIGRP_NEXTHOP_ENTRY_FSUCCESSOR_FLAG)
+                           == EIGRP_NEXTHOP_ENTRY_FSUCCESSOR_FLAG))) {
+                       show_ip_eigrp_nexthop_entry(vty, eigrp, te,
+                                                   &first);
+                       first = false;
+               }
+       }
+}
+
 DEFUN (show_ip_eigrp_topology,
        show_ip_eigrp_topology_cmd,
        "show ip eigrp topology [all-links]",
@@ -465,11 +489,8 @@ DEFUN (show_ip_eigrp_topology,
        "Show all links in topology table\n")
 {
        struct eigrp *eigrp;
-       struct listnode *node;
        struct eigrp_prefix_entry *tn;
-       struct eigrp_nexthop_entry *te;
        struct route_node *rn;
-       bool first;
 
        eigrp = eigrp_lookup();
        if (eigrp == NULL) {
@@ -484,20 +505,7 @@ DEFUN (show_ip_eigrp_topology,
                        continue;
 
                tn = rn->info;
-               first = true;
-               for (ALL_LIST_ELEMENTS_RO(tn->entries, node, te)) {
-                       if (argc == 5
-                           || (((te->flags
-                                 & EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)
-                                == EIGRP_NEXTHOP_ENTRY_SUCCESSOR_FLAG)
-                               || ((te->flags
-                                    & EIGRP_NEXTHOP_ENTRY_FSUCCESSOR_FLAG)
-                                   == EIGRP_NEXTHOP_ENTRY_FSUCCESSOR_FLAG))) {
-                               show_ip_eigrp_nexthop_entry(vty, eigrp, te,
-                                                           &first);
-                               first = 0;
-                       }
-               }
+               eigrp_vty_display_prefix_entry(vty, eigrp, tn, argc == 5);
        }
 
        return CMD_SUCCESS;