changeset 5558:e27177daaf0a draft

link: Only report hardware address changes for active interfaces
author Roy Marples <roy@marples.name>
date Sat, 12 Dec 2020 17:33:26 +0000
parents e65d193a1960
children 301bcad7c710
files src/dhcpcd.c
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/dhcpcd.c	Sat Dec 12 13:12:26 2020 +0000
+++ b/src/dhcpcd.c	Sat Dec 12 17:33:26 2020 +0000
@@ -1285,8 +1285,9 @@
 	}
 
 	if (ifp->hwtype != hwtype) {
-		loginfox("%s: hardware address type changed from %d to %d",
-		    ifp->name, ifp->hwtype, hwtype);
+		if (ifp->active)
+			loginfox("%s: hardware address type changed"
+			    " from %d to %d", ifp->name, ifp->hwtype, hwtype);
 		ifp->hwtype = hwtype;
 	}
 
@@ -1294,8 +1295,12 @@
 	    (hwlen == 0 || memcmp(ifp->hwaddr, hwaddr, hwlen) == 0))
 		return;
 
-	loginfox("%s: new hardware address: %s", ifp->name,
-	    hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf)));
+	if (ifp->active) {
+		loginfox("%s: old hardware address: %s", ifp->name,
+		    hwaddr_ntoa(ifp->hwaddr, ifp->hwlen, buf, sizeof(buf)));
+		loginfox("%s: new hardware address: %s", ifp->name,
+		    hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf)));
+	}
 	ifp->hwlen = hwlen;
 	if (hwaddr != NULL)
 		memcpy(ifp->hwaddr, hwaddr, hwlen);