comparison src/dhcpcd.c @ 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
comparison
equal deleted inserted replaced
5557:e65d193a1960 5558:e27177daaf0a
1283 logerr("%s: %s", __func__, ifp->name); 1283 logerr("%s: %s", __func__, ifp->name);
1284 return; 1284 return;
1285 } 1285 }
1286 1286
1287 if (ifp->hwtype != hwtype) { 1287 if (ifp->hwtype != hwtype) {
1288 loginfox("%s: hardware address type changed from %d to %d", 1288 if (ifp->active)
1289 ifp->name, ifp->hwtype, hwtype); 1289 loginfox("%s: hardware address type changed"
1290 " from %d to %d", ifp->name, ifp->hwtype, hwtype);
1290 ifp->hwtype = hwtype; 1291 ifp->hwtype = hwtype;
1291 } 1292 }
1292 1293
1293 if (ifp->hwlen == hwlen && 1294 if (ifp->hwlen == hwlen &&
1294 (hwlen == 0 || memcmp(ifp->hwaddr, hwaddr, hwlen) == 0)) 1295 (hwlen == 0 || memcmp(ifp->hwaddr, hwaddr, hwlen) == 0))
1295 return; 1296 return;
1296 1297
1297 loginfox("%s: new hardware address: %s", ifp->name, 1298 if (ifp->active) {
1298 hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf))); 1299 loginfox("%s: old hardware address: %s", ifp->name,
1300 hwaddr_ntoa(ifp->hwaddr, ifp->hwlen, buf, sizeof(buf)));
1301 loginfox("%s: new hardware address: %s", ifp->name,
1302 hwaddr_ntoa(hwaddr, hwlen, buf, sizeof(buf)));
1303 }
1299 ifp->hwlen = hwlen; 1304 ifp->hwlen = hwlen;
1300 if (hwaddr != NULL) 1305 if (hwaddr != NULL)
1301 memcpy(ifp->hwaddr, hwaddr, hwlen); 1306 memcpy(ifp->hwaddr, hwaddr, hwlen);
1302 } 1307 }
1303 1308