mirror of
https://github.com/ZeroTier/ZeroTierOne
synced 2025-08-22 22:33:58 -07:00
Fix setMtu() on Linux. Add error checking
This commit is contained in:
parent
b88d7091c8
commit
5773c1c758
1 changed files with 4 additions and 1 deletions
|
@ -553,8 +553,11 @@ void LinuxEthernetTap::setMtu(unsigned int mtu)
|
||||||
if (sock > 0) {
|
if (sock > 0) {
|
||||||
struct ifreq ifr;
|
struct ifreq ifr;
|
||||||
memset(&ifr,0,sizeof(ifr));
|
memset(&ifr,0,sizeof(ifr));
|
||||||
|
strcpy(ifr.ifr_name,_dev.c_str());
|
||||||
ifr.ifr_ifru.ifru_mtu = (int)mtu;
|
ifr.ifr_ifru.ifru_mtu = (int)mtu;
|
||||||
ioctl(sock,SIOCSIFMTU,(void *)&ifr);
|
if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) {
|
||||||
|
printf("WARNING: ioctl() failed setting up Linux tap device (set MTU)\n");
|
||||||
|
}
|
||||||
close(sock);
|
close(sock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue