#include <sys/socket.h>
#include <sys/capability.h>
#include <sys/syscall.h>
+#include <sys/random.h>
#include "micoforia.lsg.h"
c->num_ifspecs = 1;
c->ifspec = xmalloc(sizeof(struct ifspec));
c->ifspec[0].bridge = xstrdup(br);
- memset(c->ifspec[0].hwaddr, 0, 6);
- continue;
+ if (getrandom(c->ifspec[0].hwaddr, 6, 0) < 0)
+ WARNING_LOG("%s: getrandom error: %m\n", c->name);
}
}
}
struct nlmsghdr *nlh;
struct ifinfomsg *ifm;
bool success;
- const uint8_t zero[6] = {0};
char pretty_hwaddr[18];
- if (!memcmp(hwaddr, zero, 6))
- return true; /* no hwaddr specified, nothing to do */
pretty_print_hwaddr(hwaddr, pretty_hwaddr);
INFO_LOG("hardware address of %s: %s\n", iface, pretty_hwaddr);
if (!(nl = get_and_bind_netlink_socket()))