From e422bebbdc63966df984a8e5cd12d8f4c84da1b8 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 8 Jun 2012 16:35:58 +0000 Subject: [PATCH 1/3] Make IPv6 support buildtime-optional again (defaults to enabled) --- bitcoin-qt.pro | 10 +++++++++- src/makefile.linux-mingw | 7 ++++++- src/makefile.mingw | 7 ++++++- src/makefile.osx | 7 ++++++- src/makefile.unix | 7 ++++++- 5 files changed, 33 insertions(+), 5 deletions(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index beb3c5b4..f8422af3 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -2,7 +2,7 @@ TEMPLATE = app TARGET = bitcoin-qt VERSION = 0.6.99 INCLUDEPATH += src src/json src/qt -DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE USE_IPV6 +DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE CONFIG += no_include_pwd # for boost 1.37, add -mt to the boost libraries @@ -71,6 +71,14 @@ contains(FIRST_CLASS_MESSAGING, 1) { DEFINES += FIRST_CLASS_MESSAGING } +# use: qmake "USE_IPV6=1" (enabled; default) +# or: qmake "USE_IPV6=-" (not supported) +contains(USE_IPV6, -) { + message(Building without IPv6 support) +} else { + DEFINES += USE_IPV6 +} + contains(BITCOIN_NEED_QT_PLUGINS, 1) { DEFINES += BITCOIN_NEED_QT_PLUGINS QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs qtaccessiblewidgets diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index e22a9f38..174d0eee 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -5,6 +5,7 @@ DEPSDIR:=/usr/i586-mingw32msvc USE_UPNP:=0 +USE_IPV6:=1 INCLUDEPATHS= \ -I"$(CURDIR)" \ @@ -28,7 +29,7 @@ LIBS= \ -l ssl \ -l crypto -DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 +DEFS=-D_MT -DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE DEBUGFLAGS=-g CFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) @@ -40,6 +41,10 @@ ifdef USE_UPNP DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6 +endif + LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are diff --git a/src/makefile.mingw b/src/makefile.mingw index 74897656..22dc4801 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -3,6 +3,7 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. USE_UPNP:=0 +USE_IPV6:=1 INCLUDEPATHS= \ -I"C:\boost-1.49.0-mgw" \ @@ -23,7 +24,7 @@ LIBS= \ -l ssl \ -l crypto -DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 +DEFS=-DWIN32 -D_WINDOWS -DBOOST_THREAD_USE_LIB -DBOOST_SPIRIT_THREADSAFE DEBUGFLAGS=-g CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(DEBUGFLAGS) $(DEFS) $(INCLUDEPATHS) @@ -36,6 +37,10 @@ ifdef USE_UPNP DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6 +endif + LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi # TODO: make the mingw builds smarter about dependencies, like the linux/osx builds are diff --git a/src/makefile.osx b/src/makefile.osx index 97787839..ef193337 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -20,6 +20,7 @@ LIBPATHS= \ -L"$(DEPSDIR)/lib/db48" USE_UPNP:=1 +USE_IPV6:=1 LIBS= -dead_strip @@ -53,7 +54,7 @@ LIBS += \ TESTDEFS += -DBOOST_TEST_DYN_LINK endif -DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE -DUSE_IPV6 +DEFS=-DMAC_OSX -DMSG_NOSIGNAL=0 -DBOOST_SPIRIT_THREADSAFE ifdef RELEASE # Compile for maximum compatibility and smallest size. @@ -105,6 +106,10 @@ else endif endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6 +endif + all: bitcoind # auto-generated dependencies: diff --git a/src/makefile.unix b/src/makefile.unix index c9a09ad0..81337148 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -3,10 +3,11 @@ # file COPYING or http://www.opensource.org/licenses/mit-license.php. USE_UPNP:=0 +USE_IPV6:=1 LINK:=$(CXX) -DEFS=-DUSE_IPV6 -DBOOST_SPIRIT_THREADSAFE +DEFS=-DBOOST_SPIRIT_THREADSAFE DEFS += $(addprefix -I,$(CURDIR) $(CURDIR)/obj $(BOOST_INCLUDE_PATH) $(BDB_INCLUDE_PATH) $(OPENSSL_INCLUDE_PATH)) LIBS = $(addprefix -L,$(BOOST_LIB_PATH) $(BDB_LIB_PATH) $(OPENSSL_LIB_PATH)) @@ -43,6 +44,10 @@ ifneq (${USE_UPNP}, -) DEFS += -DUSE_UPNP=$(USE_UPNP) endif +ifneq (${USE_IPV6}, -) + DEFS += -DUSE_IPV6 +endif + LIBS+= \ -Wl,-B$(LMODE2) \ -l z \ From 45beb88966ff0f54606593f9cf43a5883e8acf49 Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 8 Jun 2012 16:36:40 +0000 Subject: [PATCH 2/3] Bugfix: Make USE_UPNP=- work with makefile.{linux-mingw,mingw,osx} too --- src/makefile.linux-mingw | 5 ++++- src/makefile.mingw | 5 ++++- src/makefile.osx | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index 174d0eee..059504b8 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -35,7 +35,10 @@ CFLAGS=-O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-parameter $(D TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) -ifdef USE_UPNP +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) LIBPATHS += -L"$(DEPSDIR)/miniupnpc" LIBS += -l miniupnpc -l iphlpapi DEFS += -DSTATICLIB -DUSE_UPNP=$(USE_UPNP) diff --git a/src/makefile.mingw b/src/makefile.mingw index 22dc4801..0bde965e 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -30,7 +30,10 @@ CFLAGS=-mthreads -O2 -w -Wall -Wextra -Wformat -Wformat-security -Wno-unused-par TESTDEFS = -DTEST_DATA_DIR=$(abspath test/data) -ifdef USE_UPNP +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) INCLUDEPATHS += -I"C:\miniupnpc-1.6-mgw" LIBPATHS += -L"C:\miniupnpc-1.6-mgw" LIBS += -l miniupnpc -l iphlpapi diff --git a/src/makefile.osx b/src/makefile.osx index ef193337..d4109b94 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -97,7 +97,10 @@ OBJS= \ obj/walletdb.o \ obj/noui.o -ifdef USE_UPNP +ifndef USE_UPNP + override USE_UPNP = - +endif +ifneq (${USE_UPNP}, -) DEFS += -DUSE_UPNP=$(USE_UPNP) ifdef STATIC LIBS += $(DEPSDIR)/lib/libminiupnpc.a From 9655d73f49cd4da189ddb2ed708c26dc4cb3babe Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Fri, 8 Jun 2012 16:43:06 +0000 Subject: [PATCH 3/3] Allow building with IPv6 support, but it disabled by default --- bitcoin-qt.pro | 8 ++++++-- src/init.cpp | 6 ++++++ src/makefile.linux-mingw | 2 +- src/makefile.mingw | 2 +- src/makefile.osx | 2 +- src/makefile.unix | 2 +- 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/bitcoin-qt.pro b/bitcoin-qt.pro index f8422af3..92103f1e 100644 --- a/bitcoin-qt.pro +++ b/bitcoin-qt.pro @@ -71,12 +71,16 @@ contains(FIRST_CLASS_MESSAGING, 1) { DEFINES += FIRST_CLASS_MESSAGING } -# use: qmake "USE_IPV6=1" (enabled; default) +# use: qmake "USE_IPV6=1" ( enabled by default; default) +# or: qmake "USE_IPV6=0" (disabled by default) # or: qmake "USE_IPV6=-" (not supported) contains(USE_IPV6, -) { message(Building without IPv6 support) } else { - DEFINES += USE_IPV6 + count(USE_IPV6, 0) { + USE_IPV6=1 + } + DEFINES += USE_IPV6=$$USE_IPV6 } contains(BITCOIN_NEED_QT_PLUGINS, 1) { diff --git a/src/init.cpp b/src/init.cpp index 1a1e31c2..25756c4e 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -500,6 +500,12 @@ bool AppInit2() SetLimited(net); } } +#if defined(USE_IPV6) +#if ! USE_IPV6 + else + SetLimited(NET_IPV6); +#endif +#endif CService addrProxy; bool fProxy = false; diff --git a/src/makefile.linux-mingw b/src/makefile.linux-mingw index 059504b8..ad74aa6c 100644 --- a/src/makefile.linux-mingw +++ b/src/makefile.linux-mingw @@ -45,7 +45,7 @@ ifneq (${USE_UPNP}, -) endif ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6 + DEFS += -DUSE_IPV6=$(USE_IPV6) endif LIBS += -l mingwthrd -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi diff --git a/src/makefile.mingw b/src/makefile.mingw index 0bde965e..6102dad6 100644 --- a/src/makefile.mingw +++ b/src/makefile.mingw @@ -41,7 +41,7 @@ ifneq (${USE_UPNP}, -) endif ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6 + DEFS += -DUSE_IPV6=$(USE_IPV6) endif LIBS += -l kernel32 -l user32 -l gdi32 -l comdlg32 -l winspool -l winmm -l shell32 -l comctl32 -l ole32 -l oleaut32 -l uuid -l rpcrt4 -l advapi32 -l ws2_32 -l mswsock -l shlwapi diff --git a/src/makefile.osx b/src/makefile.osx index d4109b94..de829b9e 100644 --- a/src/makefile.osx +++ b/src/makefile.osx @@ -110,7 +110,7 @@ endif endif ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6 + DEFS += -DUSE_IPV6=$(USE_IPV6) endif all: bitcoind diff --git a/src/makefile.unix b/src/makefile.unix index 81337148..ac42743d 100644 --- a/src/makefile.unix +++ b/src/makefile.unix @@ -45,7 +45,7 @@ ifneq (${USE_UPNP}, -) endif ifneq (${USE_IPV6}, -) - DEFS += -DUSE_IPV6 + DEFS += -DUSE_IPV6=$(USE_IPV6) endif LIBS+= \