From 055be92ef0d7e4c21e937d4aa742b76547445b42 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Wed, 16 Jul 2025 11:55:00 -0400 Subject: [PATCH] Plumb through attaching network ID to packet sends. --- node/Bond.cpp | 3 ++- node/Membership.cpp | 3 ++- node/Multicaster.cpp | 4 ++-- node/Network.cpp | 23 ++++++++++---------- node/NetworkConfig.hpp | 22 +++++++++++++++++++ node/Node.cpp | 8 +++---- node/OutboundMulticast.cpp | 3 +-- node/Peer.cpp | 2 +- node/Switch.cpp | 44 ++++++++++++++++++++------------------ node/Switch.hpp | 12 +++++------ node/Trace.cpp | 4 ++-- 11 files changed, 76 insertions(+), 52 deletions(-) diff --git a/node/Bond.cpp b/node/Bond.cpp index 023bef354..f612cea2c 100644 --- a/node/Bond.cpp +++ b/node/Bond.cpp @@ -13,6 +13,7 @@ #include "Bond.hpp" +#include "Constants.hpp" #include "Node.hpp" #include "Switch.hpp" @@ -899,7 +900,7 @@ void Bond::sendQOS_MEASUREMENT(void* tPtr, int pathIdx, int64_t localSocket, con RR->node->putPacket(tPtr, localSocket, atAddress, outp.data(), outp.size()); } else { - RR->sw->send(tPtr, outp, false); + RR->sw->send(tPtr, outp, false, 0, ZT_QOS_NO_FLOW); } Metrics::pkt_qos_out++; _paths[pathIdx].packetsReceivedSinceLastQoS = 0; diff --git a/node/Membership.cpp b/node/Membership.cpp index f09755ffe..14b845c67 100644 --- a/node/Membership.cpp +++ b/node/Membership.cpp @@ -13,6 +13,7 @@ #include "Membership.hpp" +#include "Constants.hpp" #include "Node.hpp" #include "Packet.hpp" #include "Peer.hpp" @@ -93,7 +94,7 @@ void Membership::pushCredentials(const RuntimeEnvironment* RR, void* tPtr, const outp.setAt(cooCountAt, (uint16_t)thisPacketCooCount); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, nconf.networkId, ZT_QOS_NO_FLOW); Metrics::pkt_network_credentials_out++; } diff --git a/node/Multicaster.cpp b/node/Multicaster.cpp index 29cac68a8..09acfef94 100644 --- a/node/Multicaster.cpp +++ b/node/Multicaster.cpp @@ -272,7 +272,7 @@ void Multicaster::send(void* tPtr, int64_t now, const SharedPtr& networ Address explicitGatherPeers[16]; unsigned int numExplicitGatherPeers = 0; - SharedPtr bestRoot(RR->topology->getUpstreamPeer()); + SharedPtr bestRoot(RR->topology->getUpstreamPeer(network->id())); if (bestRoot) { explicitGatherPeers[numExplicitGatherPeers++] = bestRoot->address(); } @@ -312,7 +312,7 @@ void Multicaster::send(void* tPtr, int64_t now, const SharedPtr& networ com->serialize(outp); } RR->node->expectReplyTo(outp.packetId()); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, network->id(), ZT_QOS_NO_FLOW); Metrics::pkt_multicast_gather_out++; } } diff --git a/node/Network.cpp b/node/Network.cpp index 4b5cdd02d..19a6fd75e 100644 --- a/node/Network.cpp +++ b/node/Network.cpp @@ -31,7 +31,6 @@ #include "Trace.hpp" #include -#include #include #include #include @@ -808,7 +807,7 @@ bool Network::filterOutgoingPacket( outp.append((uint16_t)etherType); outp.append(frameData, ccLength2); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } break; @@ -846,7 +845,7 @@ bool Network::filterOutgoingPacket( outp.append((uint16_t)etherType); outp.append(frameData, ccLength); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } if ((ztDest != ztFinalDest) && (ztFinalDest)) { @@ -858,7 +857,7 @@ bool Network::filterOutgoingPacket( outp.append((uint16_t)etherType); outp.append(frameData, frameLen); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); if (_config.remoteTraceTarget) { RR->t->networkFilter( @@ -985,7 +984,7 @@ int Network::filterIncomingPacket( outp.append((uint16_t)etherType); outp.append(frameData, ccLength2); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } break; } @@ -1018,7 +1017,7 @@ int Network::filterIncomingPacket( outp.append((uint16_t)etherType); outp.append(frameData, ccLength); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } if ((ztDest != ztFinalDest) && (ztFinalDest)) { @@ -1030,7 +1029,7 @@ int Network::filterIncomingPacket( outp.append((uint16_t)etherType); outp.append(frameData, frameLen); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); if (_config.remoteTraceTarget) { RR->t->networkFilter(tPtr, *this, rrl, (c) ? &crrl : (Trace::RuleResultLog*)0, c, sourcePeer->address(), ztDest, macSource, macDest, frameData, frameLen, etherType, vlanId, false, true, 0); @@ -1160,7 +1159,7 @@ uint64_t Network::handleConfigChunk(void* tPtr, const uint64_t packetId, const A if ((*a != source) && (*a != controller())) { Packet outp(*a, RR->identity.address(), Packet::VERB_NETWORK_CONFIG); outp.append(reinterpret_cast(chunk.data()) + start, chunk.size() - start); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } } } @@ -1471,7 +1470,7 @@ void Network::requestConfiguration(void* tPtr) } outp.compress(); RR->node->expectReplyTo(outp.packetId()); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } bool Network::gate(void* tPtr, const SharedPtr& peer) @@ -1628,7 +1627,7 @@ Membership::AddCredentialResult Network::addCredential(void* tPtr, const Address outp.append((uint16_t)1); // one revocation! rev.serialize(outp); outp.append((uint16_t)0); // no certificates of ownership - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, _id, ZT_QOS_NO_FLOW); } } } @@ -1798,7 +1797,7 @@ void Network::_announceMulticastGroupsTo(void* tPtr, const Address& peer, const for (std::vector::const_iterator mg(allMulticastGroups.begin()); mg != allMulticastGroups.end(); ++mg) { if ((outp->size() + 24) >= ZT_PROTO_MAX_PACKET_LENGTH) { outp->compress(); - RR->sw->send(tPtr, *outp, true); + RR->sw->send(tPtr, *outp, true, _id, ZT_QOS_NO_FLOW); outp->reset(peer, RR->identity.address(), Packet::VERB_MULTICAST_LIKE); } @@ -1810,7 +1809,7 @@ void Network::_announceMulticastGroupsTo(void* tPtr, const Address& peer, const if (outp->size() > ZT_PROTO_MIN_PACKET_LENGTH) { outp->compress(); - RR->sw->send(tPtr, *outp, true); + RR->sw->send(tPtr, *outp, true, _id, ZT_QOS_NO_FLOW); } delete outp; diff --git a/node/NetworkConfig.hpp b/node/NetworkConfig.hpp index 8ed6f033c..adf8c1e04 100644 --- a/node/NetworkConfig.hpp +++ b/node/NetworkConfig.hpp @@ -377,6 +377,28 @@ class NetworkConfig { return false; } + inline std::vector
alwaysContactAddresses() const + { + std::vector
r; + for (unsigned int i = 0; i < specialistCount; ++i) { + if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_NETWORK_RELAY | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0) { + r.push_back(Address(specialists[i])); + } + } + return r; + } + + inline unsigned int alwaysContactAddresses(Address ac[ZT_MAX_NETWORK_SPECIALISTS]) const + { + unsigned int c = 0; + for (unsigned int i = 0; i < specialistCount; ++i) { + if ((specialists[i] & (ZT_NETWORKCONFIG_SPECIALIST_TYPE_NETWORK_RELAY | ZT_NETWORKCONFIG_SPECIALIST_TYPE_MULTICAST_REPLICATOR)) != 0) { + ac[c++] = specialists[i]; + } + } + return c; + } + inline void alwaysContactAddresses(Hashtable >& a) const { for (unsigned int i = 0; i < specialistCount; ++i) { diff --git a/node/Node.cpp b/node/Node.cpp index c3cffc9e6..7f1ac669f 100644 --- a/node/Node.cpp +++ b/node/Node.cpp @@ -699,7 +699,7 @@ int Node::sendUserMessage(void* tptr, uint64_t dest, uint64_t typeId, const void outp.append(typeId); outp.append(data, len); outp.compress(); - RR->sw->send(tptr, outp, true); + RR->sw->send(tptr, outp, true, 0, ZT_QOS_NO_FLOW); return 1; } } @@ -825,7 +825,7 @@ void Node::ncSendConfig(uint64_t nwid, uint64_t requestPacketId, const Address& outp.append(sig.data, ZT_ECC_SIGNATURE_LEN); outp.compress(); - RR->sw->send((void*)0, outp, true); + RR->sw->send((void*)0, outp, true, nwid, ZT_QOS_NO_FLOW); chunkIndex += chunkLen; } } @@ -855,7 +855,7 @@ void Node::ncSendRevocation(const Address& destination, const Revocation& rev) outp.append((uint16_t)1); rev.serialize(outp); outp.append((uint16_t)0); - RR->sw->send((void*)0, outp, true); + RR->sw->send((void*)0, outp, true, rev.networkId(), ZT_QOS_NO_FLOW); } } @@ -911,7 +911,7 @@ void Node::ncSendError(uint64_t nwid, uint64_t requestPacketId, const Address& d outp.append(errorData, errorDataSize); } - RR->sw->send((void*)0, outp, true); + RR->sw->send((void*)0, outp, true, nwid, ZT_QOS_NO_FLOW); } // else we can't send an ERROR() in response to nothing, so discard } diff --git a/node/OutboundMulticast.cpp b/node/OutboundMulticast.cpp index 702a0333e..346945073 100644 --- a/node/OutboundMulticast.cpp +++ b/node/OutboundMulticast.cpp @@ -16,7 +16,6 @@ #include "Constants.hpp" #include "Network.hpp" #include "Node.hpp" -#include "Peer.hpp" #include "RuntimeEnvironment.hpp" #include "Switch.hpp" #include "Topology.hpp" @@ -87,7 +86,7 @@ void OutboundMulticast::sendOnly(const RuntimeEnvironment* RR, void* tPtr, const _packet.setDestination(toAddr); RR->node->expectReplyTo(_packet.packetId()); _tmp = _packet; - RR->sw->send(tPtr, _tmp, true); + RR->sw->send(tPtr, _tmp, true, _nwid, ZT_QOS_NO_FLOW); } } diff --git a/node/Peer.cpp b/node/Peer.cpp index 7fa1553ac..1843feea8 100644 --- a/node/Peer.cpp +++ b/node/Peer.cpp @@ -470,7 +470,7 @@ void Peer::sendHELLO(void* tPtr, const int64_t localSocket, const InetAddress& a } else { RR->node->expectReplyTo(outp.packetId()); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, 0, ZT_QOS_NO_FLOW); } } diff --git a/node/Switch.cpp b/node/Switch.cpp index 414b50aca..970364727 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -83,6 +83,7 @@ void Switch::onRemotePacket(void* tPtr, const int64_t localSocket, const InetAdd const Address destination(fragment.destination()); if (destination != RR->identity.address()) { + // Fragment is someone else's. if ((! RR->topology->amUpstream()) && (! path->trustEstablished(now))) { return; } @@ -95,7 +96,7 @@ void Switch::onRemotePacket(void* tPtr, const int64_t localSocket, const InetAdd SharedPtr relayTo = RR->topology->getPeer(tPtr, destination); if ((! relayTo) || (! relayTo->sendDirect(tPtr, fragment.data(), fragment.size(), now, false))) { // Don't know peer or no direct path -- so relay via someone upstream - relayTo = RR->topology->getUpstreamPeer(); + relayTo = RR->topology->getUpstreamPeer(0); if (relayTo) { relayTo->sendDirect(tPtr, fragment.data(), fragment.size(), now, true); } @@ -164,6 +165,7 @@ void Switch::onRemotePacket(void* tPtr, const int64_t localSocket, const InetAdd } if (destination != RR->identity.address()) { + // Not our packet head. if ((! RR->topology->amUpstream()) && (! path->trustEstablished(now)) && (source != RR->identity.address())) { return; } @@ -182,7 +184,7 @@ void Switch::onRemotePacket(void* tPtr, const int64_t localSocket, const InetAdd } } else { - relayTo = RR->topology->getUpstreamPeer(); + relayTo = RR->topology->getUpstreamPeer(0); if ((relayTo) && (relayTo->address() != source)) { if (relayTo->sendDirect(tPtr, packet.data(), packet.size(), now, true)) { const SharedPtr sourcePeer(RR->topology->getPeer(tPtr, source)); @@ -550,7 +552,7 @@ void Switch::onLocalEthernet(void* tPtr, const SharedPtr& network, cons // 1.4.8: disable compression for unicast as it almost never helps // if (!network->config().disableCompression()) // outp.compress(); - aqm_enqueue(tPtr, network, outp, true, qosBucket, flowId); + aqm_enqueue(tPtr, network, outp, true, qosBucket, network->id(), flowId); } else { Packet outp(toZT, RR->identity.address(), Packet::VERB_EXT_FRAME); @@ -563,7 +565,7 @@ void Switch::onLocalEthernet(void* tPtr, const SharedPtr& network, cons // 1.4.8: disable compression for unicast as it almost never helps // if (!network->config().disableCompression()) // outp.compress(); - aqm_enqueue(tPtr, network, outp, true, qosBucket, flowId); + aqm_enqueue(tPtr, network, outp, true, qosBucket, network->id(), flowId); } } else { @@ -627,7 +629,7 @@ void Switch::onLocalEthernet(void* tPtr, const SharedPtr& network, cons // 1.4.8: disable compression for unicast as it almost never helps // if (!network->config().disableCompression()) // outp.compress(); - aqm_enqueue(tPtr, network, outp, true, qosBucket, flowId); + aqm_enqueue(tPtr, network, outp, true, qosBucket, network->id(), flowId); } else { RR->t->outgoingNetworkFrameDropped(tPtr, network, from, to, etherType, vlanId, len, "filter blocked (bridge replication)"); @@ -636,10 +638,10 @@ void Switch::onLocalEthernet(void* tPtr, const SharedPtr& network, cons } } -void Switch::aqm_enqueue(void* tPtr, const SharedPtr& network, Packet& packet, bool encrypt, int qosBucket, int32_t flowId) +void Switch::aqm_enqueue(void* tPtr, const SharedPtr& network, Packet& packet, const bool encrypt, const int qosBucket, const uint64_t nwid, const int32_t flowId) { if (! network->qosEnabled()) { - send(tPtr, packet, encrypt, flowId); + send(tPtr, packet, encrypt, nwid, flowId); return; } NetworkQoSControlBlock* nqcb = _netQueueControlBlock[network->id()]; @@ -654,7 +656,7 @@ void Switch::aqm_enqueue(void* tPtr, const SharedPtr& network, Packet& } // Don't apply QoS scheduling to ZT protocol traffic if (packet.verb() != Packet::VERB_FRAME && packet.verb() != Packet::VERB_EXT_FRAME) { - send(tPtr, packet, encrypt, flowId); + send(tPtr, packet, encrypt, nwid, flowId); } _aqm_m.lock(); @@ -662,7 +664,7 @@ void Switch::aqm_enqueue(void* tPtr, const SharedPtr& network, Packet& // Enqueue packet and move queue to appropriate list const Address dest(packet.destination()); - TXQueueEntry* txEntry = new TXQueueEntry(dest, RR->node->now(), packet, encrypt, flowId); + TXQueueEntry* txEntry = new TXQueueEntry(dest, nwid, RR->node->now(), packet, encrypt, flowId); ManagedQueue* selectedQueue = nullptr; for (size_t i = 0; i < ZT_AQM_NUM_BUCKETS; i++) { @@ -842,7 +844,7 @@ void Switch::aqm_dequeue(void* tPtr) queueAtFrontOfList->byteCredit -= len; // Send the packet! queueAtFrontOfList->q.pop_front(); - send(tPtr, entryToEmit->packet, entryToEmit->encrypt, entryToEmit->flowId); + send(tPtr, entryToEmit->packet, entryToEmit->encrypt, entryToEmit->nwid, entryToEmit->flowId); (*nqcb).second->_currEnqueuedPackets--; } if (queueAtFrontOfList) { @@ -875,7 +877,7 @@ void Switch::aqm_dequeue(void* tPtr) queueAtFrontOfList->byteLength -= len; queueAtFrontOfList->byteCredit -= len; queueAtFrontOfList->q.pop_front(); - send(tPtr, entryToEmit->packet, entryToEmit->encrypt, entryToEmit->flowId); + send(tPtr, entryToEmit->packet, entryToEmit->encrypt, entryToEmit->nwid, entryToEmit->flowId); (*nqcb).second->_currEnqueuedPackets--; } if (queueAtFrontOfList) { @@ -899,20 +901,20 @@ void Switch::removeNetworkQoSControlBlock(uint64_t nwid) } } -void Switch::send(void* tPtr, Packet& packet, bool encrypt, int32_t flowId) +void Switch::send(void* tPtr, Packet& packet, const bool encrypt, const uint64_t nwid, const int32_t flowId) { const Address dest(packet.destination()); if (dest == RR->identity.address()) { return; } _recordOutgoingPacketMetrics(packet); - if (! _trySend(tPtr, packet, encrypt, flowId)) { + if (! _trySend(tPtr, packet, encrypt, nwid, flowId)) { { Mutex::Lock _l(_txQueue_m); if (_txQueue.size() >= ZT_TX_QUEUE_SIZE) { _txQueue.pop_front(); } - _txQueue.push_back(TXQueueEntry(dest, RR->node->now(), packet, encrypt, flowId)); + _txQueue.push_back(TXQueueEntry(dest, nwid, RR->node->now(), packet, encrypt, flowId)); } if (! RR->topology->getPeer(tPtr, dest)) { requestWhois(tPtr, RR->node->now(), dest); @@ -937,12 +939,12 @@ void Switch::requestWhois(void* tPtr, const int64_t now, const Address& addr) } } - const SharedPtr upstream(RR->topology->getUpstreamPeer()); + const SharedPtr upstream(RR->topology->getUpstreamPeer(0)); if (upstream) { int32_t flowId = ZT_QOS_NO_FLOW; Packet outp(upstream->address(), RR->identity.address(), Packet::VERB_WHOIS); addr.appendTo(outp); - send(tPtr, outp, true, flowId); + send(tPtr, outp, true, 0, flowId); } } @@ -968,7 +970,7 @@ void Switch::doAnythingWaitingForPeer(void* tPtr, const SharedPtr& peer) Mutex::Lock _l(_txQueue_m); for (std::list::iterator txi(_txQueue.begin()); txi != _txQueue.end();) { if (txi->dest == peer->address()) { - if (_trySend(tPtr, txi->packet, txi->encrypt, txi->flowId)) { + if (_trySend(tPtr, txi->packet, txi->encrypt, 0, txi->flowId)) { _txQueue.erase(txi++); } else { @@ -995,7 +997,7 @@ unsigned long Switch::doTimerTasks(void* tPtr, int64_t now) Mutex::Lock _l(_txQueue_m); for (std::list::iterator txi(_txQueue.begin()); txi != _txQueue.end();) { - if (_trySend(tPtr, txi->packet, txi->encrypt, txi->flowId)) { + if (_trySend(tPtr, txi->packet, txi->encrypt, 0, txi->flowId)) { _txQueue.erase(txi++); } else if ((now - txi->creationTime) > ZT_TRANSMIT_QUEUE_TIMEOUT) { @@ -1067,7 +1069,7 @@ bool Switch::_shouldUnite(const int64_t now, const Address& source, const Addres return false; } -bool Switch::_trySend(void* tPtr, Packet& packet, bool encrypt, int32_t flowId) +bool Switch::_trySend(void* tPtr, Packet& packet, bool encrypt, const uint64_t nwid, const int32_t flowId) { SharedPtr viaPath; const int64_t now = RR->node->now(); @@ -1076,7 +1078,7 @@ bool Switch::_trySend(void* tPtr, Packet& packet, bool encrypt, int32_t flowId) const SharedPtr peer(RR->topology->getPeer(tPtr, destination)); if (peer) { if ((peer->bondingPolicy() == ZT_BOND_POLICY_BROADCAST) && (packet.verb() == Packet::VERB_FRAME || packet.verb() == Packet::VERB_EXT_FRAME)) { - const SharedPtr relay(RR->topology->getUpstreamPeer()); + const SharedPtr relay(RR->topology->getUpstreamPeer(nwid)); Mutex::Lock _l(peer->_paths_m); for (int i = 0; i < ZT_MAX_PEER_NETWORK_PATHS; ++i) { if (peer->_paths[i].p && peer->_paths[i].p->alive(now)) { @@ -1090,7 +1092,7 @@ bool Switch::_trySend(void* tPtr, Packet& packet, bool encrypt, int32_t flowId) viaPath = peer->getAppropriatePath(now, false, flowId); if (! viaPath) { peer->tryMemorizedPath(tPtr, now); // periodically attempt memorized or statically defined paths, if any are known - const SharedPtr relay(RR->topology->getUpstreamPeer()); + const SharedPtr relay(RR->topology->getUpstreamPeer(nwid)); if ((! relay) || (! (viaPath = relay->getAppropriatePath(now, false, flowId)))) { if (! (viaPath = peer->getAppropriatePath(now, true, flowId))) { return false; diff --git a/node/Switch.hpp b/node/Switch.hpp index cf8270d43..a07b6f310 100644 --- a/node/Switch.hpp +++ b/node/Switch.hpp @@ -24,11 +24,9 @@ #include "Packet.hpp" #include "SharedPtr.hpp" #include "Topology.hpp" -#include "Utils.hpp" #include #include -#include #include /* Ethernet frame types that might be relevant to us */ @@ -124,7 +122,7 @@ class Switch { * @param encrypt Encrypt packet payload? (always true except for HELLO) * @param qosBucket Which bucket the rule-system determined this packet should fall into */ - void aqm_enqueue(void* tPtr, const SharedPtr& network, Packet& packet, bool encrypt, int qosBucket, int32_t flowId = ZT_QOS_NO_FLOW); + void aqm_enqueue(void* tPtr, const SharedPtr& network, Packet& packet, const bool encrypt, const int qosBucket, const uint64_t nwid, const int32_t flowId /* = ZT_QOS_NO_FLOW*/); /** * Performs a single AQM cycle and dequeues and transmits all eligible packets on all networks @@ -169,8 +167,9 @@ class Switch { * @param tPtr Thread pointer to be handed through to any callbacks called as a result of this call * @param packet Packet to send (buffer may be modified) * @param encrypt Encrypt packet payload? (always true except for HELLO) + * @param nwid Network ID to which this packet is related or 0 if none */ - void send(void* tPtr, Packet& packet, bool encrypt, int32_t flowId = ZT_QOS_NO_FLOW); + void send(void* tPtr, Packet& packet, const bool encrypt, const uint64_t nwid, const int32_t flowId /* = ZT_QOS_NO_FLOW*/); /** * Request WHOIS on a given address @@ -205,7 +204,7 @@ class Switch { private: bool _shouldUnite(const int64_t now, const Address& source, const Address& destination); - bool _trySend(void* tPtr, Packet& packet, bool encrypt, int32_t flowId = ZT_QOS_NO_FLOW); // packet is modified if return is true + bool _trySend(void* tPtr, Packet& packet, bool encrypt, const uint64_t nwid, const int32_t flowId /* = ZT_QOS_NO_FLOW*/); void _sendViaSpecificPath(void* tPtr, SharedPtr peer, SharedPtr viaPath, uint16_t userSpecifiedMtu, int64_t now, Packet& packet, bool encrypt, int32_t flowId); void _recordOutgoingPacketMetrics(const Packet& p); @@ -260,11 +259,12 @@ class Switch { TXQueueEntry() { } - TXQueueEntry(Address d, uint64_t ct, const Packet& p, bool enc, int32_t fid) : dest(d), creationTime(ct), packet(p), encrypt(enc), flowId(fid) + TXQueueEntry(Address d, uint64_t nwid, uint64_t ct, const Packet& p, bool enc, int32_t fid) : dest(d), nwid(nwid), creationTime(ct), packet(p), encrypt(enc), flowId(fid) { } Address dest; + uint64_t nwid; uint64_t creationTime; Packet packet; // unencrypted/unMAC'd packet -- this is done at send time bool encrypt; diff --git a/node/Trace.cpp b/node/Trace.cpp index 982047093..da40d90ac 100644 --- a/node/Trace.cpp +++ b/node/Trace.cpp @@ -19,13 +19,13 @@ #include "Capability.hpp" #include "CertificateOfMembership.hpp" #include "CertificateOfOwnership.hpp" +#include "Constants.hpp" #include "Dictionary.hpp" #include "Node.hpp" #include "Revocation.hpp" #include "RuntimeEnvironment.hpp" #include "Switch.hpp" #include "Tag.hpp" -#include "Utils.hpp" #include #include @@ -632,7 +632,7 @@ void Trace::_send(void* const tPtr, const Dictionary& Packet outp(dest, RR->identity.address(), Packet::VERB_REMOTE_TRACE); outp.appendCString(d.data()); outp.compress(); - RR->sw->send(tPtr, outp, true); + RR->sw->send(tPtr, outp, true, 0, ZT_QOS_NO_FLOW); } void Trace::_spamToAllNetworks(void* const tPtr, const Dictionary& d, const Level level)