mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-01-18 02:40:13 +00:00
No reason to randomly pick uPnP secondary port. In fact it would likely cause problems on restarts and uPnP rule bloat.
This commit is contained in:
parent
2fa21aa676
commit
72e7e36a5b
@ -493,10 +493,8 @@ public:
|
||||
// (cough Ubiquity Edge cough) barf up a lung if you do both conventional
|
||||
// NAT-t and uPnP from behind the same port. I think this is a bug, but
|
||||
// everyone else's router bugs are our problem. :P
|
||||
for(int k=0;k<256;++k) {
|
||||
unsigned int randp = 0;
|
||||
Utils::getSecureRandom(&randp,sizeof(randp));
|
||||
unsigned int upnport = 40000 + (randp % 25500);
|
||||
for(int k=0;k<512;++k) {
|
||||
unsigned int upnport = 40000 + (((port + 1) * (k + 1)) % 25500);
|
||||
|
||||
_v4UpnpLocalAddress = InetAddress(0,upnport);
|
||||
_v4UpnpUdpSocket = _phy.udpBind((const struct sockaddr *)&_v4UpnpLocalAddress,reinterpret_cast<void *>(&_v4UpnpLocalAddress),131072);
|
||||
|
Loading…
Reference in New Issue
Block a user