From 5ac66d33585b893c27f241cd363bb650b7b612dd Mon Sep 17 00:00:00 2001 From: Vincent Bernat Date: Tue, 1 Dec 2015 09:27:34 +0100 Subject: [PATCH] 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. --- src/daemon/interfaces-linux.c | 8 ++++++++ 1 file changed, 8 insertions(+) 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); } -- 2.39.5