mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2024-12-19 13:07:55 +00:00
Likely MAC fix for Linux.
This commit is contained in:
parent
c15890b4db
commit
357e1aca54
@ -205,14 +205,6 @@ LinuxEthernetTap::LinuxEthernetTap(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER;
|
|
||||||
_mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data,6);
|
|
||||||
if (ioctl(sock,SIOCSIFHWADDR,(void *)&ifr) < 0) {
|
|
||||||
::close(sock);
|
|
||||||
printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ifr.ifr_flags |= IFF_MULTICAST;
|
ifr.ifr_flags |= IFF_MULTICAST;
|
||||||
ifr.ifr_flags |= IFF_UP;
|
ifr.ifr_flags |= IFF_UP;
|
||||||
if (ioctl(sock,SIOCSIFFLAGS,(void *)&ifr) < 0) {
|
if (ioctl(sock,SIOCSIFFLAGS,(void *)&ifr) < 0) {
|
||||||
@ -225,7 +217,15 @@ LinuxEthernetTap::LinuxEthernetTap(
|
|||||||
// before they will accept MTU and MAC. For others it doesn't matter, but is
|
// before they will accept MTU and MAC. For others it doesn't matter, but is
|
||||||
// harmless. This was moved to the worker thread though so as not to block the
|
// harmless. This was moved to the worker thread though so as not to block the
|
||||||
// main ZeroTier loop.
|
// main ZeroTier loop.
|
||||||
usleep(500000);
|
usleep(200000);
|
||||||
|
|
||||||
|
ifr.ifr_ifru.ifru_hwaddr.sa_family = ARPHRD_ETHER;
|
||||||
|
_mac.copyTo(ifr.ifr_ifru.ifru_hwaddr.sa_data,6);
|
||||||
|
if (ioctl(sock,SIOCSIFHWADDR,(void *)&ifr) < 0) {
|
||||||
|
::close(sock);
|
||||||
|
printf("WARNING: ioctl() failed setting up Linux tap device (set MAC)\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
ifr.ifr_ifru.ifru_mtu = (int)_mtu;
|
ifr.ifr_ifru.ifru_mtu = (int)_mtu;
|
||||||
if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) {
|
if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user