summaryrefslogtreecommitdiff
path: root/node/NetworkConfig.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'node/NetworkConfig.cpp')
-rw-r--r--node/NetworkConfig.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp
index 5ca432ba..391d83ca 100644
--- a/node/NetworkConfig.cpp
+++ b/node/NetworkConfig.cpp
@@ -52,9 +52,8 @@ NetworkConfig NetworkConfig::createTestNetworkConfig(const Address &self)
nc._revision = 1;
nc._issuedTo = self;
nc._multicastLimit = ZT_MULTICAST_DEFAULT_LIMIT;
- nc._allowPassiveBridging = false;
+ nc._flags = ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST;
nc._type = ZT_NETWORK_TYPE_PUBLIC;
- nc._enableBroadcast = true;
nc._rules[nc._ruleCount].ruleNo = 1;
nc._rules[nc._ruleCount].matches = (uint8_t)ZT_NETWORK_RULE_MATCHES_ALL;
@@ -82,11 +81,11 @@ NetworkConfig NetworkConfig::createTestNetworkConfig(const Address &self)
void NetworkConfig::fromDictionary(const char *ds,unsigned int dslen)
{
- Dictionary d(ds,dslen);
-
static const std::string zero("0");
static const std::string one("1");
+ Dictionary d(ds,dslen);
+
memset(this,0,sizeof(NetworkConfig));
// NOTE: d.get(name) throws if not found, d.get(name,default) returns default
@@ -102,8 +101,9 @@ void NetworkConfig::fromDictionary(const char *ds,unsigned int dslen)
_multicastLimit = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT,zero).c_str());
if (_multicastLimit == 0) _multicastLimit = ZT_MULTICAST_DEFAULT_LIMIT;
- _allowPassiveBridging = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ALLOW_PASSIVE_BRIDGING,zero).c_str()) != 0);
- _enableBroadcast = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST,one).c_str()) != 0);
+ _flags |= ((Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ALLOW_PASSIVE_BRIDGING,zero).c_str()) != 0) ? ZT_NETWORKCONFIG_FLAG_ALLOW_PASSIVE_BRIDGING : 0);
+ _flags |= ((Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ENABLE_BROADCAST,one).c_str()) != 0) ? ZT_NETWORKCONFIG_FLAG_ENABLE_BROADCAST : 0);
+
_type = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_PRIVATE,one).c_str()) != 0) ? ZT_NETWORK_TYPE_PRIVATE : ZT_NETWORK_TYPE_PUBLIC;
std::string nametmp(d.get(ZT_NETWORKCONFIG_DICT_KEY_NAME,""));