From 3443b203e4035104071f5af0143591dcd48a4974 Mon Sep 17 00:00:00 2001 From: Adam Ierymenko Date: Tue, 1 Oct 2013 16:01:36 -0400 Subject: Each peer now tracks the last time it announced multicast LIKEs independently and does so frequently enough to prevent expires. Also add a multicast debug facility for use on the testnet. --- node/Switch.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'node/Switch.cpp') diff --git a/node/Switch.cpp b/node/Switch.cpp index 14b658a7..896c6435 100644 --- a/node/Switch.cpp +++ b/node/Switch.cpp @@ -400,6 +400,7 @@ void Switch::announceMulticastGroups(const std::map< SharedPtr,std::set outp.reset((*p)->address(),_r->identity.address(),Packet::VERB_MULTICAST_LIKE); } + // network ID, MAC, ADI outp.append((uint64_t)nwmgs->first->id()); outp.append(mg->mac().data,6); outp.append((uint32_t)mg->adi()); @@ -412,6 +413,30 @@ void Switch::announceMulticastGroups(const std::map< SharedPtr,std::set } } +void Switch::announceMulticastGroups(const SharedPtr &peer) +{ + Packet outp(peer->address(),_r->identity.address(),Packet::VERB_MULTICAST_LIKE); + std::vector< SharedPtr > networks(_r->nc->networks()); + for(std::vector< SharedPtr >::iterator n(networks.begin());n!=networks.end();++n) { + if (((*n)->isAllowed(peer->address()))||(_r->topology->isSupernode(peer->address()))) { + std::set mgs((*n)->multicastGroups()); + for(std::set::iterator mg(mgs.begin());mg!=mgs.end();++mg) { + if ((outp.size() + 18) > ZT_UDP_DEFAULT_PAYLOAD_MTU) { + send(outp,true); + outp.reset(peer->address(),_r->identity.address(),Packet::VERB_MULTICAST_LIKE); + } + + // network ID, MAC, ADI + outp.append((uint64_t)(*n)->id()); + outp.append(mg->mac().data,6); + outp.append((uint32_t)mg->adi()); + } + } + } + if (outp.size() > ZT_PROTO_MIN_PACKET_LENGTH) + send(outp,true); +} + void Switch::requestWhois(const Address &addr) { TRACE("requesting WHOIS for %s",addr.toString().c_str()); -- cgit v1.2.3