]> git.puffer.fish Git - matthieu/frr.git/commitdiff
eigrpd: Cleanup eigrp_if_name_string
authorDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 22 Nov 2019 13:03:25 +0000 (08:03 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Fri, 22 Nov 2019 13:36:29 +0000 (08:36 -0500)
This function was excessively complicated.  Simplify and
make everyone use the same access macro.

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

index 583db6622de8569992dcb7f325b66be2f24d7c56..15c7a2063913d99f32f63f038023862af72f9d8b 100644 (file)
@@ -144,13 +144,10 @@ void eigrp_header_dump(struct eigrp_header *eigrph)
 
 const char *eigrp_if_name_string(struct eigrp_interface *ei)
 {
-       static char buf[EIGRP_IF_STRING_MAXLEN] = "";
-
        if (!ei)
                return "inactive";
 
-       snprintf(buf, EIGRP_IF_STRING_MAXLEN, "%s", ei->ifp->name);
-       return buf;
+       return ei->ifp->name;
 }
 
 const char *eigrp_topology_ip_string(struct eigrp_prefix_entry *tn)
@@ -209,7 +206,7 @@ void show_ip_eigrp_interface_header(struct vty *vty, struct eigrp *eigrp)
 void show_ip_eigrp_interface_sub(struct vty *vty, struct eigrp *eigrp,
                                 struct eigrp_interface *ei)
 {
-       vty_out(vty, "%-11s ", eigrp_if_name_string(ei));
+       vty_out(vty, "%-11s ", IF_NAME(ei));
        vty_out(vty, "%-11u", ei->params.bandwidth);
        vty_out(vty, "%-11u", ei->params.delay);
        vty_out(vty, "%-7u", ei->nbrs->count);
@@ -250,7 +247,7 @@ void show_ip_eigrp_neighbor_sub(struct vty *vty, struct eigrp_neighbor *nbr,
 {
 
        vty_out(vty, "%-3u %-17s %-21s", 0, eigrp_neigh_ip_string(nbr),
-               eigrp_if_name_string(nbr->ei));
+               IF_NAME(nbr->ei));
        if (nbr->t_holddown)
                vty_out(vty, "%-7lu",
                        thread_timer_remain_second(nbr->t_holddown));
@@ -313,11 +310,11 @@ void show_ip_eigrp_nexthop_entry(struct vty *vty, struct eigrp *eigrp,
 
        if (te->adv_router == eigrp->neighbor_self)
                vty_out(vty, "%-7s%s, %s\n", " ", "via Connected",
-                       eigrp_if_name_string(te->ei));
+                       IF_NAME(te->ei));
        else {
                vty_out(vty, "%-7s%s%s (%u/%u), %s\n", " ", "via ",
                        inet_ntoa(te->adv_router->src), te->distance,
-                       te->reported_distance, eigrp_if_name_string(te->ei));
+                       te->reported_distance, IF_NAME(te->ei));
        }
 }