mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 12:32:48 +01:00
Remove build-time no-IPv6 setting
The year is 2014. All supported operating systems have IPv6 support, most certainly at build time (this doesn't mean that IPv6 is configured, of course). If noone is exercising the functionality to disable it, that means it doesn't get tested, and IMO it's better to get rid of it. (it's also not used consistently in RPC/boost and Net code...)
This commit is contained in:
parent
426dc16f7b
commit
e27c4110d9
45
configure.ac
45
configure.ac
@ -62,13 +62,6 @@ AC_ARG_ENABLE([upnp-default],
|
||||
[use_upnp_default=$enableval],
|
||||
[use_upnp_default=no])
|
||||
|
||||
dnl enable ipv6 support
|
||||
AC_ARG_ENABLE([ipv6],
|
||||
[AS_HELP_STRING([--enable-ipv6],
|
||||
[enable ipv6 (default is yes)])],
|
||||
[use_ipv6=$enableval],
|
||||
[use_ipv6=yes])
|
||||
|
||||
AC_ARG_ENABLE(tests,
|
||||
AS_HELP_STRING([--enable-tests],[compile tests (default is yes)]),
|
||||
[use_tests=$enableval],
|
||||
@ -560,27 +553,6 @@ AC_MSG_RESULT($build_bitcoin_cli)
|
||||
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
|
||||
BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4])
|
||||
|
||||
|
||||
if test x$use_ipv6 = xyes; then
|
||||
dnl Check for ipv6 build requirements
|
||||
AC_MSG_CHECKING(for operating system IPv6 support)
|
||||
AC_TRY_LINK([
|
||||
#if defined(_WINDOWS)
|
||||
#include <winsock2.h>
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#endif
|
||||
],[
|
||||
#if !defined(_WINDOWS)
|
||||
struct in6_addr ipv6Addr;
|
||||
struct sockaddr_in6 addr;
|
||||
#endif
|
||||
int temp = socket(AF_INET6, SOCK_STREAM, 0);],
|
||||
[AC_MSG_RESULT(yes); have_ipv6=yes; AC_DEFINE(HAVE_IPV6, 1, [Define this symbol if you have operating system IPv6 support])],
|
||||
[AC_MSG_RESULT(no)]; have_ipv6=no)
|
||||
fi
|
||||
AC_LANG_POP
|
||||
|
||||
if test "x$use_ccache" != "xno"; then
|
||||
@ -609,22 +581,6 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
|
||||
dnl enable ipv6 support
|
||||
AC_MSG_CHECKING([whether to build with support for IPv6])
|
||||
if test x$have_ipv6 = xno; then
|
||||
if test x$use_ipv6 = xyes; then
|
||||
AC_MSG_ERROR([IPv6 requested, but cannot be built. use --disable-ipv6])
|
||||
fi
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
if test x$use_ipv6 = xyes; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([USE_IPV6],[1],[Define if IPv6 support should be compiled in])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl enable upnp support
|
||||
AC_MSG_CHECKING([whether to build with support for UPnP])
|
||||
if test x$have_miniupnpc = xno; then
|
||||
@ -730,7 +686,6 @@ AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
|
||||
|
||||
AC_SUBST(USE_UPNP)
|
||||
AC_SUBST(USE_QRCODE)
|
||||
AC_SUBST(USE_IPV6)
|
||||
AC_SUBST(INCLUDES)
|
||||
AC_SUBST(BOOST_LIBS)
|
||||
AC_SUBST(TESTDEFS)
|
||||
|
@ -32,10 +32,6 @@ turned off by default. See the configure options for upnp behavior desired:
|
||||
--disable-upnp-default (the default) UPnP support turned off by default at runtime
|
||||
--enable-upnp-default UPnP support turned on by default at runtime
|
||||
|
||||
IPv6 support may be disabled by setting:
|
||||
|
||||
--disable-ipv6 Disable IPv6 support
|
||||
|
||||
Licenses of statically linked libraries:
|
||||
Berkeley DB New BSD license with additional requirement that linked
|
||||
software must be free open source
|
||||
|
10
src/init.cpp
10
src/init.cpp
@ -689,12 +689,6 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||
SetLimited(net);
|
||||
}
|
||||
}
|
||||
#if defined(USE_IPV6)
|
||||
#if ! USE_IPV6
|
||||
else
|
||||
SetLimited(NET_IPV6);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
CService addrProxy;
|
||||
bool fProxy = false;
|
||||
@ -706,10 +700,8 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||
if (!IsLimited(NET_IPV4))
|
||||
SetProxy(NET_IPV4, addrProxy, nSocksVersion);
|
||||
if (nSocksVersion > 4) {
|
||||
#ifdef USE_IPV6
|
||||
if (!IsLimited(NET_IPV6))
|
||||
SetProxy(NET_IPV6, addrProxy, nSocksVersion);
|
||||
#endif
|
||||
SetNameProxy(addrProxy, nSocksVersion);
|
||||
}
|
||||
fProxy = true;
|
||||
@ -751,9 +743,7 @@ bool AppInit2(boost::thread_group& threadGroup)
|
||||
else {
|
||||
struct in_addr inaddr_any;
|
||||
inaddr_any.s_addr = INADDR_ANY;
|
||||
#ifdef USE_IPV6
|
||||
fBound |= Bind(CService(in6addr_any, GetListenPort()), BF_NONE);
|
||||
#endif
|
||||
fBound |= Bind(CService(inaddr_any, GetListenPort()), !fBound ? BF_REPORT_ERROR : BF_NONE);
|
||||
}
|
||||
if (!fBound)
|
||||
|
12
src/net.cpp
12
src/net.cpp
@ -917,11 +917,7 @@ void ThreadSocketHandler()
|
||||
BOOST_FOREACH(SOCKET hListenSocket, vhListenSocket)
|
||||
if (hListenSocket != INVALID_SOCKET && FD_ISSET(hListenSocket, &fdsetRecv))
|
||||
{
|
||||
#ifdef USE_IPV6
|
||||
struct sockaddr_storage sockaddr;
|
||||
#else
|
||||
struct sockaddr sockaddr;
|
||||
#endif
|
||||
socklen_t len = sizeof(sockaddr);
|
||||
SOCKET hSocket = accept(hListenSocket, (struct sockaddr*)&sockaddr, &len);
|
||||
CAddress addr;
|
||||
@ -1582,11 +1578,7 @@ bool BindListenPort(const CService &addrBind, string& strError)
|
||||
int nOne = 1;
|
||||
|
||||
// Create socket for listening for incoming connections
|
||||
#ifdef USE_IPV6
|
||||
struct sockaddr_storage sockaddr;
|
||||
#else
|
||||
struct sockaddr sockaddr;
|
||||
#endif
|
||||
socklen_t len = sizeof(sockaddr);
|
||||
if (!addrBind.GetSockAddr((struct sockaddr*)&sockaddr, &len))
|
||||
{
|
||||
@ -1627,7 +1619,6 @@ bool BindListenPort(const CService &addrBind, string& strError)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
// some systems don't have IPV6_V6ONLY but are always v6only; others do have the option
|
||||
// and enable it by default or not. Try to enable it, if possible.
|
||||
if (addrBind.IsIPv6()) {
|
||||
@ -1645,7 +1636,6 @@ bool BindListenPort(const CService &addrBind, string& strError)
|
||||
setsockopt(hListenSocket, IPPROTO_IPV6, nParameterId, (const char*)&nProtLevel, sizeof(int));
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
if (::bind(hListenSocket, (struct sockaddr*)&sockaddr, len) == SOCKET_ERROR)
|
||||
{
|
||||
@ -1712,7 +1702,6 @@ void static Discover(boost::thread_group& threadGroup)
|
||||
if (AddLocal(addr, LOCAL_IF))
|
||||
LogPrintf("IPv4 %s: %s\n", ifa->ifa_name, addr.ToString());
|
||||
}
|
||||
#ifdef USE_IPV6
|
||||
else if (ifa->ifa_addr->sa_family == AF_INET6)
|
||||
{
|
||||
struct sockaddr_in6* s6 = (struct sockaddr_in6*)(ifa->ifa_addr);
|
||||
@ -1720,7 +1709,6 @@ void static Discover(boost::thread_group& threadGroup)
|
||||
if (AddLocal(addr, LOCAL_IF))
|
||||
LogPrintf("IPv6 %s: %s\n", ifa->ifa_name, addr.ToString());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
freeifaddrs(myaddrs);
|
||||
}
|
||||
|
@ -78,11 +78,7 @@ bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsign
|
||||
|
||||
aiHint.ai_socktype = SOCK_STREAM;
|
||||
aiHint.ai_protocol = IPPROTO_TCP;
|
||||
#ifdef USE_IPV6
|
||||
aiHint.ai_family = AF_UNSPEC;
|
||||
#else
|
||||
aiHint.ai_family = AF_INET;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
aiHint.ai_flags = fAllowLookup ? 0 : AI_NUMERICHOST;
|
||||
#else
|
||||
@ -102,13 +98,11 @@ bool static LookupIntern(const char *pszName, std::vector<CNetAddr>& vIP, unsign
|
||||
vIP.push_back(CNetAddr(((struct sockaddr_in*)(aiTrav->ai_addr))->sin_addr));
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
if (aiTrav->ai_family == AF_INET6)
|
||||
{
|
||||
assert(aiTrav->ai_addrlen >= sizeof(sockaddr_in6));
|
||||
vIP.push_back(CNetAddr(((struct sockaddr_in6*)(aiTrav->ai_addr))->sin6_addr));
|
||||
}
|
||||
#endif
|
||||
|
||||
aiTrav = aiTrav->ai_next;
|
||||
}
|
||||
@ -321,11 +315,7 @@ bool static ConnectSocketDirectly(const CService &addrConnect, SOCKET& hSocketRe
|
||||
{
|
||||
hSocketRet = INVALID_SOCKET;
|
||||
|
||||
#ifdef USE_IPV6
|
||||
struct sockaddr_storage sockaddr;
|
||||
#else
|
||||
struct sockaddr sockaddr;
|
||||
#endif
|
||||
socklen_t len = sizeof(sockaddr);
|
||||
if (!addrConnect.GetSockAddr((struct sockaddr*)&sockaddr, &len)) {
|
||||
LogPrintf("Cannot connect to %s: unsupported network\n", addrConnect.ToString());
|
||||
@ -585,12 +575,10 @@ CNetAddr::CNetAddr(const struct in_addr& ipv4Addr)
|
||||
memcpy(ip+12, &ipv4Addr, 4);
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
CNetAddr::CNetAddr(const struct in6_addr& ipv6Addr)
|
||||
{
|
||||
memcpy(ip, &ipv6Addr, 16);
|
||||
}
|
||||
#endif
|
||||
|
||||
CNetAddr::CNetAddr(const char *pszIp, bool fAllowLookup)
|
||||
{
|
||||
@ -764,11 +752,7 @@ std::string CNetAddr::ToStringIP() const
|
||||
if (IsTor())
|
||||
return EncodeBase32(&ip[6], 10) + ".onion";
|
||||
CService serv(*this, 0);
|
||||
#ifdef USE_IPV6
|
||||
struct sockaddr_storage sockaddr;
|
||||
#else
|
||||
struct sockaddr sockaddr;
|
||||
#endif
|
||||
socklen_t socklen = sizeof(sockaddr);
|
||||
if (serv.GetSockAddr((struct sockaddr*)&sockaddr, &socklen)) {
|
||||
char name[1025] = "";
|
||||
@ -813,13 +797,11 @@ bool CNetAddr::GetInAddr(struct in_addr* pipv4Addr) const
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
bool CNetAddr::GetIn6Addr(struct in6_addr* pipv6Addr) const
|
||||
{
|
||||
memcpy(pipv6Addr, ip, 16);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
// get canonical identifier of an address' group
|
||||
// no two connections will be attempted to addresses with the same group
|
||||
@ -993,23 +975,19 @@ CService::CService(const struct in_addr& ipv4Addr, unsigned short portIn) : CNet
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
CService::CService(const struct in6_addr& ipv6Addr, unsigned short portIn) : CNetAddr(ipv6Addr), port(portIn)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
CService::CService(const struct sockaddr_in& addr) : CNetAddr(addr.sin_addr), port(ntohs(addr.sin_port))
|
||||
{
|
||||
assert(addr.sin_family == AF_INET);
|
||||
}
|
||||
|
||||
#ifdef USE_IPV6
|
||||
CService::CService(const struct sockaddr_in6 &addr) : CNetAddr(addr.sin6_addr), port(ntohs(addr.sin6_port))
|
||||
{
|
||||
assert(addr.sin6_family == AF_INET6);
|
||||
}
|
||||
#endif
|
||||
|
||||
bool CService::SetSockAddr(const struct sockaddr *paddr)
|
||||
{
|
||||
@ -1017,11 +995,9 @@ bool CService::SetSockAddr(const struct sockaddr *paddr)
|
||||
case AF_INET:
|
||||
*this = CService(*(const struct sockaddr_in*)paddr);
|
||||
return true;
|
||||
#ifdef USE_IPV6
|
||||
case AF_INET6:
|
||||
*this = CService(*(const struct sockaddr_in6*)paddr);
|
||||
return true;
|
||||
#endif
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -1093,7 +1069,6 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
|
||||
paddrin->sin_port = htons(port);
|
||||
return true;
|
||||
}
|
||||
#ifdef USE_IPV6
|
||||
if (IsIPv6()) {
|
||||
if (*addrlen < (socklen_t)sizeof(struct sockaddr_in6))
|
||||
return false;
|
||||
@ -1106,7 +1081,6 @@ bool CService::GetSockAddr(struct sockaddr* paddr, socklen_t *addrlen) const
|
||||
paddrin6->sin6_port = htons(port);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -77,10 +77,8 @@ class CNetAddr
|
||||
int GetReachabilityFrom(const CNetAddr *paddrPartner = NULL) const;
|
||||
void print() const;
|
||||
|
||||
#ifdef USE_IPV6
|
||||
CNetAddr(const struct in6_addr& pipv6Addr);
|
||||
bool GetIn6Addr(struct in6_addr* pipv6Addr) const;
|
||||
#endif
|
||||
|
||||
friend bool operator==(const CNetAddr& a, const CNetAddr& b);
|
||||
friend bool operator!=(const CNetAddr& a, const CNetAddr& b);
|
||||
@ -121,10 +119,8 @@ class CService : public CNetAddr
|
||||
std::string ToStringIPPort() const;
|
||||
void print() const;
|
||||
|
||||
#ifdef USE_IPV6
|
||||
CService(const struct in6_addr& ipv6Addr, unsigned short port);
|
||||
CService(const struct sockaddr_in6& addr);
|
||||
#endif
|
||||
|
||||
IMPLEMENT_SERIALIZE
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user