mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-18 13:17:55 +02:00
Merge b21acab82f into merged_master (Bitcoin PR #15993)
Just kept our version of Travis since I couldn't test it. We'll fix this after the fact.
This commit is contained in:
commit
8dfba71046
3 changed files with 42 additions and 32 deletions
23
configure.ac
23
configure.ac
|
|
@ -1019,6 +1019,26 @@ if test x$use_upnp != xno; then
|
|||
[AC_CHECK_LIB([miniupnpc], [upnpDiscover], [MINIUPNPC_LIBS=-lminiupnpc], [have_miniupnpc=no])],
|
||||
[have_miniupnpc=no]
|
||||
)
|
||||
dnl The minimum supported miniUPnPc API version is set to 10. This keeps compatibility
|
||||
dnl with Ubuntu 16.04 LTS and Debian 8 libminiupnpc-dev packages.
|
||||
if test x$have_miniupnpc != xno; then
|
||||
AC_MSG_CHECKING([whether miniUPnPc API version is supported])
|
||||
AC_PREPROC_IFELSE([AC_LANG_PROGRAM([[
|
||||
@%:@include <miniupnpc/miniupnpc.h>
|
||||
]], [[
|
||||
#if MINIUPNPC_API_VERSION >= 10
|
||||
// Everything is okay
|
||||
#else
|
||||
# error miniUPnPc API version is too old
|
||||
#endif
|
||||
]])],[
|
||||
AC_MSG_RESULT(yes)
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
AC_MSG_WARN([miniUPnPc API version < 10 is unsupported, disabling UPnP support.])
|
||||
have_miniupnpc=no
|
||||
])
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$build_bitcoin_wallet$build_bitcoin_cli$build_bitcoin_tx$build_bitcoind$bitcoin_enable_qt$use_tests$use_bench = xnonononononono; then
|
||||
|
|
@ -1412,9 +1432,10 @@ dnl enable upnp support
|
|||
AC_MSG_CHECKING([whether to build with support for UPnP])
|
||||
if test x$have_miniupnpc = xno; then
|
||||
if test x$use_upnp = xyes; then
|
||||
AC_MSG_ERROR("UPnP requested but cannot be built. use --without-miniupnpc")
|
||||
AC_MSG_ERROR("UPnP requested but cannot be built. Use --without-miniupnpc.")
|
||||
fi
|
||||
AC_MSG_RESULT(no)
|
||||
use_upnp=no
|
||||
else
|
||||
if test x$use_upnp != xno; then
|
||||
AC_MSG_RESULT(yes)
|
||||
|
|
|
|||
3
doc/release-notes-15993.md
Normal file
3
doc/release-notes-15993.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
Build system changes
|
||||
--------------------
|
||||
The minimum supported miniUPnPc API version is set to 10. This keeps compatibility with Ubuntu 16.04 LTS and Debian 8 `libminiupnpc-dev` packages. Please note, on Debian this package is still vulnerable to [CVE-2017-8798](https://security-tracker.debian.org/tracker/CVE-2017-8798) (in jessie only) and [CVE-2017-1000494](https://security-tracker.debian.org/tracker/CVE-2017-1000494) (both in jessie and in stretch).
|
||||
48
src/net.cpp
48
src/net.cpp
|
|
@ -37,6 +37,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>
|
||||
|
|
@ -1404,16 +1407,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
|
||||
|
||||
|
|
@ -1427,43 +1424,32 @@ static void ThreadMapPort()
|
|||
if (fDiscover) {
|
||||
char externalIPAddress[40];
|
||||
r = UPNP_GetExternalIPAddress(urls.controlURL, data.first.servicetype, externalIPAddress);
|
||||
if(r != UPNPCOMMAND_SUCCESS)
|
||||
if (r != UPNPCOMMAND_SUCCESS) {
|
||||
LogPrintf("UPnP: GetExternalIPAddress() returned %d\n", r);
|
||||
else
|
||||
{
|
||||
if(externalIPAddress[0])
|
||||
{
|
||||
} else {
|
||||
if (externalIPAddress[0]) {
|
||||
CNetAddr resolved;
|
||||
if(LookupHost(externalIPAddress, resolved, false)) {
|
||||
if (LookupHost(externalIPAddress, resolved, false)) {
|
||||
LogPrintf("UPnP: ExternalIPAddress = %s\n", resolved.ToString().c_str());
|
||||
AddLocal(resolved, LOCAL_UPNP);
|
||||
}
|
||||
}
|
||||
else
|
||||
} else {
|
||||
LogPrintf("UPnP: GetExternalIPAddress failed.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
r = UPNP_AddPortMapping(urls.controlURL, data.first.servicetype, port.c_str(), port.c_str(), lanaddr, strDesc.c_str(), "TCP", 0, "0");
|
||||
|
||||
if(r!=UPNPCOMMAND_SUCCESS)
|
||||
LogPrintf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n",
|
||||
port, port, lanaddr, r, strupnperror(r));
|
||||
else
|
||||
if (r != UPNPCOMMAND_SUCCESS) {
|
||||
LogPrintf("AddPortMapping(%s, %s, %s) failed with code %d (%s)\n", port, port, lanaddr, r, strupnperror(r));
|
||||
} else {
|
||||
LogPrintf("UPnP Port Mapping successful.\n");
|
||||
}
|
||||
while(g_upnp_interrupt.sleep_for(std::chrono::minutes(20)));
|
||||
}
|
||||
} while (g_upnp_interrupt.sleep_for(std::chrono::minutes(20)));
|
||||
|
||||
r = UPNP_DeletePortMapping(urls.controlURL, data.first.servicetype, port.c_str(), "TCP", 0);
|
||||
LogPrintf("UPNP_DeletePortMapping() returned: %d\n", r);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue