From 770996ff48cf675ea1cc725aa8f6e1cb27536e8a Mon Sep 17 00:00:00 2001 From: mjoras Date: Fri, 4 Aug 2017 21:06:47 +0000 Subject: [PATCH] Selectively print "hwaddr" from ifconfig(8). ifconfig(8) printing the hwaddr is only really useful if it differs from the link layer address. Reported by: jhb Reviewed by: rpokala Approved by: rstone (mentor) Differential Revision: https://reviews.freebsd.org/D11777 --- sbin/ifconfig/af_link.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/sbin/ifconfig/af_link.c b/sbin/ifconfig/af_link.c index 372d2fb59ea7..88f29c380d22 100644 --- a/sbin/ifconfig/af_link.c +++ b/sbin/ifconfig/af_link.c @@ -108,7 +108,15 @@ link_status(int s __unused, const struct ifaddrs *ifa) if (rc != 0) { return; } - if (memcmp(ifr.ifr_addr.sa_data, laggaddr, sdl->sdl_alen) == 0) { + + /* + * If this is definitely a lagg device or the hwaddr + * matches the link addr, don't bother. + */ + if (memcmp(ifr.ifr_addr.sa_data, laggaddr, + sdl->sdl_alen) == 0 || + memcmp(ifr.ifr_addr.sa_data, LLADDR(sdl), + sdl->sdl_alen) == 0) { return; } ether_format = ether_ntoa((const struct ether_addr *)