diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-06 16:52:52 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-04-06 16:52:52 -0700 |
| commit | 8001b2c0cb6d35bfbc7b7be78d1a8b6d0fafbd53 (patch) | |
| tree | 2491d429727fb9d732d86bfae778068a889d363e /node/NetworkConfig.cpp | |
| parent | a86300c58fe29e9a8626f935f0b3ed25e844b0aa (diff) | |
| download | infinitytier-8001b2c0cb6d35bfbc7b7be78d1a8b6d0fafbd53.tar.gz infinitytier-8001b2c0cb6d35bfbc7b7be78d1a8b6d0fafbd53.zip | |
Network now calls port config function as per new API.
Diffstat (limited to 'node/NetworkConfig.cpp')
| -rw-r--r-- | node/NetworkConfig.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp index e42b0299..ba72a415 100644 --- a/node/NetworkConfig.cpp +++ b/node/NetworkConfig.cpp @@ -125,6 +125,8 @@ void NetworkConfig::_fromDictionary(const Dictionary &d) _private = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_PRIVATE,one).c_str()) != 0); _enableBroadcast = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST,one).c_str()) != 0); _name = d.get(ZT_NETWORKCONFIG_DICT_KEY_NAME); + if (_name.length() > ZT1_MAX_NETWORK_SHORT_NAME_LENGTH) + throw std::invalid_argument("network short name too long (max: 255 characters)"); _description = d.get(ZT_NETWORKCONFIG_DICT_KEY_DESC,std::string()); // In dictionary IPs are split into V4 and V6 addresses, but we don't really @@ -156,6 +158,8 @@ void NetworkConfig::_fromDictionary(const Dictionary &d) } _staticIps.push_back(addr); } + if (_staticIps.size() > ZT1_MAX_ZT_ASSIGNED_ADDRESSES) + throw std::invalid_argument("too many ZT-assigned IP addresses"); std::sort(_staticIps.begin(),_staticIps.end()); std::unique(_staticIps.begin(),_staticIps.end()); |
