mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-16 12:06:55 +02:00
Fix feth max MTU sysctl.
This commit is contained in:
parent
5623a0b420
commit
63a44c9268
1 changed files with 11 additions and 0 deletions
|
@ -59,10 +59,13 @@
|
|||
|
||||
static const ZeroTier::MulticastGroup _blindWildcardMulticastGroup(ZeroTier::MAC(0xff),0);
|
||||
|
||||
#define MACOS_FETH_MAX_MTU_SYSCTL "net.link.fake.max_mtu"
|
||||
|
||||
namespace ZeroTier {
|
||||
|
||||
static Mutex globalTapCreateLock;
|
||||
static bool globalTapInitialized = false;
|
||||
static bool fethMaxMtuAdjusted = false;
|
||||
|
||||
MacEthernetTap::MacEthernetTap(
|
||||
const char *homePath,
|
||||
|
@ -102,6 +105,14 @@ MacEthernetTap::MacEthernetTap(
|
|||
|
||||
Mutex::Lock _gl(globalTapCreateLock); // only make one at a time
|
||||
|
||||
if (!fethMaxMtuAdjusted) {
|
||||
fethMaxMtuAdjusted = true;
|
||||
int old_mtu = 0;
|
||||
size_t old_mtu_len = sizeof(old_mtu);
|
||||
int mtu = 10000;
|
||||
sysctlbyname(MACOS_FETH_MAX_MTU_SYSCTL, &old_mtu, &old_mtu_len, &mtu, sizeof(mtu));
|
||||
}
|
||||
|
||||
// Destroy all feth devices on first tap start in case ZeroTier did not exit cleanly last time.
|
||||
// We leave interfaces less than feth100 alone in case something else is messing with feth devices.
|
||||
if (!globalTapInitialized) {
|
||||
|
|
Loading…
Add table
Reference in a new issue