mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-04-22 06:56:54 +02:00
Merge commit 'ff655292fba09c0a0d1ed4b4dda738c165ad4404' into edge
This commit is contained in:
commit
41871c8b1e
1 changed files with 15 additions and 12 deletions
|
@ -100,6 +100,7 @@
|
|||
#include <mutex>
|
||||
#include <list>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
|
||||
#include "geoip-html.h"
|
||||
|
||||
|
@ -895,16 +896,16 @@ int main(int argc,char **argv)
|
|||
|
||||
threads.push_back(std::thread([s6,s4]() {
|
||||
struct sockaddr_in6 in6;
|
||||
Packet pkt;
|
||||
memset(&in6,0,sizeof(in6));
|
||||
Packet *pkt = new Packet();
|
||||
for(;;) {
|
||||
memset(&in6,0,sizeof(in6));
|
||||
socklen_t sl = sizeof(in6);
|
||||
const int pl = (int)recvfrom(s6,pkt.unsafeData(),pkt.capacity(),RECVFROM_FLAGS,(struct sockaddr *)&in6,&sl);
|
||||
const int pl = (int)recvfrom(s6,pkt->unsafeData(),pkt->capacity(),RECVFROM_FLAGS,(struct sockaddr *)&in6,&sl);
|
||||
if (pl > 0) {
|
||||
if (pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH) {
|
||||
if ((pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH)&&(pl <= ZT_PROTO_MAX_PACKET_LENGTH)) {
|
||||
try {
|
||||
pkt.setSize((unsigned int)pl);
|
||||
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in6),pkt);
|
||||
pkt->setSize((unsigned int)pl);
|
||||
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in6),*pkt);
|
||||
} catch (std::exception &exc) {
|
||||
char ipstr[128];
|
||||
printf("WARNING: unexpected exception handling packet from %s: %s" ZT_EOL_S,reinterpret_cast<const InetAddress *>(&in6)->toString(ipstr),exc.what());
|
||||
|
@ -920,20 +921,21 @@ int main(int argc,char **argv)
|
|||
break;
|
||||
}
|
||||
}
|
||||
delete pkt;
|
||||
}));
|
||||
|
||||
threads.push_back(std::thread([s6,s4]() {
|
||||
struct sockaddr_in in4;
|
||||
Packet pkt;
|
||||
memset(&in4,0,sizeof(in4));
|
||||
Packet *pkt = new Packet();
|
||||
for(;;) {
|
||||
memset(&in4,0,sizeof(in4));
|
||||
socklen_t sl = sizeof(in4);
|
||||
const int pl = (int)recvfrom(s4,pkt.unsafeData(),pkt.capacity(),RECVFROM_FLAGS,(struct sockaddr *)&in4,&sl);
|
||||
const int pl = (int)recvfrom(s4,pkt->unsafeData(),pkt->capacity(),RECVFROM_FLAGS,(struct sockaddr *)&in4,&sl);
|
||||
if (pl > 0) {
|
||||
if (pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH) {
|
||||
if ((pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH)&&(pl <= ZT_PROTO_MAX_PACKET_LENGTH)) {
|
||||
try {
|
||||
pkt.setSize((unsigned int)pl);
|
||||
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in4),pkt);
|
||||
pkt->setSize((unsigned int)pl);
|
||||
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in4),*pkt);
|
||||
} catch (std::exception &exc) {
|
||||
char ipstr[128];
|
||||
printf("WARNING: unexpected exception handling packet from %s: %s" ZT_EOL_S,reinterpret_cast<const InetAddress *>(&in4)->toString(ipstr),exc.what());
|
||||
|
@ -949,6 +951,7 @@ int main(int argc,char **argv)
|
|||
break;
|
||||
}
|
||||
}
|
||||
delete pkt;
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue