From: Vincent Bernat Date: Tue, 1 Dec 2015 08:27:34 +0000 (+0100) Subject: interfaces: handle the case where the provided MAC address is incorrect X-Git-Tag: 0.8.0~29 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5ac66d33585b893c27f241cd363bb650b7b612dd;p=thirdparty%2Flldpd.git interfaces: handle the case where the provided MAC address is incorrect Some drivers, like veth are unable to provide an appropriate MAC address. Warn the user, keep the one we have. --- diff --git a/src/daemon/interfaces-linux.c b/src/daemon/interfaces-linux.c index afad6485..733d49fe 100644 --- a/src/daemon/interfaces-linux.c +++ b/src/daemon/interfaces-linux.c @@ -252,6 +252,14 @@ iflinux_get_permanent_mac(struct lldpd *cfg, iface->name); return; } + size_t i; + for (i = 0; i < ETHER_ADDR_LEN; i++) + if (mac[i] != 0) break; + if (i == ETHER_ADDR_LEN) { + log_warnx("interfaces", "driver for %s do not provide a permanent MAC address", + iface->name); + return; + } memcpy(iface->address, mac, ETHER_ADDR_LEN); }