mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Drop support of insecure miniUPnPc versions
The minimum supported miniUPnPc API version is set to 10.
This commit is contained in:
18
src/net.cpp
18
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",
|
||||
|
||||
Reference in New Issue
Block a user