summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdam Ierymenko <adam.ierymenko@gmail.com>2014-09-24 09:01:58 -0700
committerAdam Ierymenko <adam.ierymenko@gmail.com>2014-09-24 09:01:58 -0700
commit9180a309862f1d2abb946381b5b92a823913d425 (patch)
tree1846da0b6d9656ff89d5c54707a44369453f0931
parent61d0f27d2aa5700bd39e91cec84b8c1ba04c08a5 (diff)
downloadinfinitytier-9180a309862f1d2abb946381b5b92a823913d425.tar.gz
infinitytier-9180a309862f1d2abb946381b5b92a823913d425.zip
.
-rw-r--r--node/IncomingPacket.cpp (renamed from node/PacketDecoder.cpp)0
-rw-r--r--node/IncomingPacket.hpp (renamed from node/PacketDecoder.hpp)0
-rw-r--r--node/MulticastTopology.cpp2
-rw-r--r--node/MulticastTopology.hpp2
-rw-r--r--node/Network.cpp4
-rw-r--r--node/Network.hpp6
-rw-r--r--node/NetworkConfig.cpp10
-rw-r--r--node/NetworkConfig.hpp9
-rw-r--r--objects.mk2
9 files changed, 17 insertions, 18 deletions
diff --git a/node/PacketDecoder.cpp b/node/IncomingPacket.cpp
index 336d0646..336d0646 100644
--- a/node/PacketDecoder.cpp
+++ b/node/IncomingPacket.cpp
diff --git a/node/PacketDecoder.hpp b/node/IncomingPacket.hpp
index 971b61b8..971b61b8 100644
--- a/node/PacketDecoder.hpp
+++ b/node/IncomingPacket.hpp
diff --git a/node/MulticastTopology.cpp b/node/MulticastTopology.cpp
index ee6f7954..e4b1066d 100644
--- a/node/MulticastTopology.cpp
+++ b/node/MulticastTopology.cpp
@@ -72,7 +72,7 @@ void MulticastTopology::erase(const MulticastGroup &mg,const Address &member)
}
}
-unsigned int MulticastTopology::want(const MulticastGroup &mg,uint64_t now,unsigned int limit,bool updateLastGatheredTimeOnNonzeroReturn)
+unsigned int MulticastTopology::shouldGather(const MulticastGroup &mg,uint64_t now,unsigned int limit,bool updateLastGatheredTimeOnNonzeroReturn)
{
Mutex::Lock _l(_groups_m);
MulticastGroupStatus &gs = _groups[mg];
diff --git a/node/MulticastTopology.hpp b/node/MulticastTopology.hpp
index 17013fc1..8a68f2b2 100644
--- a/node/MulticastTopology.hpp
+++ b/node/MulticastTopology.hpp
@@ -112,7 +112,7 @@ public:
* @param limit The maximum number we want per multicast group on this network
* @param updateLastGatheredTimeOnNonzeroReturn If true, reset group's last gathered time to 'now' on non-zero return
*/
- unsigned int want(const MulticastGroup &mg,uint64_t now,unsigned int limit,bool updateLastGatheredTimeOnNonzeroReturn);
+ unsigned int shouldGather(const MulticastGroup &mg,uint64_t now,unsigned int limit,bool updateLastGatheredTimeOnNonzeroReturn);
/**
* Update last gathered members time for a group
diff --git a/node/Network.cpp b/node/Network.cpp
index d5b04230..8b97562f 100644
--- a/node/Network.cpp
+++ b/node/Network.cpp
@@ -281,14 +281,13 @@ bool Network::isAllowed(const Address &peer) const
void Network::clean()
{
+ uint64_t now = Utils::now();
{
Mutex::Lock _l(_lock);
if (_destroyed)
return;
- uint64_t now = Utils::now();
-
if ((_config)&&(_config->isPublic())) {
// Open (public) networks do not track certs or cert pushes at all.
_membershipCertificates.clear();
@@ -318,7 +317,6 @@ void Network::clean()
else ++mg;
}
}
-
{
_multicastTopology.clean(now,*(_r->topology),(_config) ? _config->multicastLimit() : (unsigned int)ZT_DEFAULT_MULTICAST_LIMIT);
}
diff --git a/node/Network.hpp b/node/Network.hpp
index 3f0b6eb8..b0af08c7 100644
--- a/node/Network.hpp
+++ b/node/Network.hpp
@@ -414,6 +414,12 @@ public:
void setEnabled(bool enabled);
/**
+ * @return Multicast topology for this network
+ */
+ inline MulticastTopology &mcTopology() { return _multicastTopology; }
+ inline const MulticastTopology &mcTopology() const { return _multicastTopology; }
+
+ /**
* Destroy this network
*
* This causes the network to disable itself, destroy its tap device, and on
diff --git a/node/NetworkConfig.cpp b/node/NetworkConfig.cpp
index c78dd995..8b85cd87 100644
--- a/node/NetworkConfig.cpp
+++ b/node/NetworkConfig.cpp
@@ -85,18 +85,16 @@ void NetworkConfig::_fromDictionary(const Dictionary &d)
_timestamp = Utils::hexStrToU64(d.get(ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP).c_str());
_issuedTo = Address(d.get(ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO));
- _multicastPrefixBits = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_PREFIX_BITS,zero).c_str());
- if (!_multicastPrefixBits)
- _multicastPrefixBits = ZT_DEFAULT_MULTICAST_PREFIX_BITS;
- _multicastDepth = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH,zero).c_str());
- if (!_multicastDepth)
- _multicastDepth = ZT_DEFAULT_MULTICAST_DEPTH;
+ _multicastLimit = Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT,zero).c_str());
+ if (_multicastLimit == 0) _multicastLimit = ZT_DEFAULT_MULTICAST_LIMIT;
_allowPassiveBridging = (Utils::hexStrToUInt(d.get(ZT_NETWORKCONFIG_DICT_KEY_ALLOW_PASSIVE_BRIDGING,zero).c_str()) != 0);
_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);
_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
+ // need that so merge them here.
std::string ipAddrs(d.get(ZT_NETWORKCONFIG_DICT_KEY_IPV4_STATIC,std::string()));
{
std::string v6s(d.get(ZT_NETWORKCONFIG_DICT_KEY_IPV6_STATIC,std::string()));
diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp
index a6f668aa..e0e9b3a9 100644
--- a/node/NetworkConfig.hpp
+++ b/node/NetworkConfig.hpp
@@ -52,8 +52,7 @@ namespace ZeroTier {
#define ZT_NETWORKCONFIG_DICT_KEY_NETWORK_ID "nwid"
#define ZT_NETWORKCONFIG_DICT_KEY_TIMESTAMP "ts"
#define ZT_NETWORKCONFIG_DICT_KEY_ISSUED_TO "id"
-#define ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_PREFIX_BITS "mpb"
-#define ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_DEPTH "md"
+#define ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_LIMIT "ml"
#define ZT_NETWORKCONFIG_DICT_KEY_MULTICAST_RATES "mr"
#define ZT_NETWORKCONFIG_DICT_KEY_PRIVATE "p"
#define ZT_NETWORKCONFIG_DICT_KEY_NAME "n"
@@ -116,8 +115,7 @@ public:
inline uint64_t networkId() const throw() { return _nwid; }
inline uint64_t timestamp() const throw() { return _timestamp; }
inline const Address &issuedTo() const throw() { return _issuedTo; }
- inline unsigned int multicastPrefixBits() const throw() { return _multicastPrefixBits; }
- inline unsigned int multicastDepth() const throw() { return _multicastDepth; }
+ inline unsigned int multicastLimit() const throw() { return _multicastLimit; }
inline const std::map<MulticastGroup,MulticastRate> &multicastRates() const throw() { return _multicastRates; }
inline bool allowPassiveBridging() const throw() { return _allowPassiveBridging; }
inline bool isPublic() const throw() { return (!_private); }
@@ -155,8 +153,7 @@ private:
uint64_t _nwid;
uint64_t _timestamp;
Address _issuedTo;
- unsigned int _multicastPrefixBits;
- unsigned int _multicastDepth;
+ unsigned int _multicastLimit;
bool _allowPassiveBridging;
bool _private;
bool _enableBroadcast;
diff --git a/objects.mk b/objects.mk
index 276c89cf..059ffe89 100644
--- a/objects.mk
+++ b/objects.mk
@@ -10,6 +10,7 @@ OBJS=\
node/Dictionary.o \
node/HttpClient.o \
node/Identity.o \
+ node/IncomingPacket.o \
node/InetAddress.o \
node/Logger.o \
node/MulticastTopology.o \
@@ -18,7 +19,6 @@ OBJS=\
node/Node.o \
node/NodeConfig.o \
node/Packet.o \
- node/PacketDecoder.o \
node/Peer.o \
node/Poly1305.o \
node/RoutingTable.o \