Adam Ierymenko 6 years ago
parent
commit
e07a019615
2 changed files with 3 additions and 2 deletions
  1. 1 1
      node/IncomingPacket.cpp
  2. 2 1
      root/root.cpp

+ 1 - 1
node/IncomingPacket.cpp

@@ -655,7 +655,7 @@ bool IncomingPacket::_doMULTICAST_LIKE(const RuntimeEnvironment *RR,void *tPtr,c
 	uint64_t lastNwid = 0;
 	uint64_t lastNwid = 0;
 
 
 	// Packet contains a series of 18-byte network,MAC,ADI tuples
 	// Packet contains a series of 18-byte network,MAC,ADI tuples
-	for(unsigned int ptr=ZT_PACKET_IDX_PAYLOAD;ptr<size();ptr+=18) {
+	for(unsigned int ptr=ZT_PACKET_IDX_PAYLOAD;(ptr+18)<=size();ptr+=18) {
 		const uint64_t nwid = at<uint64_t>(ptr);
 		const uint64_t nwid = at<uint64_t>(ptr);
 		if (nwid != lastNwid) {
 		if (nwid != lastNwid) {
 			lastNwid = nwid;
 			lastNwid = nwid;

+ 2 - 1
root/root.cpp

@@ -212,13 +212,14 @@ static void handlePacket(const int sock,const InetAddress *const ip,Packet &pkt)
 						ip->serialize(pkt);
 						ip->serialize(pkt);
 						pkt.armor(peer->key,true);
 						pkt.armor(peer->key,true);
 						sendto(sock,pkt.data(),pkt.size(),0,(const struct sockaddr *)ip,(socklen_t)((ip->ss_family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)));
 						sendto(sock,pkt.data(),pkt.size(),0,(const struct sockaddr *)ip,(socklen_t)((ip->ss_family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6)));
+						printf("%s <- OK(HELLO)" ZT_EOL_S,ip->toString(ipstr));
 					}
 					}
 				}	break;
 				}	break;
 
 
 				case Packet::VERB_MULTICAST_LIKE: {
 				case Packet::VERB_MULTICAST_LIKE: {
 					printf("LIKE\n");
 					printf("LIKE\n");
 					Mutex::Lock l(peer->multicastGroups_l);
 					Mutex::Lock l(peer->multicastGroups_l);
-					for(unsigned int ptr=ZT_PACKET_IDX_PAYLOAD;ptr<pkt.size();ptr+=18) {
+					for(unsigned int ptr=ZT_PACKET_IDX_PAYLOAD;(ptr+18)<=pkt.size();ptr+=18) {
 						const uint64_t nwid = pkt.template at<uint64_t>(ptr);
 						const uint64_t nwid = pkt.template at<uint64_t>(ptr);
 						const MulticastGroup mg(MAC(pkt.field(ptr + 8,6),6),pkt.template at<uint32_t>(ptr + 14));
 						const MulticastGroup mg(MAC(pkt.field(ptr + 8,6),6),pkt.template at<uint32_t>(ptr + 14));
 						peer->multicastGroups[nwid][mg] = now;
 						peer->multicastGroups[nwid][mg] = now;