mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-02-20 17:52:46 +00:00
Fix setMtu() on Linux. Add error checking (#1860)
* Fix setMtu() on Linux. Add error checking * Slightly tweak ioctl MTU error message
This commit is contained in:
parent
b88d7091c8
commit
e0a3291235
@ -553,8 +553,11 @@ void LinuxEthernetTap::setMtu(unsigned int mtu)
|
||||
if (sock > 0) {
|
||||
struct ifreq ifr;
|
||||
memset(&ifr,0,sizeof(ifr));
|
||||
strcpy(ifr.ifr_name,_dev.c_str());
|
||||
ifr.ifr_ifru.ifru_mtu = (int)mtu;
|
||||
ioctl(sock,SIOCSIFMTU,(void *)&ifr);
|
||||
if (ioctl(sock,SIOCSIFMTU,(void *)&ifr) < 0) {
|
||||
printf("WARNING: ioctl() failed updating existing Linux tap device (set MTU)\n");
|
||||
}
|
||||
close(sock);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user