diff options
| author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-09 12:42:25 -0700 |
|---|---|---|
| committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2014-10-09 12:42:25 -0700 |
| commit | d5e0f7e3e453482bf6e7d6d8cb76a68ecc26b287 (patch) | |
| tree | e0274527ce9afeb54917767e377d800cf943e27c /node/Switch.cpp | |
| parent | 620e64c58f1332d6b9948108dcd1ebf99223074d (diff) | |
| download | infinitytier-d5e0f7e3e453482bf6e7d6d8cb76a68ecc26b287.tar.gz infinitytier-d5e0f7e3e453482bf6e7d6d8cb76a68ecc26b287.zip | |
Reorg multicast packet, and a whole bunch of refactoring around the pushing of certificates of membership.
Diffstat (limited to 'node/Switch.cpp')
| -rw-r--r-- | node/Switch.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/node/Switch.cpp b/node/Switch.cpp index 4ad55056..1eb13501 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -170,11 +170,16 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c Address toZT(to.toAddress(network->id())); if (network->isAllowed(toZT)) { - // TODO: we can refactor this to push certificates with EXT_FRAME - network->pushMembershipCertificate(toZT,false,Utils::now()); + if (network->peerNeedsOurMembershipCertificate(toZT,Utils::now())) { + // TODO: once there are no more <1.0.0 nodes around, we can + // bundle this with EXT_FRAME instead of sending two packets. + Packet outp(toZT,RR->identity.address(),Packet::VERB_NETWORK_MEMBERSHIP_CERTIFICATE); + nconf->com().serialize(outp); + send(outp,true); + } if (fromBridged) { - // Must use EXT_FRAME if source is not myself + // EXT_FRAME is used for bridging or if we want to include a COM Packet outp(toZT,RR->identity.address(),Packet::VERB_EXT_FRAME); outp.append(network->id()); outp.append((unsigned char)0); @@ -185,7 +190,7 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &network,const MAC &from,c outp.compress(); send(outp,true); } else { - // VERB_FRAME is really just lighter weight EXT_FRAME, can use for direct-to-direct (before bridging this was the only unicast method) + // FRAME is a shorter version that can be used when there's no bridging and no COM Packet outp(toZT,RR->identity.address(),Packet::VERB_FRAME); outp.append(network->id()); outp.append((uint16_t)etherType); |
