Skip to content

Commit b3b673f

Browse files
committed
mapport: require miniupnpc API version 17 or later
Version 17 is currently the latest version, and has been available since the release of 2.1. See: https://github.com/miniupnp/miniupnp/blob/master/miniupnpc/apiversions.txt.
1 parent 2d5acc9 commit b3b673f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

configure.ac

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1416,14 +1416,15 @@ if test "$use_upnp" != "no"; then
14161416
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc"], [have_miniupnpc=no], [$MINIUPNPC_LIBS])],
14171417
[have_miniupnpc=no]
14181418
)
1419-
dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1420-
dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1419+
1420+
dnl The minimum supported miniUPnPc API version is set to 17. This excludes
1421+
dnl versions with known vulnerabilities.
14211422
if test "$have_miniupnpc" != "no"; then
14221423
AC_MSG_CHECKING([whether miniUPnPc API version is supported])
14231424
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
14241425
@%:@include <miniupnpc/miniupnpc.h>
14251426
]], [[
1426-
#if MINIUPNPC_API_VERSION >= 10
1427+
#if MINIUPNPC_API_VERSION >= 17
14271428
// Everything is okay
14281429
#else
14291430
# error miniUPnPc API version is too old
@@ -1432,7 +1433,7 @@ if test "$use_upnp" != "no"; then
14321433
AC_MSG_RESULT([yes])
14331434
],[
14341435
AC_MSG_RESULT([no])
1435-
AC_MSG_WARN([miniUPnPc API version < 10 is unsupported, disabling UPnP support.])
1436+
AC_MSG_WARN([miniUPnPc API version < 17 is unsupported, disabling UPnP support.])
14361437
have_miniupnpc=no
14371438
])
14381439
fi

doc/dependencies.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ You can find installation instructions in the `build-*.md` file for your platfor
3636
| Dependency | Releases | Version used | Minimum required | Runtime |
3737
| --- | --- | --- | --- | --- |
3838
| [libnatpmp](../depends/packages/libnatpmp.mk) | [link](https://github.com/miniupnp/libnatpmp/) | commit [07004b9...](https://github.com/bitcoin/bitcoin/pull/25917) | | No |
39-
| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.2](https://github.com/bitcoin/bitcoin/pull/20421) | 1.9 | No |
39+
| [MiniUPnPc](../depends/packages/miniupnpc.mk) | [link](https://miniupnp.tuxfamily.org/) | [2.2.2](https://github.com/bitcoin/bitcoin/pull/20421) | 2.1 | No |
4040

4141
### Notifications
4242
| Dependency | Releases | Version used | Minimum required | Runtime |

src/mapport.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
#include <miniupnpc/miniupnpc.h>
2828
#include <miniupnpc/upnpcommands.h>
2929
#include <miniupnpc/upnperrors.h>
30-
// The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
31-
// with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
32-
static_assert(MINIUPNPC_API_VERSION >= 10, "miniUPnPc API version >= 10 assumed");
30+
// The minimum supported miniUPnPc API version is set to 17. This excludes
31+
// versions with known vulnerabilities.
32+
static_assert(MINIUPNPC_API_VERSION >= 17, "miniUPnPc API version >= 17 assumed");
3333
#endif // USE_UPNP
3434

3535
#include <atomic>
@@ -159,11 +159,7 @@ static bool ProcessUpnp()
159159
char lanaddr[64];
160160

161161
int error = 0;
162-
#if MINIUPNPC_API_VERSION < 14
163-
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, &error);
164-
#else
165162
devlist = upnpDiscover(2000, multicastif, minissdpdpath, 0, 0, 2, &error);
166-
#endif
167163

168164
struct UPNPUrls urls;
169165
struct IGDdatas data;

0 commit comments

Comments
 (0)