mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-06-06 12:33:44 +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 <mutex>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
#include "geoip-html.h"
|
#include "geoip-html.h"
|
||||||
|
|
||||||
|
@ -895,16 +896,16 @@ int main(int argc,char **argv)
|
||||||
|
|
||||||
threads.push_back(std::thread([s6,s4]() {
|
threads.push_back(std::thread([s6,s4]() {
|
||||||
struct sockaddr_in6 in6;
|
struct sockaddr_in6 in6;
|
||||||
Packet pkt;
|
Packet *pkt = new Packet();
|
||||||
memset(&in6,0,sizeof(in6));
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
memset(&in6,0,sizeof(in6));
|
||||||
socklen_t sl = 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 > 0) {
|
||||||
if (pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH) {
|
if ((pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH)&&(pl <= ZT_PROTO_MAX_PACKET_LENGTH)) {
|
||||||
try {
|
try {
|
||||||
pkt.setSize((unsigned int)pl);
|
pkt->setSize((unsigned int)pl);
|
||||||
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in6),pkt);
|
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in6),*pkt);
|
||||||
} catch (std::exception &exc) {
|
} catch (std::exception &exc) {
|
||||||
char ipstr[128];
|
char ipstr[128];
|
||||||
printf("WARNING: unexpected exception handling packet from %s: %s" ZT_EOL_S,reinterpret_cast<const InetAddress *>(&in6)->toString(ipstr),exc.what());
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete pkt;
|
||||||
}));
|
}));
|
||||||
|
|
||||||
threads.push_back(std::thread([s6,s4]() {
|
threads.push_back(std::thread([s6,s4]() {
|
||||||
struct sockaddr_in in4;
|
struct sockaddr_in in4;
|
||||||
Packet pkt;
|
Packet *pkt = new Packet();
|
||||||
memset(&in4,0,sizeof(in4));
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
memset(&in4,0,sizeof(in4));
|
||||||
socklen_t sl = 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 > 0) {
|
||||||
if (pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH) {
|
if ((pl >= ZT_PROTO_MIN_FRAGMENT_LENGTH)&&(pl <= ZT_PROTO_MAX_PACKET_LENGTH)) {
|
||||||
try {
|
try {
|
||||||
pkt.setSize((unsigned int)pl);
|
pkt->setSize((unsigned int)pl);
|
||||||
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in4),pkt);
|
handlePacket(s4,s6,reinterpret_cast<const InetAddress *>(&in4),*pkt);
|
||||||
} catch (std::exception &exc) {
|
} catch (std::exception &exc) {
|
||||||
char ipstr[128];
|
char ipstr[128];
|
||||||
printf("WARNING: unexpected exception handling packet from %s: %s" ZT_EOL_S,reinterpret_cast<const InetAddress *>(&in4)->toString(ipstr),exc.what());
|
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;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete pkt;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue