From f727d6d02cd5ea649a4f4895e015622060e45078 Mon Sep 17 00:00:00 2001 From: Darshaka Pathirana Date: Sun, 19 Jan 2020 17:35:47 +0100 Subject: [PATCH] New upstream version 0.3.8 --- ChangeLog | 4 +++ contrib/build-openssl-mingw-cross.sh | 2 +- contrib/make-mingw-release.sh | 2 +- contrib/openssl-1.1.0h-configure.patch | 32 +++++++++++++++++++++ doc/anytun-config.8 | 4 +-- doc/anytun-controld.8 | 4 +-- doc/anytun-showtables.8 | 4 +-- doc/anytun.8 | 10 +++---- doc/anytun.8.txt | 6 ++-- src/Makefile | 14 +++++----- src/anytunError.h | 1 + src/configure | 51 +++++++++++++++++----------------- src/resolver.cpp | 1 + src/syncServer.cpp | 4 +++ src/syncTcpConnection.cpp | 8 ++++++ src/syncTcpConnection.h | 10 +++++++ version | 2 +- 17 files changed, 110 insertions(+), 49 deletions(-) create mode 100644 contrib/openssl-1.1.0h-configure.patch diff --git a/ChangeLog b/ChangeLog index 9348e7e..097dce0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2020.01.06 -- version 0.3.8 + +* fix build for Boost 1.71 + 2018.06.08 -- version 0.3.7 * fix build for new versions of GCC and Boost diff --git a/contrib/build-openssl-mingw-cross.sh b/contrib/build-openssl-mingw-cross.sh index 4c00f5d..332ef61 100755 --- a/contrib/build-openssl-mingw-cross.sh +++ b/contrib/build-openssl-mingw-cross.sh @@ -1,6 +1,6 @@ #!/bin/sh set -e -OPENSSL=openssl-1.0.2h +OPENSSL=openssl-1.1.0h BASE=`pwd` wget http://openssl.org/source/$OPENSSL.tar.gz -O - | tar xz diff --git a/contrib/make-mingw-release.sh b/contrib/make-mingw-release.sh index 4df517a..673b73c 100755 --- a/contrib/make-mingw-release.sh +++ b/contrib/make-mingw-release.sh @@ -14,7 +14,7 @@ for target in w32 w64; do cp anytun-$target/*.exe anytun-$VER-$target cp $LIBGCC_DLL $LIBSTDCPP_DLL anytun-$VER-$target cp boost-$target/lib/libboost_{date_time,serialization,system,thread_win32,chrono}.dll anytun-$VER-$target - cp openssl-$target/bin/libeay32.dll anytun-$VER-$target + cp openssl-$target/bin/{libeay32.dll,libcrypto*.dll} anytun-$VER-$target cp anytun-example.bat anytun-$VER-$target cp ../{AUTHORS,ChangeLog,LICENSE,README,version} anytun-$VER-$target cp -r tap?? anytun-$VER-$target diff --git a/contrib/openssl-1.1.0h-configure.patch b/contrib/openssl-1.1.0h-configure.patch new file mode 100644 index 0000000..54363f6 --- /dev/null +++ b/contrib/openssl-1.1.0h-configure.patch @@ -0,0 +1,32 @@ +diff -Nur openssl-1.1.0h.orig/config openssl-1.1.0h/config +--- openssl-1.1.0h.orig/config 2018-06-09 01:39:38.845245228 +0200 ++++ openssl-1.1.0h/config 2018-06-09 01:43:01.715723809 +0200 +@@ -843,11 +843,11 @@ + options="$options $CONFIG_OPTIONS" + fi + +-if expr "$options" : '.*no\-asm' > /dev/null; then :; else +- sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \ +- grep \\--noexecstack >/dev/null && \ +- options="$options -Wa,--noexecstack" +-fi ++#if expr "$options" : '.*no\-asm' > /dev/null; then :; else ++# sh -c "$CROSS_COMPILE${CC:-gcc} -Wa,--help -c -o /tmp/null.$$.o -x assembler /dev/null && rm /tmp/null.$$.o" 2>&1 | \ ++# grep \\--noexecstack >/dev/null && \ ++# options="$options -Wa,--noexecstack" ++#fi + + # gcc < 2.8 does not support -march=ultrasparc + if [ "$OUT" = solaris-sparcv9-gcc -a $GCCVER -lt 28 ] +diff -Nur openssl-1.1.0h.orig/Configure openssl-1.1.0h/Configure +--- openssl-1.1.0h.orig/Configure 2018-06-09 01:39:38.845245228 +0200 ++++ openssl-1.1.0h/Configure 2018-06-09 01:47:30.473859795 +0200 +@@ -741,7 +741,7 @@ + } + else + { +- die "target already defined - $target (offending arg: $_)\n" if ($target ne ""); ++ # die "target already defined - $target (offending arg: $_)\n" if ($target ne ""); + $target=$_; + } + unless ($_ eq $target || /^no-/ || /^disable-/) diff --git a/doc/anytun-config.8 b/doc/anytun-config.8 index f958056..e0eca0d 100644 --- a/doc/anytun-config.8 +++ b/doc/anytun-config.8 @@ -2,12 +2,12 @@ .\" Title: anytun-config .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 06/09/2018 +.\" Date: 01/06/2020 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "ANYTUN\-CONFIG" "8" "06/09/2018" "\ \&" "\ \&" +.TH "ANYTUN\-CONFIG" "8" "01/06/2020" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/anytun-controld.8 b/doc/anytun-controld.8 index a8ce738..b6b1741 100644 --- a/doc/anytun-controld.8 +++ b/doc/anytun-controld.8 @@ -2,12 +2,12 @@ .\" Title: anytun-controld .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 06/09/2018 +.\" Date: 01/06/2020 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "ANYTUN\-CONTROLD" "8" "06/09/2018" "\ \&" "\ \&" +.TH "ANYTUN\-CONTROLD" "8" "01/06/2020" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/anytun-showtables.8 b/doc/anytun-showtables.8 index f75de02..1fa86d0 100644 --- a/doc/anytun-showtables.8 +++ b/doc/anytun-showtables.8 @@ -2,12 +2,12 @@ .\" Title: anytun-showtables .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 06/09/2018 +.\" Date: 01/06/2020 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "ANYTUN\-SHOWTABLES" "8" "06/09/2018" "\ \&" "\ \&" +.TH "ANYTUN\-SHOWTABLES" "8" "01/06/2020" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- diff --git a/doc/anytun.8 b/doc/anytun.8 index 2539aec..42933c2 100644 --- a/doc/anytun.8 +++ b/doc/anytun.8 @@ -2,12 +2,12 @@ .\" Title: anytun .\" Author: [see the "AUTHORS" section] .\" Generator: DocBook XSL Stylesheets v1.79.1 -.\" Date: 06/09/2018 +.\" Date: 01/06/2020 .\" Manual: \ \& .\" Source: \ \& .\" Language: English .\" -.TH "ANYTUN" "8" "06/09/2018" "\ \&" "\ \&" +.TH "ANYTUN" "8" "01/06/2020" "\ \&" "\ \&" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- @@ -150,7 +150,7 @@ to run in debug mode\&. It implicits .PP \fB\-i, \-\-interface \fR\fB\fI\fR\fR .RS 4 -This IP address is used as the sender address for outgoing packets\&. In case of anycast tunnel endpoints, the anycast IP has to be used\&. In case of unicast endpoints, the address is usually derived correctly from the routing table\&. The default is to not use a special inteface and just bind on all interfaces\&. +This IP address is used as the sender address for outgoing packets\&. In case of anycast tunnel endpoints, the anycast IP has to be used\&. In case of unicast endpoints, the address is usually derived correctly from the routing table\&. The default is to not use a special interface and just bind on all interfaces\&. .RE .PP \fB\-p, \-\-port \fR\fB\fI\fR\fR @@ -182,7 +182,7 @@ Resolv to IPv6 addresses only\&. The default is to resolv both IPv4 and IPv6 add .RS 4 local unicast(sync) ip address to bind to -This option is only needed for tunnel endpoints consisting of multiple anycast hosts\&. The unicast IP address of the anycast host can be used here\&. This is needed for communication with the other anycast hosts\&. The default is to not use a special inteface and just bind on all interfaces\&. However this is only the case if synchronisation is active see +This option is only needed for tunnel endpoints consisting of multiple anycast hosts\&. The unicast IP address of the anycast host can be used here\&. This is needed for communication with the other anycast hosts\&. The default is to not use a special interface and just bind on all interfaces\&. However this is only the case if synchronisation is active see \fB\-\-sync\-port\fR\&. .RE .PP @@ -255,7 +255,7 @@ the multiplex id to use\&. default: 0 .PP \fB\-s, \-\-sender\-id \fR\fB\fI\fR\fR .RS 4 -Each anycast tunnel endpoint needs a uniqe sender id (1, 2, 3, \&...)\&. It is needed to distinguish the senders in case of replay attacks\&. This option can be ignored on unicast endpoints\&. default: 0 +Each anycast tunnel endpoint needs a unique sender id (1, 2, 3, \&...)\&. It is needed to distinguish the senders in case of replay attacks\&. This option can be ignored on unicast endpoints\&. default: 0 .RE .PP \fB\-w, \-\-window\-size \fR\fB\fI\fR\fR diff --git a/doc/anytun.8.txt b/doc/anytun.8.txt index 7896dcd..8c5a3b6 100644 --- a/doc/anytun.8.txt +++ b/doc/anytun.8.txt @@ -109,7 +109,7 @@ passed to the daemon: packets. In case of anycast tunnel endpoints, the anycast IP has to be used. In case of unicast endpoints, the address is usually derived correctly from the routing - table. The default is to not use a special inteface and just + table. The default is to not use a special interface and just bind on all interfaces. *-p, --port ''*:: @@ -145,7 +145,7 @@ passed to the daemon: of multiple anycast hosts. The unicast IP address of the anycast host can be used here. This is needed for communication with the other anycast hosts. The default is to - not use a special inteface and just bind on all interfaces. However + not use a special interface and just bind on all interfaces. However this is only the case if synchronisation is active see *--sync-port*. *-S, --sync-port ''*:: @@ -210,7 +210,7 @@ passed to the daemon: the multiplex id to use. default: 0 *-s, --sender-id ''*:: - Each anycast tunnel endpoint needs a uniqe sender id + Each anycast tunnel endpoint needs a unique sender id (1, 2, 3, ...). It is needed to distinguish the senders in case of replay attacks. This option can be ignored on unicast endpoints. default: 0 diff --git a/src/Makefile b/src/Makefile index 9d29cb5..5fc6c2b 100644 --- a/src/Makefile +++ b/src/Makefile @@ -177,7 +177,7 @@ all: $(EXECUTABLES) #libAnysync.a %.d: %.cpp @set -e; rm -f $@; \ - $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \ + $(CXX) -MM $(CPPFLAGS) $< > $@.$$$$; \ sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$; echo '(re)building $@' @@ -199,7 +199,7 @@ anytun-nosync$(EXE): $(ANYTUNOBJS) anytun-nosync.o $(LD) $(ANYTUNOBJS) anytun-nosync.o -o $@ $(LDFLAGS) anytun-nosync.o: anytun.cpp - $(CXX) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYTUN_NOSYNC $< -c -o anytun-nosync.o anytun-showtables$(EXE): $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o $(LD) $(ANYSHOWOBJS) $(SYNCOBJS) anytun-showtables.o -o $@ $(LDFLAGS) @@ -212,19 +212,19 @@ anytun-controld$(EXE): $(ANYCTROBJS) anytun-controld.o options.o: options.cpp - $(CXX) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYTUN_OPTIONS $< -c -o $@ anyCtrOptions.o: options.cpp - $(CXX) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYCTR_OPTIONS $< -c -o $@ anyConfOptions.o: options.cpp - $(CXX) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) -DANYCONF_OPTIONS $< -c -o $@ nullOptions.o: options.cpp - $(CXX) $(CXXFLAGS) $< -c -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@ %.o: %.cpp - $(CXX) $(CXXFLAGS) $< -c -o $@ + $(CXX) $(CPPFLAGS) $(CXXFLAGS) $< -c -o $@ libAnysync.a: $(OBJS) diff --git a/src/anytunError.h b/src/anytunError.h index 0505497..02293cd 100644 --- a/src/anytunError.h +++ b/src/anytunError.h @@ -47,6 +47,7 @@ #define ANYTUN_anytunError_h_INCLUDED #include +#define BOOST_SYSTEM_ENABLE_DEPRECATED #include #include "datatypes.h" diff --git a/src/configure b/src/configure index b8a7f3f..a1ac576 100755 --- a/src/configure +++ b/src/configure @@ -217,12 +217,12 @@ if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then fi if [ $USE_CLANG -eq 0 ]; then - CXXFLAGS='-g -Wall -Werror -Wno-error=unused-variable -O2' - LDFLAGS='-g -Wall -Werror -O2' + if [ -z "$CXXFLAGS" ]; then CXXFLAGS='-g -Wall -O2'; fi + if [ -z "$LDFLAGS" ]; then LDFLAGS='-g -Wall -O2'; fi COMPILER='g++' else - CXXFLAGS='-g -O2' - LDFLAGS='-g -O2' + if [ -z "$CXXFLAGS" ]; then CXXFLAGS='-g -O2'; fi + if [ -z "$LDFLAGS" ]; then LDFLAGS='-g -O2'; fi COMPILER='clang++' fi @@ -254,8 +254,8 @@ case $TARGET in ln -sf posix/posixDaemon.h daemonService.h ln -sf posix/posixDaemon.cpp daemonService.cpp echo "loading BSD specific TUN Device" - CXXFLAGS=$CXXFLAGS' -I/usr/local/include' - LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread' + CPPFLAGS=$CPPFLAGS' -I/usr/local/include' + LDFLAGS=$LDFLAGS' -L/usr/local/lib -lboost_thread -lboost_serialization -lboost_system -lboost_date_time -lpthread' LOG_TARGETS='-DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT' INSTALLSYSTEMD=0 ;; @@ -265,7 +265,7 @@ case $TARGET in rm -f sysExec.hpp rm -f daemonService.h daemonService.cpp echo "loading Windows specific TUN Device" - CXXFLAGS=$CXXFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB' + CPPFLAGS=$CPPFLAGS' -DMINGW -D_WIN32_WINNT=0x0501 -DWIN32_LEAN_AND_MEAN -DBOOST_WINDOWS -fno-strict-aliasing -DBOOST_THREAD_USE_LIB' LDFLAGS=$LDFLAGS' -lboost_thread_win32 -lboost_serialization -lboost_system -lboost_date_time -lwsock32 -lws2_32' LOG_TARGETS='-DWIN_EVENTLOG -DLOG_FILE -DLOG_STDOUT' INSTALLSYSTEMD=0 @@ -276,59 +276,59 @@ case $TARGET in ;; esac -CXXFLAGS="$CXXFLAGS $LOG_TARGETS" +CPPFLAGS="$CPPFLAGS $LOG_TARGETS" if [ -n "$BOOST_PREFIX" ]; then - CXXFLAGS="$CXXFLAGS -I\"$BOOST_PREFIX/include\"" + CPPFLAGS="$CPPFLAGS -I\"$BOOST_PREFIX/include\"" LDFLAGS="$LDFLAGS -L\"$BOOST_PREFIX/lib\"" fi CRYPTO_LIB_NAME="" case $CRYPTO_LIB in gcrypt) - CXXFLAGS=$CXXFLAGS' -DUSE_GCRYPT' + CPPFLAGS=$CPPFLAGS' -DUSE_GCRYPT' LDFLAGS=$LDFLAGS' -lgcrypt -lgpg-error' if [ -n "$GCRYPT_PREFIX" ]; then - CXXFLAGS="$CXXFLAGS -I\"$GCRYPT_PREFIX/include\"" + CPPFLAGS="$CPPFLAGS -I\"$GCRYPT_PREFIX/include\"" LDFLAGS="$LDFLAGS -L\"$GCRYPT_PREFIX/lib\"" fi CRYPTO_LIB_NAME="libgcrypt" echo "using gcrypt library" ;; nettle) - CXXFLAGS=$CXXFLAGS' -DUSE_NETTLE' + CPPFLAGS=$CPPFLAGS' -DUSE_NETTLE' LDFLAGS=$LDFLAGS' -lnettle' if [ -n "$NETTLE_PREFIX" ]; then - CXXFLAGS="$CXXFLAGS -I\"$NETTLE_PREFIX/include\"" + CPPFLAGS="$CPPFLAGS -I\"$NETTLE_PREFIX/include\"" LDFLAGS="$LDFLAGS -L\"$NETTLE_PREFIX/lib\"" fi CRYPTO_LIB_NAME="Nettle" echo "using nettle library" ;; ssl) - CXXFLAGS=$CXXFLAGS' -DUSE_SSL_CRYPTO' + CPPFLAGS=$CPPFLAGS' -DUSE_SSL_CRYPTO' LDFLAGS=$LDFLAGS' -lcrypto' if [ -n "$OPENSSL_PREFIX" ]; then - CXXFLAGS="$CXXFLAGS -I\"$OPENSSL_PREFIX/include\"" + CPPFLAGS="$CPPFLAGS -I\"$OPENSSL_PREFIX/include\"" LDFLAGS="$LDFLAGS -L\"$OPENSSL_PREFIX/lib\"" fi CRYPTO_LIB_NAME="OpenSSL" echo "using openssl crypto library" ;; none) - CXXFLAGS=$CXXFLAGS' -DNO_CRYPT' + CPPFLAGS=$CPPFLAGS' -DNO_CRYPT' CRYPTO_LIB_NAME="none" echo "disabling crypto" ;; esac if [ $PASSPHRASE -eq 0 ]; then - CXXFLAGS=$CXXFLAGS' -DNO_PASSPHRASE' + CPPFLAGS=$CPPFLAGS' -DNO_PASSPHRASE' echo "disabling master key and salt passphrase" fi if [ $ROUTING -eq 0 ]; then - CXXFLAGS=$CXXFLAGS' -DNO_ROUTING' + CPPFLAGS=$CPPFLAGS' -DNO_ROUTING' echo "disabling built-in routing capability" fi @@ -373,13 +373,14 @@ cat > include.mk < +#define BOOST_SYSTEM_ENABLE_DEPRECATED #include #include "resolver.h" diff --git a/src/syncServer.cpp b/src/syncServer.cpp index 1e6e352..21302c2 100644 --- a/src/syncServer.cpp +++ b/src/syncServer.cpp @@ -125,7 +125,11 @@ void SyncServer::start_accept() std::list::iterator it = acceptors_.begin(); for(; it != acceptors_.end(); ++it) { if(!it->started_) { +#if BOOST_VERSION >= 107000 + SyncTcpConnection::pointer new_connection = SyncTcpConnection::create(it->acceptor_->get_executor()); +#else SyncTcpConnection::pointer new_connection = SyncTcpConnection::create(it->acceptor_->get_io_service()); +#endif conns_.push_back(new_connection); it->acceptor_->async_accept(new_connection->socket(), boost::bind(&SyncServer::handle_accept, this, new_connection, boost::asio::placeholders::error, it)); diff --git a/src/syncTcpConnection.cpp b/src/syncTcpConnection.cpp index 027c775..9fe3dba 100644 --- a/src/syncTcpConnection.cpp +++ b/src/syncTcpConnection.cpp @@ -66,10 +66,18 @@ void SyncTcpConnection::Send(std::string message) boost::asio::placeholders::error, boost::asio::placeholders::bytes_transferred)); } + +#if BOOST_VERSION >= 107000 +SyncTcpConnection::SyncTcpConnection(const boost::asio::executor& executor) + : socket_(executor) +{ +} +#else SyncTcpConnection::SyncTcpConnection(boost::asio::io_service& io_service) : socket_(io_service) { } +#endif void SyncTcpConnection::handle_write(const boost::system::error_code& /*error*/, size_t /*bytes_transferred*/) diff --git a/src/syncTcpConnection.h b/src/syncTcpConnection.h index a188610..d5f6ef1 100644 --- a/src/syncTcpConnection.h +++ b/src/syncTcpConnection.h @@ -60,9 +60,15 @@ public: typedef boost::shared_ptr pointer; typedef boost::asio::ip::tcp proto; +#if BOOST_VERSION >= 107000 + static pointer create(const boost::asio::executor& executor) { + return pointer(new SyncTcpConnection(executor)); + }; +#else static pointer create(boost::asio::io_service& io_service) { return pointer(new SyncTcpConnection(io_service)); }; +#endif boost::function onConnect; proto::socket& socket(); @@ -70,7 +76,11 @@ public: void start(); void Send(std::string message); private: +#if BOOST_VERSION >= 107000 + SyncTcpConnection(const boost::asio::executor& executor); +#else SyncTcpConnection(boost::asio::io_service& io_service); +#endif void handle_write(const boost::system::error_code & /*error*/, size_t /*bytes_transferred*/); diff --git a/version b/version index 0f82685..6678432 100644 --- a/version +++ b/version @@ -1 +1 @@ -0.3.7 +0.3.8 -- 2.1.4