diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-07-06 12:46:27 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-07-06 12:46:27 -0700 |
commit | 6bfbc43e3c1de27648c974fc783573487391e0a2 (patch) | |
tree | 299de115205136d0f12c58b0965b8fe49b6a9e90 /node | |
parent | 35b5dcf89df77e372c8c06e62b30debd55426f98 (diff) | |
download | infinitytier-6bfbc43e3c1de27648c974fc783573487391e0a2.tar.gz infinitytier-6bfbc43e3c1de27648c974fc783573487391e0a2.zip |
Include COM with EXT_FRAME in bridged case.
Diffstat (limited to 'node')
-rw-r--r-- | node/Switch.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index f91bf5c9..f022122e 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -167,7 +167,6 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c Address toZT(to.toAddress(network->id())); if (network->isAllowed(toZT)) { - const bool includeCom = network->peerNeedsOurMembershipCertificate(toZT,RR->node->now()); /* if (network->peerNeedsOurMembershipCertificate(toZT,RR->node->now())) { // TODO: once there are no more <1.0.0 nodes around, we can @@ -178,6 +177,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c } */ + const bool includeCom = network->peerNeedsOurMembershipCertificate(toZT,RR->node->now()); if ((fromBridged)||(includeCom)) { Packet outp(toZT,RR->identity.address(),Packet::VERB_EXT_FRAME); outp.append(network->id()); @@ -216,16 +216,14 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c Address bridges[ZT_MAX_BRIDGE_SPAM]; unsigned int numBridges = 0; + /* Create an array of up to ZT_MAX_BRIDGE_SPAM recipients for this bridged frame. */ bridges[0] = network->findBridgeTo(to); if ((bridges[0])&&(bridges[0] != RR->identity.address())&&(network->isAllowed(bridges[0]))&&(network->permitsBridging(bridges[0]))) { - // We have a known bridge route for this MAC. + /* We have a known bridge route for this MAC, send it there. */ ++numBridges; } else if (!nconf->activeBridges().empty()) { /* If there is no known route, spam to up to ZT_MAX_BRIDGE_SPAM active - * bridges. This is similar to what many switches do -- if they do not - * know which port corresponds to a MAC, they send it to all ports. If - * there aren't any active bridges, numBridges will stay 0 and packet - * is dropped. */ + * bridges. If someone responds, we'll learn the route. */ std::vector<Address>::const_iterator ab(nconf->activeBridges().begin()); if (nconf->activeBridges().size() <= ZT_MAX_BRIDGE_SPAM) { // If there are <= ZT_MAX_BRIDGE_SPAM active bridges, spam them all @@ -251,7 +249,12 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c for(unsigned int b=0;b<numBridges;++b) { Packet outp(bridges[b],RR->identity.address(),Packet::VERB_EXT_FRAME); outp.append(network->id()); - outp.append((unsigned char)0); + if (network->peerNeedsOurMembershipCertificate(bridges[b],RR->node->now())) { + outp.append((unsigned char)0x01); // 0x01 -- COM included + nconf->com().serialize(outp); + } else { + outp.append((unsigned char)0); + } to.appendTo(outp); from.appendTo(outp); outp.append((uint16_t)etherType); |