From 942cc0ca215b378c093ffca338cb44f64e34ff97 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Fri, 25 Oct 2013 14:51:55 -0400 Subject: Certificate of membership works now... had to fix multicast propagation so COM is pushed with multicast, which makes tremendous sense in retrospect. --- node/Switch.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'node/Switch.cpp') diff --git a/node/Switch.cpp b/node/Switch.cpp index 14f6c506..f0641e74 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -117,7 +117,6 @@ void Switch::onLocalEthernet(const SharedPtr &network,const MAC &from,c unsigned char *const fifoEnd = fifo + sizeof(fifo); const unsigned int signedPartLen = (ZT_PROTO_VERB_MULTICAST_FRAME_IDX_FRAME - ZT_PROTO_VERB_MULTICAST_FRAME_IDX__START_OF_SIGNED_PORTION) + data.size(); const SharedPtr supernode(_r->topology->getBestSupernode()); - uint64_t now = Utils::now(); for(unsigned int prefix=0,np=((unsigned int)2 << (nconf->multicastPrefixBits() - 1));prefix &network,const MAC &from,c else continue; } - // If network is not open, make sure all recipients have our membership - // certificate if we haven't sent it recently. As the multicast goes - // further down the line, peers beyond the first batch will ask us for - // our membership certificate if they need it. - network->pushMembershipCertificate(fifo,sizeof(fifo),false,now); - Packet outp(firstHop,_r->identity.address(),Packet::VERB_MULTICAST_FRAME); outp.append((uint16_t)0); outp.append(fifo + ZT_ADDRESS_LENGTH,ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_FIFO); // remainder of fifo is loaded into packet outp.append(bloom,ZT_PROTO_VERB_MULTICAST_FRAME_LEN_PROPAGATION_BLOOM); - outp.append((unsigned char)0); + outp.append((nconf->com()) ? (unsigned char)ZT_PROTO_VERB_MULTICAST_FRAME_FLAGS_HAS_MEMBERSHIP_CERTIFICATE : (unsigned char)0); outp.append(network->id()); outp.append(bloomNonce); outp.append((unsigned char)nconf->multicastPrefixBits()); @@ -164,6 +157,9 @@ void Switch::onLocalEthernet(const SharedPtr &network,const MAC &from,c outp.append((uint16_t)sig.size()); outp.append(sig.data,sig.size()); + if (nconf->com()) + nconf->com().serialize(outp); + outp.compress(); send(outp,true); } @@ -194,8 +190,6 @@ void Switch::send(const Packet &packet,bool encrypt) return; } - //TRACE(">> %.16llx %s -> %s (size: %u) (enc: %s)",(unsigned long long)packet.packetId(),packet.source().toString().c_str(),packet.destination().toString().c_str(),packet.size(),(encrypt ? "yes" : "no")); - if (!_trySend(packet,encrypt)) { Mutex::Lock _l(_txQueue_m); _txQueue.insert(std::pair< Address,TXQueueEntry >(packet.destination(),TXQueueEntry(Utils::now(),packet,encrypt))); -- cgit v1.2.3