]> git.puffer.fish Git - mirror/frr.git/commitdiff
ldpd: improve ordering of interfaces on user output
authorRenato Westphal <renato@opensourcerouting.org>
Sat, 23 Sep 2017 16:08:12 +0000 (13:08 -0300)
committerRenato Westphal <renato@opensourcerouting.org>
Fri, 29 Sep 2017 00:50:46 +0000 (21:50 -0300)
Before:

debian# show mpls ldp interface
AF   Interface   State  Uptime   Hello Timers  ac
ipv4 rt0-eth0    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth1    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth10   ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth11   ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth2    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth3    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth4    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth5    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth6    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth7    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth8    ACTIVE 00:00:05 5/15           1
ipv4 rt0-eth9    ACTIVE 00:00:05 5/15           1

After:

debian# show mpls ldp interface
AF   Interface   State  Uptime   Hello Timers  ac
ipv4 rt0-eth0    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth1    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth2    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth3    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth4    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth5    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth6    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth7    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth8    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth9    ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth10   ACTIVE 00:00:14 5/15           1
ipv4 rt0-eth11   ACTIVE 00:00:14 5/15           1

Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
ldpd/adjacency.c
ldpd/interface.c
ldpd/l2vpn.c

index 5b0723a0084c855eed00cc133df1ed0a6e19faae..7e4f0fd78b14b5232f821f07975c977fca1fec5c 100644 (file)
@@ -60,11 +60,11 @@ adj_compare(const struct adj *a, const struct adj *b)
 
        switch (a->source.type) {
        case HELLO_LINK:
-               if (strcmp(a->source.link.ia->iface->name,
-                   b->source.link.ia->iface->name) < 0)
+               if (if_cmp_name_func((char *)a->source.link.ia->iface->name,
+                   (char *)b->source.link.ia->iface->name) < 0)
                        return (-1);
-               if (strcmp(a->source.link.ia->iface->name,
-                   b->source.link.ia->iface->name) > 0)
+               if (if_cmp_name_func((char *)a->source.link.ia->iface->name,
+                   (char *)b->source.link.ia->iface->name) > 0)
                        return (1);
                return (ldp_addrcmp(a->source.link.ia->af,
                    &a->source.link.src_addr, &b->source.link.src_addr));
index ac48520f7bd4710dc2591326d6ccacf33739fbea..a18019c0c152d87ce6faf6d2f21145c7c48fbe70 100644 (file)
@@ -45,7 +45,7 @@ RB_GENERATE(iface_head, iface, entry, iface_compare)
 static __inline int
 iface_compare(const struct iface *a, const struct iface *b)
 {
-       return (strcmp(a->name, b->name));
+       return (if_cmp_name_func((char *)a->name, (char *)b->name));
 }
 
 struct iface *
index 9bad503b9c815f47a4294cdcff48d97394ae69ac..f9f577d564a1ffc84bf1c47bd7718a475b61b2f2 100644 (file)
@@ -114,7 +114,7 @@ l2vpn_exit(struct l2vpn *l2vpn)
 static __inline int
 l2vpn_if_compare(const struct l2vpn_if *a, const struct l2vpn_if *b)
 {
-       return (strcmp(a->ifname, b->ifname));
+       return (if_cmp_name_func((char *)a->ifname, (char *)b->ifname));
 }
 
 struct l2vpn_if *
@@ -177,7 +177,7 @@ l2vpn_if_update(struct l2vpn_if *lif)
 static __inline int
 l2vpn_pw_compare(const struct l2vpn_pw *a, const struct l2vpn_pw *b)
 {
-       return (strcmp(a->ifname, b->ifname));
+       return (if_cmp_name_func((char *)a->ifname, (char *)b->ifname));
 }
 
 struct l2vpn_pw *