From: Renato Westphal Date: Sat, 23 Sep 2017 16:08:12 +0000 (-0300) Subject: ldpd: improve ordering of interfaces on user output X-Git-Tag: frr-4.0-dev~248^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=9e452e5dd18536c3fdec61c769061047af6e32ae;p=mirror%2Ffrr.git ldpd: improve ordering of interfaces on user output 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 --- diff --git a/ldpd/adjacency.c b/ldpd/adjacency.c index 5b0723a008..7e4f0fd78b 100644 --- a/ldpd/adjacency.c +++ b/ldpd/adjacency.c @@ -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)); diff --git a/ldpd/interface.c b/ldpd/interface.c index ac48520f7b..a18019c0c1 100644 --- a/ldpd/interface.c +++ b/ldpd/interface.c @@ -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 * diff --git a/ldpd/l2vpn.c b/ldpd/l2vpn.c index 9bad503b9c..f9f577d564 100644 --- a/ldpd/l2vpn.c +++ b/ldpd/l2vpn.c @@ -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 *