summaryrefslogtreecommitdiff
path: root/node
diff options
context:
space:
mode:
Diffstat (limited to 'node')
-rw-r--r--node/Cluster.cpp27
-rw-r--r--node/Cluster.hpp27
-rw-r--r--node/Multicaster.cpp18
3 files changed, 38 insertions, 34 deletions
diff --git a/node/Cluster.cpp b/node/Cluster.cpp
index 0a7de93d..af9ab854 100644
--- a/node/Cluster.cpp
+++ b/node/Cluster.cpp
@@ -55,33 +55,6 @@
#include "Node.hpp"
#include "Array.hpp"
-/**
- * Chunk size for allocating queue entries
- *
- * Queue entries are allocated in chunks of this many and are added to a pool.
- * ZT_CLUSTER_MAX_QUEUE_GLOBAL must be evenly divisible by this.
- */
-#define ZT_CLUSTER_QUEUE_CHUNK_SIZE 32
-
-/**
- * Maximum number of chunks to ever allocate
- *
- * This is a global sanity limit to prevent resource exhaustion attacks. It
- * works out to about 600mb of RAM. You'll never see this on a normal edge
- * node. We're unlikely to see this on a root server unless someone is DOSing
- * us. In that case cluster relaying will be affected but other functions
- * should continue to operate normally.
- */
-#define ZT_CLUSTER_MAX_QUEUE_CHUNKS 8194
-
-/**
- * Max data per queue entry
- *
- * If we ever support larger transport MTUs this must be increased. The plus
- * 16 is just a small margin and has no special meaning.
- */
-#define ZT_CLUSTER_SEND_QUEUE_DATA_MAX (ZT_UDP_DEFAULT_PAYLOAD_MTU + 16)
-
namespace ZeroTier {
static inline double _dist3d(int x1,int y1,int z1,int x2,int y2,int z2)
diff --git a/node/Cluster.hpp b/node/Cluster.hpp
index 87452b6f..ccf0c12a 100644
--- a/node/Cluster.hpp
+++ b/node/Cluster.hpp
@@ -73,6 +73,33 @@
*/
#define ZT_CLUSTER_QUEUE_EXPIRATION 5000
+/**
+ * Chunk size for allocating queue entries
+ *
+ * Queue entries are allocated in chunks of this many and are added to a pool.
+ * ZT_CLUSTER_MAX_QUEUE_GLOBAL must be evenly divisible by this.
+ */
+#define ZT_CLUSTER_QUEUE_CHUNK_SIZE 32
+
+/**
+ * Maximum number of chunks to ever allocate
+ *
+ * This is a global sanity limit to prevent resource exhaustion attacks. It
+ * works out to about 600mb of RAM. You'll never see this on a normal edge
+ * node. We're unlikely to see this on a root server unless someone is DOSing
+ * us. In that case cluster relaying will be affected but other functions
+ * should continue to operate normally.
+ */
+#define ZT_CLUSTER_MAX_QUEUE_CHUNKS 8194
+
+/**
+ * Max data per queue entry
+ *
+ * If we ever support larger transport MTUs this must be increased. The plus
+ * 16 is just a small margin and has no special meaning.
+ */
+#define ZT_CLUSTER_SEND_QUEUE_DATA_MAX (ZT_UDP_DEFAULT_PAYLOAD_MTU + 16)
+
namespace ZeroTier {
class RuntimeEnvironment;
diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp
index 41838552..fa9487ef 100644
--- a/node/Multicaster.cpp
+++ b/node/Multicaster.cpp
@@ -235,21 +235,26 @@ void Multicaster::send(
if ((gs.members.empty())||((now - gs.lastExplicitGather) >= ZT_MULTICAST_EXPLICIT_GATHER_DELAY)) {
gs.lastExplicitGather = now;
- SharedPtr<Peer> r(RR->topology->getBestRoot());
- if (r) {
- TRACE(">>MC upstream GATHER up to %u for group %.16llx/%s",gatherLimit,nwid,mg.toString().c_str());
+ SharedPtr<Peer> explicitGatherPeers[2];
+ explicitGatherPeers[0] = RR->topology->getBestRoot();
+ explicitGatherPeers[1] = RR->topology->getPeer(Network::controllerFor(nwid));
+ for(unsigned int k=0;k<2;++k) {
+ const SharedPtr<Peer> &p = explicitGatherPeers[k];
+ if (!p)
+ continue;
+ //TRACE(">>MC upstream GATHER up to %u for group %.16llx/%s",gatherLimit,nwid,mg.toString().c_str());
const CertificateOfMembership *com = (CertificateOfMembership *)0;
{
SharedPtr<Network> nw(RR->node->network(nwid));
if (nw) {
SharedPtr<NetworkConfig> nconf(nw->config2());
- if ((nconf)&&(nconf->com())&&(nconf->isPrivate())&&(r->needsOurNetworkMembershipCertificate(nwid,now,true)))
+ if ((nconf)&&(nconf->com())&&(nconf->isPrivate())&&(p->needsOurNetworkMembershipCertificate(nwid,now,true)))
com = &(nconf->com());
}
}
- Packet outp(r->address(),RR->identity.address(),Packet::VERB_MULTICAST_GATHER);
+ Packet outp(p->address(),RR->identity.address(),Packet::VERB_MULTICAST_GATHER);
outp.append(nwid);
outp.append((uint8_t)(com ? 0x01 : 0x00));
mg.mac().appendTo(outp);
@@ -257,8 +262,7 @@ void Multicaster::send(
outp.append((uint32_t)gatherLimit);
if (com)
com->serialize(outp);
- outp.armor(r->key(),true);
- r->send(RR,outp.data(),outp.size(),now);
+ RR->sw->send(outp,true,0);
}
gatherLimit = 0;
}