diff --git a/doc/dependencies.md b/doc/dependencies.md --- a/doc/dependencies.md +++ b/doc/dependencies.md @@ -18,7 +18,7 @@ | libevent | [2.1.11-stable](https://github.com/libevent/libevent/releases) | 2.0.22 | No | | | | libpng | | | | | Yes | | librsvg | | | | | | -| MiniUPnPc | [2.0.20180203](https://miniupnp.tuxfamily.org/files) | 1.5 | No | | | +| MiniUPnPc | [2.0.20180203](https://miniupnp.tuxfamily.org/files) | 1.9 | No | | | | Ninja | | [1.5.1](https://github.com/ninja-build/ninja/releases) | | | | | OpenSSL | [1.0.1k](https://www.openssl.org/source) | | Yes | | | | PCRE | | | | | Yes | diff --git a/doc/release-notes.md b/doc/release-notes.md --- a/doc/release-notes.md +++ b/doc/release-notes.md @@ -10,6 +10,7 @@ ----------------------- #### Removal of reject network messages from Bitcoin ABC (BIP61) + This is a follow-up on the removal of BIP61 REJECT message support in Bitcoin ABC version 0.22.5: @@ -32,3 +33,8 @@ legacy /16 prefix mapping remains the default. See `bitcoind help` for more information. This option is experimental and subject to changes or removal in future releases. + +Build system changes +-------------------- + +The minimum supported miniUPnPc version is set to 1.9 (API version 10). diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -566,7 +566,7 @@ endif() if(ENABLE_UPNP) - find_package(MiniUPnPc 1.5 REQUIRED) + find_package(MiniUPnPc 1.9 REQUIRED) target_link_libraries(server MiniUPnPc::miniupnpc) if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") diff --git a/src/net.cpp b/src/net.cpp --- a/src/net.cpp +++ b/src/net.cpp @@ -34,6 +34,10 @@ #include <miniupnpc/miniupnpc.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> @@ -1580,16 +1584,10 @@ 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 @@ -1619,20 +1617,12 @@ } } - std::string strDesc = "Bitcoin " + FormatFullVersion(); + std::string strDesc = PACKAGE_NAME " " + 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(