diff options
author | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-05-06 22:17:31 +0300 |
---|---|---|
committer | Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> | 2019-06-07 09:37:33 +0200 |
commit | 9f76e45b9d6671e2074fb7a3885db703045a791f (patch) | |
tree | 1c58194f4a7a02a49fee2fbb319bf40d92fe53d7 /src | |
parent | 8ec7121a45903eea262e7a3a120db1a937ca3b66 (diff) | |
download | bitcoin-9f76e45b9d6671e2074fb7a3885db703045a791f.tar.xz |
Drop support of insecure miniUPnPc versions
The minimum supported miniUPnPc API version is set to 10.
Diffstat (limited to 'src')
-rw-r--r-- | src/net.cpp | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/net.cpp b/src/net.cpp index 1335804b06..c073849e47 100644 --- a/src/net.cpp +++ b/src/net.cpp @@ -36,6 +36,9 @@ #include <miniupnpc/miniwget.h> #include <miniupnpc/upnpcommands.h> #include <miniupnpc/upnperrors.h> +// The minimum supported miniUPnPc API version is set to 10. This keeps compatibility +// with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages. +static_assert(MINIUPNPC_API_VERSION >= 10, "miniUPnPc API version >= 10 assumed"); #endif #include <unordered_map> @@ -1403,16 +1406,10 @@ static void ThreadMapPort() struct UPNPDev * devlist = nullptr; char lanaddr[64]; -#ifndef UPNPDISCOVER_SUCCESS - /* miniupnpc 1.5 */ - devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0); -#elif MINIUPNPC_API_VERSION < 14 - /* miniupnpc 1.6 */ int error = 0; +#if MINIUPNPC_API_VERSION < 14 devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error); #else - /* miniupnpc 1.9.20150730 */ - int error = 0; devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error); #endif @@ -1446,15 +1443,8 @@ static void ThreadMapPort() std::string strDesc = "Bitcoin " + FormatFullVersion(); do { -#ifndef UPNPDISCOVER_SUCCESS - /* miniupnpc 1.5 */ - r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, - port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0); -#else - /* miniupnpc 1.6 */ r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0"); -#endif if(r!=UPNPCOMMAND_SUCCESS) LogPrintf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", |