Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 4 Aug 2017 21:06:47 +0000 (UTC)
From:      Matt Joras <mjoras@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r322062 - head/sbin/ifconfig
Message-ID:  <201708042106.v74L6lwo034688@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mjoras
Date: Fri Aug  4 21:06:47 2017
New Revision: 322062
URL: https://svnweb.freebsd.org/changeset/base/322062

Log:
  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

Modified:
  head/sbin/ifconfig/af_link.c

Modified: head/sbin/ifconfig/af_link.c
==============================================================================
--- head/sbin/ifconfig/af_link.c	Fri Aug  4 20:24:23 2017	(r322061)
+++ head/sbin/ifconfig/af_link.c	Fri Aug  4 21:06:47 2017	(r322062)
@@ -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 *)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201708042106.v74L6lwo034688>