Skip to content

Commit 1ad0711

Browse files
committed
Merge bitcoin/bitcoin#27016: mapport: require miniupnpc API version 17 or later
b3b673f mapport: require miniupnpc API version 17 or later (fanquake) Pull request description: Version 17 is currently the latest version, see: https://github.com/miniupnp/miniupnp/blob/master/miniupnpc/apiversions.txt, and has been available since the release of 2.1. 2.1 or newer is readily available across all distros, see https://repology.org/project/miniupnpc/versions, so drop support for the older API versions. Split out of #22644. ACKs for top commit: hebasto: ACK b3b673f, tested on Ubuntu 20.04 w/ and w/o [`libminiupnpc-dev`](https://packages.ubuntu.com/focal/libminiupnpc-dev) package. TheCharlatan: ACK b3b673f Tree-SHA512: f53b36b82462c4ea83d9b83413dca8097885d1620f7ca0a53a79d6b3d3cf37c7773828b23f4278ccfcc3b14fcb0faffa35f60191b519b04570f3d2783d0303e2
2 parents 8126551 + b3b673f commit 1ad0711

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
@@ -1418,14 +1418,15 @@ if test "$use_upnp" != "no"; then
14181418
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS="$MINIUPNPC_LIBS -lminiupnpc"], [have_miniupnpc=no], [$MINIUPNPC_LIBS])],
14191419
[have_miniupnpc=no]
14201420
)
1421-
dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
1422-
dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
1421+
1422+
dnl The minimum supported miniUPnPc API version is set to 17. This excludes
1423+
dnl versions with known vulnerabilities.
14231424
if test "$have_miniupnpc" != "no"; then
14241425
AC_MSG_CHECKING([whether miniUPnPc API version is supported])
14251426
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
14261427
@%:@include <miniupnpc/miniupnpc.h>
14271428
]], [[
1428-
#if MINIUPNPC_API_VERSION >= 10
1429+
#if MINIUPNPC_API_VERSION >= 17
14291430
// Everything is okay
14301431
#else
14311432
# error miniUPnPc API version is too old
@@ -1434,7 +1435,7 @@ if test "$use_upnp" != "no"; then
14341435
AC_MSG_RESULT([yes])
14351436
],[
14361437
AC_MSG_RESULT([no])
1437-
AC_MSG_WARN([miniUPnPc API version < 10 is unsupported, disabling UPnP support.])
1438+
AC_MSG_WARN([miniUPnPc API version < 17 is unsupported, disabling UPnP support.])
14381439
have_miniupnpc=no
14391440
])
14401441
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)