Send COM with MULTICAST_GATHER for future use.

This commit is contained in:
Adam Ierymenko 2015-10-01 13:34:12 -07:00
parent 2c196307ee
commit 6693149f3e

View File

@ -237,12 +237,25 @@ void Multicaster::send(
if (sn) { if (sn) {
TRACE(">>MC upstream GATHER up to %u for group %.16llx/%s",gatherLimit,nwid,mg.toString().c_str()); TRACE(">>MC upstream GATHER up to %u for group %.16llx/%s",gatherLimit,nwid,mg.toString().c_str());
const CertificateOfMembership *com = (CertificateOfMembership *)0;
if (sn->needsOurNetworkMembershipCertificate(nwid,now,true)) {
SharedPtr<Network> nw = RR->node->network(nwid);
SharedPtr<NetworkConfig> nconf;
if (nw) {
nconf = nw->config2();
if (nconf)
com = &(nconf->com());
}
}
Packet outp(sn->address(),RR->identity.address(),Packet::VERB_MULTICAST_GATHER); Packet outp(sn->address(),RR->identity.address(),Packet::VERB_MULTICAST_GATHER);
outp.append(nwid); outp.append(nwid);
outp.append((uint8_t)0); outp.append((uint8_t)(com ? 0x01 : 0x00));
mg.mac().appendTo(outp); mg.mac().appendTo(outp);
outp.append((uint32_t)mg.adi()); outp.append((uint32_t)mg.adi());
outp.append((uint32_t)gatherLimit); outp.append((uint32_t)gatherLimit);
if (com)
com->serialize(outp);
outp.armor(sn->key(),true); outp.armor(sn->key(),true);
sn->send(RR,outp.data(),outp.size(),now); sn->send(RR,outp.data(),outp.size(),now);
} }