diff options
author | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-01 14:40:28 -0700 |
---|---|---|
committer | Adam Ierymenko <adam.ierymenko@gmail.com> | 2015-10-01 14:40:28 -0700 |
commit | 72e7e36a5b6eadcb9c2ce016269ef5bc9a54b13c (patch) | |
tree | 26fa9a4dc32addae5e4ade5926a849cefcb8baac | |
parent | 2fa21aa676d2115b287a2c6d131afcf95c6dada9 (diff) | |
download | infinitytier-72e7e36a5b6eadcb9c2ce016269ef5bc9a54b13c.tar.gz infinitytier-72e7e36a5b6eadcb9c2ce016269ef5bc9a54b13c.zip |
No reason to randomly pick uPnP secondary port. In fact it would likely cause problems on restarts and uPnP rule bloat.
-rw-r--r-- | service/OneService.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/service/OneService.cpp b/service/OneService.cpp index 35f8e806..7b3c4ff6 100644 --- a/service/OneService.cpp +++ b/service/OneService.cpp @@ -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); |