aboutgitcodebugslistschat
path: root/conf.c
diff options
context:
space:
mode:
Diffstat (limited to 'conf.c')
-rw-r--r--conf.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/conf.c b/conf.c
index 9e0318a..3f30725 100644
--- a/conf.c
+++ b/conf.c
@@ -625,14 +625,16 @@ static unsigned int conf_ip4(unsigned int ifi,
int rc = nl_link_get_mac(nl_sock, ifi, mac);
if (rc < 0) {
char ifname[IFNAMSIZ];
- err("Couldn't discover MAC for %s: %s",
+ err("Couldn't discover MAC address for %s: %s",
if_indextoname(ifi, ifname), strerror(-rc));
return 0;
}
+
+ if (MAC_IS_ZERO(mac))
+ memcpy(mac, MAC_LAA, ETH_ALEN);
}
- if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr) ||
- MAC_IS_ZERO(mac))
+ if (IN4_IS_ADDR_UNSPECIFIED(&ip4->addr))
return 0;
return ifi;
@@ -684,15 +686,17 @@ static unsigned int conf_ip6(unsigned int ifi,
rc = nl_link_get_mac(nl_sock, ifi, mac);
if (rc < 0) {
char ifname[IFNAMSIZ];
- err("Couldn't discover MAC for %s: %s",
+ err("Couldn't discover MAC address for %s: %s",
if_indextoname(ifi, ifname), strerror(-rc));
return 0;
}
+
+ if (MAC_IS_ZERO(mac))
+ memcpy(mac, MAC_LAA, ETH_ALEN);
}
if (IN6_IS_ADDR_UNSPECIFIED(&ip6->addr) ||
- IN6_IS_ADDR_UNSPECIFIED(&ip6->addr_ll) ||
- MAC_IS_ZERO(mac))
+ IN6_IS_ADDR_UNSPECIFIED(&ip6->addr_ll))
return 0;
return ifi;