Certificate of membership works now... had to fix multicast propagation so COM is pushed with multicast, which makes tremendous sense in retrospect.
This commit is contained in:
parent
010616e3ae
commit
942cc0ca21
4 changed files with 33 additions and 44 deletions
|
@ -117,7 +117,6 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &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<Peer> supernode(_r->topology->getBestSupernode());
|
||||
uint64_t now = Utils::now();
|
||||
|
||||
for(unsigned int prefix=0,np=((unsigned int)2 << (nconf->multicastPrefixBits() - 1));prefix<np;++prefix) {
|
||||
memset(bloom,0,sizeof(bloom));
|
||||
|
@ -134,17 +133,11 @@ void Switch::onLocalEthernet(const SharedPtr<Network> &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> &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)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue