diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-05-04 17:12:02 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2017-05-04 17:12:02 -0700 |
| commit | 107e3e41065a816354c3f383736c5abbb156b0d3 (patch) | |
| tree | 5168c6ea1f1f94dd576af7820332861495f82dc5 /node/NetworkConfig.cpp | |
| parent | 6ef247fb93573d1dd86b05ff973da9e4a7576809 (diff) | |
| download | infinitytier-107e3e41065a816354c3f383736c5abbb156b0d3.tar.gz infinitytier-107e3e41065a816354c3f383736c5abbb156b0d3.zip | |
First pass of configurable MTU and max MTU increase.
Diffstat (limited to 'node/NetworkConfig.cpp')
| -rw-r--r-- | node/NetworkConfig.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp index 9effe529..c39f6cab 100644 --- a/node/NetworkConfig.cpp +++ b/node/NetworkConfig.cpp @@ -51,6 +51,7 @@ bool NetworkConfig::toDictionary(Dictionary<ZT_NETWORKCONFIG_DICT_CAPACITY> &d,b if (!d.add(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT,(uint64_t)this->multicastLimit)) return false; if (!d.add(ZT_NETWORKCONFIG_DICT_KEY_TYPE,(uint64_t)this->type)) return false; if (!d.add(ZT_NETWORKCONFIG_DICT_KEY_NAME,this->name)) return false; + if (!d.add(ZT_NETWORKCONFIG_DICT_KEY_MTU,(uint64_t)this->mtu)) return false; #ifdef ZT_SUPPORT_OLD_STYLE_NETCONF if (includeLegacy) { @@ -217,6 +218,12 @@ bool NetworkConfig::fromDictionary(const Dictionary<ZT_NETWORKCONFIG_DICT_CAPACI this->multicastLimit = (unsigned int)d.getUI(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT,0); d.get(ZT_NETWORKCONFIG_DICT_KEY_NAME,this->name,sizeof(this->name)); + this->mtu = (unsigned int)d.getUI(ZT_NETWORKCONFIG_DICT_KEY_MTU,ZT_DEFAULT_MTU); + if (this->mtu < 1280) + this->mtu = 1280; // minimum MTU allowed by IPv6 standard and others + else if (this->mtu > ZT_MAX_MTU) + this->mtu = ZT_MAX_MTU; + if (d.getUI(ZT_NETWORKCONFIG_DICT_KEY_VERSION,0) < 6) { #ifdef ZT_SUPPORT_OLD_STYLE_NETCONF char tmp2[1024]; |
