From 16974ec1726d93508bdfa7a6046d4795510f981a Mon Sep 17 00:00:00 2001 From: Borg Date: Sat, 28 Jun 2014 14:33:07 +0200 Subject: [PATCH] Get MAC of TAP device. This fixes initial communication problems since mymac is NOT properly initialized. --- src/linux/device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/linux/device.c b/src/linux/device.c index 66e790a..8d042d2 100644 --- a/src/linux/device.c +++ b/src/linux/device.c @@ -134,6 +134,9 @@ static bool setup_device(void) { iface = xstrdup(strrchr(device, '/') ? strrchr(device, '/') + 1 : device); } + if(overwrite_mac && !ioctl(device_fd, SIOCGIFHWADDR, &ifr)) + memcpy(mymac.x, ifr.ifr_hwaddr.sa_data, ETH_ALEN); + logger(LOG_INFO, "%s is a %s", device, device_info); return true; -- 2.25.1