From bb834fe0ed7a38b724f49b944adb801634eb6194 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 14 Dec 2009 02:53:24 +0100 Subject: [PATCH] Imported Upstream version 0.3.2 --- ChangeLog | 16 +- LICENSE | 7 +- README | 80 ++++- etc/anytun/client1/config | 4 +- etc/anytun/client2/config | 4 +- etc/anytun/client3/config | 4 +- etc/anytun/p2p-a/config | 4 +- etc/anytun/p2p-b/config | 4 +- etc/anytun/server/config | 4 +- etc/init.d/anytun | 22 +- src/Makefile | 243 +++++++++----- src/anyrtpproxy/Makefile | 7 +- src/anyrtpproxy/anyrtpproxy.cpp | 9 +- src/anyrtpproxy/callIdQueue.cpp | 7 +- src/anyrtpproxy/callIdQueue.h | 7 +- src/anyrtpproxy/commandHandler.cpp | 7 +- src/anyrtpproxy/commandHandler.h | 7 +- src/anyrtpproxy/connectionList.cpp | 7 +- src/anyrtpproxy/connectionList.h | 7 +- src/anyrtpproxy/options.cpp | 7 +- src/anyrtpproxy/options.h | 7 +- src/anyrtpproxy/portWindow.cpp | 7 +- src/anyrtpproxy/portWindow.h | 7 +- src/anyrtpproxy/rtpSession.cpp | 7 +- src/anyrtpproxy/rtpSession.h | 7 +- src/anyrtpproxy/rtpSessionTable.cpp | 7 +- src/anyrtpproxy/rtpSessionTable.h | 7 +- src/anyrtpproxy/syncRtpCommand.cpp | 7 +- src/anyrtpproxy/syncRtpCommand.h | 7 +- src/anytun-config.cpp | 7 +- src/anytun-controld.cpp | 7 +- src/anytun-showtables.cpp | 7 +- src/anytun.cpp | 21 +- src/anytun.sln | 12 + src/anytun.suo | Bin 68608 -> 68608 bytes src/anytun.vcproj | 336 +++++++++++++++++++ src/anytunError.cpp | 7 +- src/anytunError.h | 11 +- src/authAlgo.cpp | 7 +- src/authAlgo.h | 12 +- src/authAlgoFactory.cpp | 7 +- src/authAlgoFactory.h | 11 +- src/bsd/tunDevice.cpp | 52 ++- src/buffer.cpp | 7 +- src/buffer.h | 11 +- src/cipher.cpp | 7 +- src/cipher.h | 12 +- src/cipherFactory.cpp | 7 +- src/cipherFactory.h | 12 +- src/configure | 126 +++++++- src/connectionList.cpp | 7 +- src/connectionList.h | 11 +- src/connectionParam.cpp | 7 +- src/connectionParam.h | 12 +- src/cryptinit.hpp | 12 +- src/daemon.hpp | 14 +- src/datatypes.h | 11 +- src/deviceConfig.hpp | 11 +- src/encryptedPacket.cpp | 7 +- src/encryptedPacket.h | 11 +- src/endian.h | 11 +- src/keyDerivation.cpp | 14 +- src/keyDerivation.h | 13 +- src/keyDerivationFactory.cpp | 7 +- src/keyDerivationFactory.h | 11 +- src/linux/tunDevice.cpp | 28 +- src/log.cpp | 7 +- src/log.h | 11 +- src/logTargets.cpp | 15 +- src/logTargets.h | 11 +- src/man/Makefile | 42 +-- src/man/anyrtpproxy.8.txt | 154 ++++----- src/man/anytun-config.8.txt | 278 +++++++--------- src/man/anytun-controld.8.txt | 154 ++++----- src/man/anytun-showtables.8.txt | 26 +- src/man/anytun.8.txt | 627 +++++++++++++++--------------------- src/networkAddress.cpp | 7 +- src/networkAddress.h | 13 +- src/networkPrefix.cpp | 7 +- src/networkPrefix.h | 11 +- src/options.cpp | 7 +- src/options.h | 11 +- src/packetSource.cpp | 7 +- src/packetSource.h | 11 +- src/plainPacket.cpp | 7 +- src/plainPacket.h | 11 +- src/resolver.cpp | 7 +- src/resolver.h | 11 +- src/routingTable.cpp | 7 +- src/routingTable.h | 11 +- src/routingTree.hpp | 13 +- src/routingTreeNode.cpp | 7 +- src/routingTreeNode.h | 12 +- src/seqWindow.cpp | 9 +- src/seqWindow.h | 11 +- src/signalController.cpp | 15 +- src/signalController.h | 18 +- src/syncBuffer.cpp | 7 +- src/syncBuffer.h | 11 +- src/syncClient.cpp | 7 +- src/syncClient.h | 11 +- src/syncCommand.cpp | 7 +- src/syncCommand.h | 14 +- src/syncConnectionCommand.cpp | 7 +- src/syncConnectionCommand.h | 13 +- src/syncOnConnect.hpp | 13 +- src/syncQueue.cpp | 7 +- src/syncQueue.h | 11 +- src/syncRouteCommand.cpp | 7 +- src/syncRouteCommand.h | 14 +- src/syncServer.cpp | 7 +- src/syncServer.h | 15 +- src/syncTcpConnection.cpp | 7 +- src/syncTcpConnection.h | 12 +- src/sysExec.cpp | 157 +++++++++ src/sysExec.h | 52 +++ src/sysexec.hpp | 74 ----- src/threadUtils.hpp | 15 +- src/tunDevice.h | 11 +- src/win32/#winService.cpp# | 212 ------------ src/win32/common.h | 6 +- src/win32/registryKey.cpp | 7 +- src/win32/registryKey.h | 13 +- src/win32/tunDevice.cpp | 7 +- src/win32/winService.cpp | 7 +- src/win32/winService.h | 13 +- version | 1 + wireshark-lua/satp.lua | 7 +- 128 files changed, 2066 insertions(+), 1610 deletions(-) create mode 100644 src/sysExec.cpp create mode 100644 src/sysExec.h delete mode 100644 src/sysexec.hpp delete mode 100644 src/win32/#winService.cpp# create mode 100644 version diff --git a/ChangeLog b/ChangeLog index a2736ca..f53739c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2009.12.02 -- Version 0.3.2 + +* added 64bit build target to windows build system +* added install target to build system +* cleaned up manpages +* moved to new svn location + +2009.10.28 -- Version 0.3.1 svn852 +* switched to GPLv3 or higher +* Changed Windows TAP driver version to support 64-bit windows +* fixed some memory errors +* improved logging +* improved post up script execution +* builds on FreeBSD now + 2009.5.1 -- Version 0.3 svn834 * updated to new protocol specification (extended label and crypto role) @@ -27,7 +42,6 @@ * added manpages for all binaries * switched to GPLv3 - 2008.4.12 -- Version 0.2svn490 * updated to Internet Draft Revision 02 diff --git a/LICENSE b/LICENSE index 51e0b22..44d9451 100644 --- a/LICENSE +++ b/LICENSE @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/README b/README index b7168e2..ffceb10 100644 --- a/README +++ b/README @@ -20,7 +20,32 @@ common: libboost-thread1.35-dev libboost-system1.35-dev libboost-regex1.35-dev - asciidoc (only for manpage) + +only for manpage: + asciidoc + + +Freebsd +------- + +using libgcrypt: + security/libgcrypt + +using ssl crypto lib: + + +common: + devel/boost + devel/gmake + +only for manpage: + + textproc/asciidoc + textproc/libxslt + textproc/docbook-xsl + sysutils/readlink + misc/getopt + Windows @@ -54,7 +79,8 @@ Installation Getting the source via subversion: ---------------------------------- -svn co http://anytun.org/svn/anytun/ +svn co http://svn.anytun.org/anytun/trunk anytun +cd anytun Building from source -------------------- @@ -77,6 +103,56 @@ Notes: - if using openssl pre 0.9.8 you have to disable passphrase because openssl had no SHA256 implementation prior to this version + - on FreeBSD you have to use gmake instead of make + +Installing +---------- + +# sudo make install + +This will install anytun under the --prefix defined with configure. + +Uninstalling +------------ + +# sudo make remove + +This removes everytthing except for the config files + +# sudo make purge + +This also removes the config files + + + +Usage: +====== + +init.d script +------------- + +The init.d script can be used to start anytun at boot time. It searches for +configuration files which reside at $CONFIG_DIR. For each instance of anytun +which should be started there must be a directory containing at least a file +named config. This file must contain all command line parameter which should +be used when starting the daemon. One line for each parameter. Empty lines and +lines starting with # are ignored. Besides the config file there may be a script +named post-up.sh which will be called when the tun/tap device comes up. +Furthermore there may be a directory called conf.d containing config files for +anytun-config. The syntax of this files is quite the same as those for anytun. +These files are used to configure a multi connection setup using anytun-config +and anytun-controld +This is an example of how the script can be used to start anytun: + +# /etc/init.d/anytun start client1 p2p-a + +In this case the script will start 2 instances of anytun using the config files +$CONFIG_DIR/client1/config and $CONFIG_DIR/p2p-a/config. +If no instance name is specified the script will use the file $CONFIG_DIR/autostart +to determine which instances to start or stop. This file must contain a list +of instance names which should be used when no names are specified at the command +line. One line for each name. Empty lines and lines starting with # are ignored. + Errors: diff --git a/etc/anytun/client1/config b/etc/anytun/client1/config index da11356..dec6c97 100644 --- a/etc/anytun/client1/config +++ b/etc/anytun/client1/config @@ -53,8 +53,8 @@ remote-port 4444 log syslog:3,anytun-client1,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/client2/config b/etc/anytun/client2/config index ff9bab7..adc1cfa 100644 --- a/etc/anytun/client2/config +++ b/etc/anytun/client2/config @@ -53,8 +53,8 @@ remote-port 4444 log syslog:3,anytun-client2,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/client3/config b/etc/anytun/client3/config index c5f529c..9714a51 100644 --- a/etc/anytun/client3/config +++ b/etc/anytun/client3/config @@ -53,8 +53,8 @@ remote-port 4444 log syslog:3,anytun-client3,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/p2p-a/config b/etc/anytun/p2p-a/config index 126f918..d7d25b0 100644 --- a/etc/anytun/p2p-a/config +++ b/etc/anytun/p2p-a/config @@ -61,8 +61,8 @@ remote-port 4445 log syslog:3,anytun-p2p-a,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/p2p-b/config b/etc/anytun/p2p-b/config index 859b26d..6f2d7a3 100644 --- a/etc/anytun/p2p-b/config +++ b/etc/anytun/p2p-b/config @@ -61,8 +61,8 @@ remote-port 4445 log syslog:3,anytun-p2p-b,daemon ## change user and group after init -username anytun -groupname anytun +#username anytun +#groupname anytun ## chroot to users home directory #chroot /var/run/anytun diff --git a/etc/anytun/server/config b/etc/anytun/server/config index 8488923..1e5786a 100644 --- a/etc/anytun/server/config +++ b/etc/anytun/server/config @@ -55,8 +55,8 @@ port 4444 log syslog:3,anytun-server,daemon ## change user and group after init -username nobody -groupname nogroup +#username anytun +#groupname anytun ## chroot to /var/run/anytun #chroot /var/run/anytun diff --git a/etc/init.d/anytun b/etc/init.d/anytun index d0299d4..3bf1e91 100755 --- a/etc/init.d/anytun +++ b/etc/init.d/anytun @@ -16,6 +16,7 @@ NAME=anytun DESC=anytun CONFIG_DIR=/etc/anytun VARCONFIG_DIR=/var/run/anytun-controld +VARRUN_DIR=/var/run/anytun test -x $DAEMON || exit 0 @@ -33,8 +34,9 @@ start_vpn () { if [ -n "$CHROOTDIR" ] ; then test -d $CHROOTDIR || mkdir -p $CHROOTDIR fi + test -d $VARRUN_DIR || mkdir -p $VARRUN_DIR DAEMONARG=`sed 's/#.*//' < $CONFIG_DIR/$NAME/config | grep -e '\w' | sed 's/^/--/' | tr '\n' ' '` - $DAEMON --write-pid /var/run/anytun.$NAME.pid $POSTUP \ + $DAEMON --write-pid $VARRUN_DIR/$NAME.pid $POSTUP \ $DAEMONOPTS $DAEMONARG || STATUS="FAILED" else STATUS="no config found" @@ -99,7 +101,7 @@ case "$1" in stop) echo -n "Stoping $DESC:" if test -z "$2" ; then - for PIDFILE in `ls /var/run/anytun.*.pid 2> /dev/null`; do + for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c17-` NAME=${NAME%%.pid} echo -n " $NAME" @@ -108,8 +110,8 @@ case "$1" in else while shift ; do [ -z "$1" ] && break - if test -e /var/run/anytun.$1.pid ; then - PIDFILE=`ls /var/run/anytun.$1.pid 2> /dev/null` + if test -e $VARRUN_DIR/$1.pid ; then + PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` NAME=`echo $PIDFILE | cut -c17-` NAME=${NAME%%.pid} echo -n " $NAME" @@ -124,7 +126,7 @@ case "$1" in reload) echo -n "Reloading $DESC:" if test -z "$2" ; then - for PIDFILE in `ls /var/run/anytun.*.pid 2> /dev/null`; do + for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c17-` NAME=${NAME%%.pid} echo -n " $NAME" @@ -139,8 +141,8 @@ case "$1" in else while shift ; do [ -z "$1" ] && break - if test -e /var/run/anytun.$1.pid ; then - PIDFILE=`ls /var/run/anytun.$1.pid 2> /dev/null` + if test -e $VARRUN_DIR/$1.pid ; then + PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` NAME=`echo $PIDFILE | cut -c17-` NAME=${NAME%%.pid} echo -n " $NAME" @@ -161,7 +163,7 @@ case "$1" in force-reload) echo -n "Restarting $DESC:" if test -z "$2" ; then - for PIDFILE in `ls /var/run/anytun.*.pid 2> /dev/null`; do + for PIDFILE in `ls $VARRUN_DIR/*.pid 2> /dev/null`; do NAME=`echo $PIDFILE | cut -c17-` NAME=${NAME%%.pid} echo -n " $NAME" @@ -172,8 +174,8 @@ case "$1" in else while shift ; do [ -z "$1" ] && break - if test -e /var/run/anytun.$1.pid ; then - PIDFILE=`ls /var/run/anytun.$1.pid 2> /dev/null` + if test -e $VARRUN_DIR/$1.pid ; then + PIDFILE=`ls $VARRUN_DIR/$1.pid 2> /dev/null` NAME=`echo $PIDFILE | cut -c17-` NAME=${NAME%%.pid} echo -n " $NAME" diff --git a/src/Makefile b/src/Makefile index 4f75c70..f3c9801 100644 --- a/src/Makefile +++ b/src/Makefile @@ -11,14 +11,15 @@ ## tunneling and relaying of packets of any protocol. ## ## -## Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, +## Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, ## Christian Pointner ## ## This file is part of Anytun. ## ## Anytun is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License version 3 as -## published by the Free Software Foundation. +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## any later version. ## ## Anytun is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -34,73 +35,74 @@ include include.mk endif OBJS := tunDevice.o \ - packetSource.o \ - buffer.o \ - syncBuffer.o \ - plainPacket.o \ - encryptedPacket.o \ - cipher.o \ - authAlgo.o \ - keyDerivation.o \ - cipherFactory.o \ - authAlgoFactory.o \ - keyDerivationFactory.o \ - connectionList.o \ - connectionParam.o \ - networkAddress.o \ - networkPrefix.o \ - routingTable.o \ - signalController.o \ - log.o \ - logTargets.o \ - anytunError.o \ - options.o \ - seqWindow.o \ - routingTreeNode.o \ - resolver.o + packetSource.o \ + buffer.o \ + syncBuffer.o \ + plainPacket.o \ + encryptedPacket.o \ + cipher.o \ + authAlgo.o \ + keyDerivation.o \ + cipherFactory.o \ + authAlgoFactory.o \ + keyDerivationFactory.o \ + connectionList.o \ + connectionParam.o \ + networkAddress.o \ + networkPrefix.o \ + routingTable.o \ + signalController.o \ + log.o \ + logTargets.o \ + sysExec.o \ + anytunError.o \ + options.o \ + seqWindow.o \ + routingTreeNode.o \ + resolver.o SYNCOBJS := syncServer.o \ - syncClient.o \ - syncQueue.o \ - syncCommand.o \ - syncRouteCommand.o \ - syncConnectionCommand.o \ - syncTcpConnection.o + syncClient.o \ + syncQueue.o \ + syncCommand.o \ + syncRouteCommand.o \ + syncConnectionCommand.o \ + syncTcpConnection.o ANYCTROBJS := signalController.o \ - anyCtrOptions.o \ - buffer.o \ - log.o \ - logTargets.o \ - anytunError.o \ - syncTcpConnection.o \ - syncServer.o \ - resolver.o + anyCtrOptions.o \ + buffer.o \ + log.o \ + logTargets.o \ + anytunError.o \ + syncTcpConnection.o \ + syncServer.o \ + resolver.o ANYCONFOBJS := log.o \ - logTargets.o \ - anytunError.o \ - buffer.o \ - keyDerivation.o \ - keyDerivationFactory.o \ - networkAddress.o \ - networkPrefix.o \ - connectionList.o \ - connectionParam.o \ - routingTreeNode.o \ - anyConfOptions.o \ - routingTable.o \ - seqWindow.o \ - syncQueue.o \ - syncBuffer.o \ - syncCommand.o \ - syncServer.o \ - syncTcpConnection.o \ - syncRouteCommand.o \ - syncConnectionCommand.o \ - resolver.o - -EXECUTABLE := anytun anytun-config anytun-controld anytun-showtables anytun-nosync + logTargets.o \ + anytunError.o \ + buffer.o \ + keyDerivation.o \ + keyDerivationFactory.o \ + networkAddress.o \ + networkPrefix.o \ + connectionList.o \ + connectionParam.o \ + routingTreeNode.o \ + anyConfOptions.o \ + routingTable.o \ + seqWindow.o \ + syncQueue.o \ + syncBuffer.o \ + syncCommand.o \ + syncServer.o \ + syncTcpConnection.o \ + syncRouteCommand.o \ + syncConnectionCommand.o \ + resolver.o + +EXECUTABLES := anytun anytun-config anytun-controld anytun-showtables anytun-nosync EXEOBJS := anytun.o anytun-config.o anytun-controld.o anytun-showtables.o SRCS := $(OBJS:%.o=%.cpp) @@ -109,29 +111,29 @@ ANYCTRSRCS := $(ANYCTROBJS:%.o=%.cpp) ANYCONFSRCS := $(ANYCONFOBJS:%.o=%.cpp) EXESRCS := $(EXEOBJS:%.o=%.cpp) -.PHONY: distclean cleanall clean ctags +.PHONY: distclean cleanall clean manpage install install-bin install-etc install-man uninstall remove purge -all: $(EXECUTABLE) #libAnysync.a +all: $(EXECUTABLES) #libAnysync.a %.d: %.cpp - @set -e; rm -f $@; \ - $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \ - sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ + @set -e; rm -f $@; \ + $(CXX) -MM $(CXXFLAGS) $< > $@.$$$$; \ + sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \ rm -f $@.$$$$; echo '(re)building $@' ifneq ($(MAKECMDGOALS),distclean) -include $(SRCS:%.cpp=%.d) $(SYNCSRCS:%.cpp=%.d) $(ANYCTRSRCS:%.cpp=%.d) $(ANYCONFSRCS:%.cpp=%.d) $(EXESRCS:%.cpp=%.d) endif -strip: $(EXECUTABLE) - strip -s $(EXECUTABLE) +strip: $(EXECUTABLES) + $(STRIP) -s $(EXECUTABLES) anytun: $(OBJS) $(SYNCOBJS) anytun.o $(LD) $(OBJS) $(SYNCOBJS) anytun.o -o $@ $(LDFLAGS) anytun-static: $(OBJS) $(SYNCOBJS) anytun-noprivdrop.o $(LD) $(OBJS) $(SYNCOBJS) anytun-noprivdrop.o -o $@ -Bstatic -lstdc++ -static $(LDFLAGS) -lpthread - strip -s anytun-static + $(STRIP) -s anytun-static anytun-nosync: $(OBJS) anytun-nosync.o $(LD) $(OBJS) anytun-nosync.o -o $@ $(LDFLAGS) @@ -186,7 +188,7 @@ clean: rm -f *.o rm -f *.d rm -f *.d.* - rm -f $(EXECUTABLE) + rm -f $(EXECUTABLES) rm -f anytun-nosync rm -f -r doc/html/* rm -f -r doc/latex/* @@ -196,3 +198,98 @@ clean: manpage: @cd man ; $(MAKE) + +INSTALL_TARGETS := install-bin install-etc +REMOVE_TARGETS := remove-bin remove-etc + +ifdef MANDIR +INSTALL_TARGETS += install-man +REMOVE_TARGETS += remove-man +endif + +ifdef EXAMPLESDIR +INSTALL_TARGETS += install-examples +REMOVE_TARGETS += remove-examples +endif + +install: all $(INSTALL_TARGETS) + +install-bin: $(EXECUTABLES) + $(INSTALL) -d $(DESTDIR)$(SBINDIR) + $(INSTALL) -m 755 anytun $(DESTDIR)$(SBINDIR) + $(INSTALL) -d $(DESTDIR)$(BINDIR) + $(INSTALL) -m 755 anytun-config $(DESTDIR)$(BINDIR) + $(INSTALL) -m 755 anytun-controld $(DESTDIR)$(BINDIR) + $(INSTALL) -m 755 anytun-showtables $(DESTDIR)$(BINDIR) + +install-etc: + $(INSTALL) -d $(DESTDIR)$(ETCDIR)/anytun + @ echo "example configurations can be found at $(EXAMPLESDIR)/anytun" > $(DESTDIR)$(ETCDIR)/anytun/README + $(INSTALL) -d $(DESTDIR)$(ETCDIR)/init.d + @ sed -e 's#DAEMON=/usr/sbin/anytun#DAEMON=$(SBINDIR)/anytun#' \ + -e 's#ANYTUNCONFIG=/usr/bin/anytun-config#ANYTUNCONFIG=$(BINDIR)/anytun-config#' \ + -e 's#CONTROLDAEMON=/usr/bin/anytun-controld#CONTROLDAEMON=$(BINDIR)/anytun-controld#' \ + -e 's#CONFIG_DIR=/etc/anytun#CONFIG_DIR=$(ETCDIR)/anytun#' ../etc/init.d/anytun > ../etc/init.d/anytun.bak + $(INSTALL) -m 755 ../etc/init.d/anytun.bak $(DESTDIR)$(ETCDIR)/init.d/anytun + rm -f ../etc/init.d/anytun.bak + +install-examples: + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun + $(INSTALL) -m 644 ../etc/anytun/autostart $(DESTDIR)$(EXAMPLESDIR)/anytun/autostart + @( cd '../etc/anytun/' ; \ + for dir in `ls`; do \ + if [ -d $$dir ]; then \ + echo "install $$dir configuration" ; \ + cd $$dir ; \ + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir ; \ + $(INSTALL) -m 600 config $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/config ; \ + if [ -e 'post-up.sh' ]; then \ + $(INSTALL) -m 755 post-up.sh $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/post-up.sh ; \ + fi ; \ + if [ -d 'conf.d' ]; then \ + $(INSTALL) -d $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \ + cd conf.d ; \ + for file in `ls`; do \ + if [ -f $$file ]; then \ + $(INSTALL) -m 644 $$file $(DESTDIR)$(EXAMPLESDIR)/anytun/$$dir/conf.d ; \ + fi ; \ + done ; \ + cd .. ; \ + fi ; \ + cd .. ; \ + fi ; \ + done \ + ) + +install-man: manpage + $(INSTALL) -d $(DESTDIR)$(MANDIR)/man8/ + $(INSTALL) -m 644 man/anytun.8 $(DESTDIR)$(MANDIR)/man8/ + $(INSTALL) -m 644 man/anytun-config.8 $(DESTDIR)$(MANDIR)/man8/ + $(INSTALL) -m 644 man/anytun-controld.8 $(DESTDIR)$(MANDIR)/man8/ + $(INSTALL) -m 644 man/anytun-showtables.8 $(DESTDIR)$(MANDIR)/man8/ + +uninstall: remove + + +remove: $(REMOVE_TARGETS) + +remove-bin: + rm -f $(DESTDIR)$(SBINDIR)/anytun + rm -f $(DESTDIR)$(BINDIR)/anytun-config + rm -f $(DESTDIR)$(BINDIR)/anytun-controld + rm -f $(DESTDIR)$(BINDIR)/anytun-showtables + +remove-etc: + rm -f $(DESTDIR)$(ETCDIR)/init.d/anytun + +remove-examples: + rm -rf $(DESTDIR)$(EXAMPLESDIR)/anytun/ + +remove-man: + rm -f $(DESTDIR)$(MANDIR)/man8/anytun.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-config.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-controld.8 + rm -f $(DESTDIR)$(MANDIR)/man8/anytun-showtables.8 + +purge: remove + rm -rf $(DESTDIR)$(ETCDIR)/anytun/ diff --git a/src/anyrtpproxy/Makefile b/src/anyrtpproxy/Makefile index 40ca273..43b6220 100644 --- a/src/anyrtpproxy/Makefile +++ b/src/anyrtpproxy/Makefile @@ -11,14 +11,15 @@ ## tunneling and relaying of packets of any protocol. ## ## -## Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, +## Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, ## Christian Pointner ## ## This file is part of Anytun. ## ## Anytun is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License version 3 as -## published by the Free Software Foundation. +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## any later version. ## ## Anytun is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/anyrtpproxy.cpp b/src/anyrtpproxy/anyrtpproxy.cpp index fdb809e..7c5514c 100644 --- a/src/anyrtpproxy/anyrtpproxy.cpp +++ b/src/anyrtpproxy/anyrtpproxy.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -211,7 +212,7 @@ void chrootAndDrop(string const& chrootdir, string const& username) { if (getuid() != 0) { - std::cerr << "this programm has to be run as root in order to run in a chroot" << std::endl; + std::cerr << "this program has to be run as root in order to run in a chroot" << std::endl; exit(-1); } diff --git a/src/anyrtpproxy/callIdQueue.cpp b/src/anyrtpproxy/callIdQueue.cpp index e2ce700..de48bab 100644 --- a/src/anyrtpproxy/callIdQueue.cpp +++ b/src/anyrtpproxy/callIdQueue.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/callIdQueue.h b/src/anyrtpproxy/callIdQueue.h index 1ffe2df..2cea155 100644 --- a/src/anyrtpproxy/callIdQueue.h +++ b/src/anyrtpproxy/callIdQueue.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/commandHandler.cpp b/src/anyrtpproxy/commandHandler.cpp index 01613ec..db0ca4d 100644 --- a/src/anyrtpproxy/commandHandler.cpp +++ b/src/anyrtpproxy/commandHandler.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/commandHandler.h b/src/anyrtpproxy/commandHandler.h index 6bd802a..6634f14 100644 --- a/src/anyrtpproxy/commandHandler.h +++ b/src/anyrtpproxy/commandHandler.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/connectionList.cpp b/src/anyrtpproxy/connectionList.cpp index eea1e38..4c274e8 100644 --- a/src/anyrtpproxy/connectionList.cpp +++ b/src/anyrtpproxy/connectionList.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/connectionList.h b/src/anyrtpproxy/connectionList.h index de45f8a..a30f6d5 100644 --- a/src/anyrtpproxy/connectionList.h +++ b/src/anyrtpproxy/connectionList.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/options.cpp b/src/anyrtpproxy/options.cpp index 6a48483..e651770 100644 --- a/src/anyrtpproxy/options.cpp +++ b/src/anyrtpproxy/options.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/options.h b/src/anyrtpproxy/options.h index af09d4f..679dace 100644 --- a/src/anyrtpproxy/options.h +++ b/src/anyrtpproxy/options.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/portWindow.cpp b/src/anyrtpproxy/portWindow.cpp index 99dafd7..3e07662 100644 --- a/src/anyrtpproxy/portWindow.cpp +++ b/src/anyrtpproxy/portWindow.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/portWindow.h b/src/anyrtpproxy/portWindow.h index f3bdffb..b5a667f 100644 --- a/src/anyrtpproxy/portWindow.h +++ b/src/anyrtpproxy/portWindow.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/rtpSession.cpp b/src/anyrtpproxy/rtpSession.cpp index a3551e3..93333ac 100644 --- a/src/anyrtpproxy/rtpSession.cpp +++ b/src/anyrtpproxy/rtpSession.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/rtpSession.h b/src/anyrtpproxy/rtpSession.h index 3716c9b..cac5115 100644 --- a/src/anyrtpproxy/rtpSession.h +++ b/src/anyrtpproxy/rtpSession.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/rtpSessionTable.cpp b/src/anyrtpproxy/rtpSessionTable.cpp index 9237866..934cf8c 100644 --- a/src/anyrtpproxy/rtpSessionTable.cpp +++ b/src/anyrtpproxy/rtpSessionTable.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/rtpSessionTable.h b/src/anyrtpproxy/rtpSessionTable.h index a37318d..49a062f 100644 --- a/src/anyrtpproxy/rtpSessionTable.h +++ b/src/anyrtpproxy/rtpSessionTable.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/syncRtpCommand.cpp b/src/anyrtpproxy/syncRtpCommand.cpp index f612c8a..10dfbf4 100644 --- a/src/anyrtpproxy/syncRtpCommand.cpp +++ b/src/anyrtpproxy/syncRtpCommand.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anyrtpproxy/syncRtpCommand.h b/src/anyrtpproxy/syncRtpCommand.h index 282243b..7b4c186 100644 --- a/src/anyrtpproxy/syncRtpCommand.h +++ b/src/anyrtpproxy/syncRtpCommand.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anytun-config.cpp b/src/anytun-config.cpp index 72e4902..f8bc4f4 100644 --- a/src/anytun-config.cpp +++ b/src/anytun-config.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anytun-controld.cpp b/src/anytun-controld.cpp index f32ec83..1dbc6f8 100644 --- a/src/anytun-controld.cpp +++ b/src/anytun-controld.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anytun-showtables.cpp b/src/anytun-showtables.cpp index 5d061d6..ff851c9 100644 --- a/src/anytun-showtables.cpp +++ b/src/anytun-showtables.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anytun.cpp b/src/anytun.cpp index 34fd5f5..de8429f 100644 --- a/src/anytun.cpp +++ b/src/anytun.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,13 +30,12 @@ * along with anytun. If not, see . */ +#include +#include +#include #include #include - -#include -#include // for ENOMEM - #include "datatypes.h" #include "log.h" @@ -76,7 +76,7 @@ #include "cryptinit.hpp" #include "daemon.hpp" -#include "sysexec.hpp" +#include "sysExec.h" bool disableRouting = false; @@ -327,7 +327,7 @@ void startSendRecvThreads(TunDevice* dev, PacketSource* src) do_chroot(gOpt.getChrootDir()); } catch(const std::runtime_error& e) { - cLog.msg(Log::PRIO_WARNING) << "ignroing chroot error: " << e.what(); + cLog.msg(Log::PRIO_WARNING) << "ignoring chroot error: " << e.what(); } } #ifndef NO_PRIVDROP @@ -445,7 +445,8 @@ int main(int argc, char* argv[]) #ifndef NO_EXEC if(gOpt.getPostUpScript() != "") { cLog.msg(Log::PRIO_NOTICE) << "executing post-up script '" << gOpt.getPostUpScript() << "'"; - execScript(gOpt.getPostUpScript(), dev.getActualName(), dev.getActualNode()); + StringVector args = boost::assign::list_of(dev.getActualName())(dev.getActualNode()); + anytun_exec(gOpt.getPostUpScript(), args); } #endif diff --git a/src/anytun.sln b/src/anytun.sln index b562246..0e5c04c 100644 --- a/src/anytun.sln +++ b/src/anytun.sln @@ -6,19 +6,31 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 Release|Win32 = Release|Win32 + Release|x64 = Release|x64 Service Debug|Win32 = Service Debug|Win32 + Service Debug|x64 = Service Debug|x64 Service Release|Win32 = Service Release|Win32 + Service Release|x64 = Service Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Debug|Win32.ActiveCfg = Debug|Win32 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Debug|Win32.Build.0 = Debug|Win32 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Debug|x64.ActiveCfg = Debug|x64 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Debug|x64.Build.0 = Debug|x64 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Release|Win32.ActiveCfg = Release|Win32 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Release|Win32.Build.0 = Release|Win32 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Release|x64.ActiveCfg = Release|x64 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Release|x64.Build.0 = Release|x64 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Debug|Win32.ActiveCfg = Service Debug|Win32 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Debug|Win32.Build.0 = Service Debug|Win32 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Debug|x64.ActiveCfg = Service Debug|x64 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Debug|x64.Build.0 = Service Debug|x64 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Release|Win32.ActiveCfg = Service Release|Win32 {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Release|Win32.Build.0 = Service Release|Win32 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Release|x64.ActiveCfg = Service Release|x64 + {12460D00-D78A-4C68-BDE2-9E3B2F9CD0F3}.Service Release|x64.Build.0 = Service Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/src/anytun.suo b/src/anytun.suo index a2b304d8a2b922c65596727e86f2dd3ce45ab451..436969ab57180844bfa92ec8a2577d96ce69ea7c 100644 GIT binary patch delta 1598 zcmaJ>e@v8R9Dlxd@5#$~9>+m|c%6qCDQR+aLZQeV92cb#m}?3LDWYY=0zL6gQ)!id zG*i3}^VOxNGW(~Mp|4x5G+AMrt~FyWbG5Rj8@7RpCqssJeP0yVTI=1Oz0c3@=llJ9 zKF`y-UuxYib^f5Y#NzSzeQs-n5d4edH+`Gga$x`ZXV+aIJx{t1V2gCY5aMnMR$ZHp zT*(BtEFoxEBBwt*rBo)+EVL#`>X6|yNm@{RnNV(N{^R1ur*noXzNvkF-@=`dY4FIo zs$2Gw-X#Q%cF#_pD>jM^VzuydB<+)UOL5rfHLT}B@;G3?Scz^!t{OE;L~ixoUT-=NtYlnY}rl{LdiRHJq8RXe?S%gioHs_DMBKkp0&O&8Mbm{{a9p!l}COxl)jkI zE#=Z?^=`(CnK~g<@6)njv=X)Q8FM0);Z;wwAt>^N3(dZ)#8N)DRX9bS8uyT->`5RW zj(e=|`%DwN5UI(Zwu!-?5-nV06PNmyc!N(8H~#R`<`i^V&FY9xGU~PybX9|rPD3B5 z@+P9hlZpBo>qIrio*(1P!F4GU$Ni zpp5?enK<4eBM`EqGiJjJEoMY}QnN;oy-!pfgz9PGEkY?mnkS$)&d*_*+$ z=ESj_CShA&0c?k=(N(dOY}gyjQj%n{v(ZX%B2t99j#+4mNO1p{%Oc+HO^2gD8aN1fzEmw=<)V=+`X_nmtm46<8Gqi9oIF&B;jb7Ph zL}N|flrr8t>QCVk`G{Zh;E2zG-<=NCeZ5Qf&{`2R`m&L|J9DZm68V5vtP%BMlXy+M zEgqO`0g`XbgSE#-kE1#A1a=Nsu<(XVE0jNt%pKcH<17Q)J7il5N2p}~74mI!P}{!(dFSlV z1T1HdX2Eeg2i`m5^vj0V8FU`9ZYk)wxs+XN*StkbSnVvd4lEzF9qfHGI-)xC+|CPs zy^d8cLgbze(SZTDU-qJHP(pvys=9l-sAE_c9%^EnSEFgj3wQZ)ti7kDYS+}Bgz6Dn z_`^nhp(ft-`RXSlG9fiqag3eOdA|V-u^`%eN7KWW(iwbnimILbVw@N%&`g$1mGGn# z?31XR4?KKjm4HN-$T~4J&@y^tZ1_dgK)VR#z95S#!{*P_&t&lU^2M|adt!4jXV6B) z*!ESavQST^@ZFOC;9YSW$**}*6VVZV%&T1G3FXpcnuA8w#A{=>xbAwIa&a=hvaNRu F{{hLdJHr3~ delta 1580 zcmZuxYfMx}6rOYUURW23iy+_@akU#n1Vj*lR%I8K6|EvvR6w9S#I~j)Dk6y1t+xG9 zO(T5POInMB*rX3rk=utcSXXPB+8ASutu-;mG?)@2K9F~W?YXq*k9Ka(oilSDb7sD8 z#@#Hto8|V)2D6vjC`+XfVkZl384d-sZdjAy`uY+Xc*5O`UGlHWW>$kx)-?n1vOnxb z8Fk7ETr|bQJz3Uodtj(b}-zB?FQ6)8r(Q(g-8w zcPJe7fqSJE14aTrq!hf{KL__+W_CI^<$YPvGlWj$Ri<#x<63>_tE4orI%UE@wOW7J zN{hr%&P1ak8@L=TCnaDKEye4Ot%&K4Rx&xDLGwDe=4**@h<3fKw)#>&mpQ(ucHb3j zk|YUI?trYXsy)qhPJ(B>4dLBK+lnlKm7+#$7jfcEPE^E_4k}2+7qtN}*Os7fC>ZSz z7HDI&M+gb^>2SxdrP*k#TMGM^PFjVn^{HBKeLyhcyCZSC+oCo}J}NE zV|I9A%P9_fmKD=9JRS<=aw5@^8A1!NwI#Wu)#&d(#{1GmZ(8t)YND~mvWB*A0#M$W zqe>F#dx(VffsN*?UZQ_;l(bnDebXs8*_j4=cA;Y8Q63z-b31 zF6PqCsSYd|_F)KS_KYV|ubRm0JD1H_A_J#-6JgB^Hjusxi$jMDY5B>Nj(GzGi2OZ- zk2I>|XUUBA_(-zCF__Hf5ip+KsQVT*8e;W6VKvP`@r_S?tHc&jCyL;`k*Vz9Rq7_{ zLd_r7spk3U<| z7!5$*KrfZT5j3r>PeN~J zvvXCCfsFe7ik_&O(%|h`2KN~|77ZI|{j>Ywz8He$2YLGSJt9*U)laZQt&!PrJCbF9Q~&bgTUact;rrcMJBDPClX`NAQRM21)>VqslneUaI; zkS9`^Qwcnsz-C?B!v!Po+H?d5#rz-A-{V5Bj(XTQ>6xe4JG;Q}0{7lond%)A6~W!_ dVzg%V%ou+!O74d6^LDaxrp^N&wbYM{e*;S8GqV5y diff --git a/src/anytun.vcproj b/src/anytun.vcproj index ea6a923..c64c5da 100644 --- a/src/anytun.vcproj +++ b/src/anytun.vcproj @@ -13,6 +13,9 @@ + @@ -314,6 +317,307 @@ Name="VCPostBuildEventTool" /> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -602,6 +906,38 @@ PreprocessorDefinitions="ANYTUN_OPTIONS" /> + + + + + + + + + + + + * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/anytunError.h b/src/anytunError.h index 26b4012..d500545 100644 --- a/src/anytunError.h +++ b/src/anytunError.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _ANYTUN_ERROR_H -#define _ANYTUN_ERROR_H +#ifndef ANYTUN_anytunError_h_INCLUDED +#define ANYTUN_anytunError_h_INCLUDED #include #include diff --git a/src/authAlgo.cpp b/src/authAlgo.cpp index 49974ee..f9228c6 100644 --- a/src/authAlgo.cpp +++ b/src/authAlgo.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/authAlgo.h b/src/authAlgo.h index c446853..1c7fa1b 100644 --- a/src/authAlgo.h +++ b/src/authAlgo.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,9 +29,8 @@ * You should have received a copy of the GNU General Public License * along with anytun. If not, see . */ - -#ifndef _AUTHALGO_H_ -#define _AUTHALGO_H_ +#ifndef ANYTUN_authAlgo_h_INCLUDED +#define ANYTUN_authAlgo_h_INCLUDED #include "datatypes.h" #include "buffer.h" diff --git a/src/authAlgoFactory.cpp b/src/authAlgoFactory.cpp index c284f34..d1b2fc5 100644 --- a/src/authAlgoFactory.cpp +++ b/src/authAlgoFactory.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/authAlgoFactory.h b/src/authAlgoFactory.h index 2dca567..db3125b 100644 --- a/src/authAlgoFactory.h +++ b/src/authAlgoFactory.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _AUTHALGO_FACTORY_H_ -#define _AUTHALGO_FACTORY_H_ +#ifndef ANYTUN_authAlgoFactory_h_INCLUDED +#define ANYTUN_authAlgoFactory_h_INCLUDED #include diff --git a/src/bsd/tunDevice.cpp b/src/bsd/tunDevice.cpp index 408434e..4fdd5fd 100644 --- a/src/bsd/tunDevice.cpp +++ b/src/bsd/tunDevice.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,6 +30,9 @@ * along with anytun. If not, see . */ +#include +#include + #include #include #include @@ -42,16 +46,15 @@ #include #include -#include - #include "tunDevice.h" #include "threadUtils.hpp" #include "log.h" #include "anytunError.h" +#include "sysExec.h" #define DEVICE_FILE_MAX 255 -TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_addr, std::string ifcfg_prefix) : conf_(dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400) +TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_addr, u_int16_t ifcfg_prefix) : conf_(dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400) { std::string device_file = "/dev/"; bool dynamic = true; @@ -154,22 +157,22 @@ void TunDevice::init_post() if(conf_.type_ == TYPE_TAP) with_pi_ = false; - if(dev->type_ == TYPE_TUN) { + if(conf_.type_ == TYPE_TUN) { int arg = 0; - if(ioctl(dev->fd_, TUNSLMODE, &arg) < 0) { + if(ioctl(fd_, TUNSLMODE, &arg) < 0) { ::close(fd_); AnytunError::throwErr() << "can't disable link-layer mode for interface: " << AnytunErrno(errno); } arg = 1; - if(ioctl(dev->fd_, TUNSIFHEAD, &arg) < 0) { + if(ioctl(fd_, TUNSIFHEAD, &arg) < 0) { ::close(fd_); AnytunError::throwErr() << "can't enable multi-af modefor interface: " << AnytunErrno(errno); } arg = IFF_BROADCAST; arg |= IFF_MULTICAST; - if(ioctl(dev->fd_, TUNSIFMODE, &arg) < 0) { + if(ioctl(fd_, TUNSIFMODE, &arg) < 0) { ::close(fd_); AnytunError::throwErr() << "can't enable multicast for interface: " << AnytunErrno(errno); } @@ -197,7 +200,7 @@ int TunDevice::fix_return(int ret, size_t pi_length) const if(ret < 0) return ret; - return (static_cast(ret) > type_length ? (ret - type_length) : 0); + return (static_cast(ret) > pi_length ? (ret - pi_length) : 0); } int TunDevice::read(u_int8_t* buf, u_int32_t len) @@ -250,34 +253,23 @@ int TunDevice::write(u_int8_t* buf, u_int32_t len) void TunDevice::do_ifconfig() { - std::ostringstream command; - command << "/sbin/ifconfig " << actual_name_ << " " << conf_.addr_.toString() - << " netmask " << conf_.netmask_.toString() << " mtu " << conf_.mtu_; + std::ostringstream mtu_ss; + mtu_ss << conf_.mtu_; + StringVector args = boost::assign::list_of(actual_name_)(conf_.addr_.toString())("netmask")(conf_.netmask_.toString())("mtu")(mtu_ss.str()); if(conf_.type_ == TYPE_TUN) - command << " up"; + args.push_back("up"); else { #if defined(__GNUC__) && defined(__OpenBSD__) - command << " link0"; + args.push_back("link0"); #elif defined(__GNUC__) && defined(__FreeBSD__) - command << " up"; + args.push_back("up"); #elif defined(__GNUC__) && defined(__NetBSD__) - command << ""; + // nothing to be done here #else #error This Device works just for OpenBSD, FreeBSD or NetBSD #endif } - int result = system(command.str().c_str()); - if(result == -1) - cLog.msg(Log::PRIO_ERROR) << "Execution of ifconfig failed" << AnytunErrno(errno); - else { - if(WIFEXITED(result)) - cLog.msg(Log::PRIO_NOTICE) << "ifconfig returned " << WEXITSTATUS(result); - else if(WIFSIGNALED(result)) - cLog.msg(Log::PRIO_NOTICE) << "ifconfig terminated after signal " << WTERMSIG(result); - else - cLog.msg(Log::PRIO_ERROR) << "Execution of ifconfig: unkown error"; - } - + anytun_exec("/sbin/ifconfig", args); } diff --git a/src/buffer.cpp b/src/buffer.cpp index 2597845..574c034 100644 --- a/src/buffer.cpp +++ b/src/buffer.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/buffer.h b/src/buffer.h index db19947..bbece3d 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _BUFFER_H_ -#define _BUFFER_H_ +#ifndef ANYTUN_buffer_h_INCLUDED +#define ANYTUN_buffer_h_INCLUDED #include "datatypes.h" #include diff --git a/src/cipher.cpp b/src/cipher.cpp index ddde683..5613739 100644 --- a/src/cipher.cpp +++ b/src/cipher.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/cipher.h b/src/cipher.h index 3d922c0..92c4ef2 100644 --- a/src/cipher.h +++ b/src/cipher.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,9 +29,8 @@ * You should have received a copy of the GNU General Public License * along with anytun. If not, see . */ - -#ifndef _CIPHER_H_ -#define _CIPHER_H_ +#ifndef ANYTUN_cipher_h_INCLUDED +#define ANYTUN_cipher_h_INCLUDED #include "datatypes.h" #include "buffer.h" diff --git a/src/cipherFactory.cpp b/src/cipherFactory.cpp index e9f0292..96879b7 100644 --- a/src/cipherFactory.cpp +++ b/src/cipherFactory.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/cipherFactory.h b/src/cipherFactory.h index 23d3b92..96a8d33 100644 --- a/src/cipherFactory.h +++ b/src/cipherFactory.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,9 +29,8 @@ * You should have received a copy of the GNU General Public License * along with anytun. If not, see . */ - -#ifndef _CIPHER_FACTORY_H_ -#define _CIPHER_FACTORY_H_ +#ifndef ANYTUN_cipherFactory_h_INCLUDED +#define ANYTUN_cipherFactory_h_INCLUDED #include diff --git a/src/configure b/src/configure index 770318b..5381010 100755 --- a/src/configure +++ b/src/configure @@ -12,14 +12,15 @@ # tunneling and relaying of packets of any protocol. # # -# Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, +# Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, # Christian Pointner # # This file is part of Anytun. # # Anytun is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License version 3 as -# published by the Free Software Foundation. +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. # # Anytun is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -32,48 +33,114 @@ TARGET=`uname -s` +EBUILD_COMPAT=0 + CXXFLAGS='-g -Wall -O2 -DLOG_SYSLOG -DLOG_FILE -DLOG_STDOUT' -LDFLAGS='-g -Wall -O2 -lboost_thread -lboost_serialization -lboost_system' +LDFLAGS='-g -Wall -O2 -lboost_thread -lboost_serialization -lboost_system -lboost_date_time' CRYPTO_LIB='gcrypt' PASSPHRASE=1 ROUTING=1 +PREFIX='/usr/local' +BINDIR='' +SBINDIR='' +ETCDIR='' +MANDIR='' +INSTALLMANPAGE=1 +EXAMPLESDIR='' +INSTALLEXAMPLES=1 + print_usage() { echo "configure --help print this" + echo " --target= build target i.e. Linux (default: autodetect)" + echo " --prefix= the installation prefix (default: /usr/local)" + echo " --bindir= the path to the bin directory (default: $PREFIX/bin)" + echo " --sbindir= the path to the sbin directory (default: $PREFIX/sbin)" + echo " --sysconfdir= the path to the system configuration directory (default: $PREFIX/etc" + echo " --mandir= the path to the system man pages (default: $PREFIX/share/man)" + echo " --no-manpage dont't install manpages" + echo " --examplesdir= the path to the examples files (default: $PREFIX/share/examples)" + echo " --no-examples dont't install example files" echo " --use-ssl-crypto use ssl crypto library instead of libgcrypt" - echo " --disable-crypto disable crypto at all (only NULL cipher)" + echo " --no-crypto disable crypto at all (only NULL cipher)" echo " --disable-passphrase disable master key and salt passphrase" + echo " --enable-passphrase enable master key and salt passphrase" echo " --disable-routing disable built-in routing capability" + echo " --enable-routing enable built-in routing capability" } for arg do case $arg in + --target=*) + TARGET=${arg#--target=} + ;; + --prefix=*) + PREFIX=${arg#--prefix=} + ;; + --bindir=*) + SBINDIR=${arg#--bindir=} + ;; + --sbindir=*) + SBINDIR=${arg#--sbindir=} + ;; + --sysconfdir=*) + ETCDIR=${arg#--sysconfdir=} + ;; + --mandir=*) + MANDIR=${arg#--mandir=} + ;; + --no-manpage) + INSTALLMANPAGE=0 + ;; + --examplesdir=*) + EXAMPLESDIR=${arg#--examplesdir=} + ;; + --no-examples) + INSTALLEXAMPLES=0 + ;; --use-ssl-crypto) CRYPTO_LIB='ssl' ;; - --disable-crypto) + --no-crypto) CRYPTO_LIB='none' ;; + --enable-passphrase) + PASSPHRASE=1 + ;; --disable-passphrase) PASSPHRASE=0 ;; + --enable-routing) + ROUTING=1 + ;; --disable-routing) ROUTING=0 ;; + --ebuild-compat) + EBUILD_COMPAT=1 + ;; --help) print_usage exit 0 ;; *) - echo "Unknown argument: $arg" - print_usage - exit 1 + ERRORS="$ERRORS $arg" ;; esac done +if [ -n "$ERRORS" ] && [ $EBUILD_COMPAT -ne 1 ]; then + for error in $ERRORS; do + echo "Unknown argument: $error" + done + + print_usage + exit 1 +fi + + rm -f include.mk case $TARGET in Linux) @@ -121,6 +188,26 @@ if [ $ROUTING -eq 0 ]; then echo "disabling built-in routing capability" fi +if [ -z "$BINDIR" ]; then + BINDIR=$PREFIX/bin +fi + +if [ -z "$SBINDIR" ]; then + SBINDIR=$PREFIX/sbin +fi + +if [ -z "$ETCDIR" ]; then + ETCDIR=$PREFIX/etc +fi + +if [ -z "$MANDIR" ]; then + MANDIR=$PREFIX/share/man +fi + +if [ -z "$EXAMPLESDIR" ]; then + EXAMPLESDIR=$PREFIX/share/examples +fi + cat >> include.mk <> include.mk + echo "installing manpage" +else + echo "not installing manpage" +fi + +if [ $INSTALLEXAMPLES -eq 1 ]; then + echo "EXAMPLESDIR := $EXAMPLESDIR" >> include.mk + echo "installing example files" +else + echo "not installing example files" +fi + exit 0 diff --git a/src/connectionList.cpp b/src/connectionList.cpp index 6402711..9ddb277 100644 --- a/src/connectionList.cpp +++ b/src/connectionList.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/connectionList.h b/src/connectionList.h index cdf5268..29eb94f 100644 --- a/src/connectionList.h +++ b/src/connectionList.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _CONNECTION_LIST_H -#define _CONNECTION_LIST_H +#ifndef ANYTUN_connectionList_h_INCLUDED +#define ANYTUN_connectionList_h_INCLUDED #include #include diff --git a/src/connectionParam.cpp b/src/connectionParam.cpp index c6b3ded..fc1e33a 100644 --- a/src/connectionParam.cpp +++ b/src/connectionParam.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/connectionParam.h b/src/connectionParam.h index f929211..ed24531 100644 --- a/src/connectionParam.h +++ b/src/connectionParam.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -28,9 +29,8 @@ * You should have received a copy of the GNU General Public License * along with anytun. If not, see . */ - -#ifndef _CONNECTIONPARAM_H_ -#define _CONNECTIONPARAM_H_ +#ifndef ANYTUN_connectionParam_h_INCLUDED +#define ANYTUN_connectionParam_h_INCLUDED #include "keyDerivation.h" #include "seqWindow.h" diff --git a/src/cryptinit.hpp b/src/cryptinit.hpp index 4460de0..c171c15 100644 --- a/src/cryptinit.hpp +++ b/src/cryptinit.hpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _CRYPTINIT_HPP -#define _CRYPTINIT_HPP +#ifndef ANYTUN_cryptinit_hpp_INCLUDED +#define ANYTUN_cryptinit_hpp_INCLUDED #ifndef NO_CRYPT #ifndef USE_SSL_CRYPTO @@ -110,4 +111,3 @@ bool initLibGCrypt() #endif #endif - diff --git a/src/daemon.hpp b/src/daemon.hpp index b62da17..04834ca 100644 --- a/src/daemon.hpp +++ b/src/daemon.hpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _DAEMON_HPP -#define _DAEMON_HPP +#ifndef ANYTUN_daemon_hpp_INCLUDED +#define ANYTUN_daemon_hpp_INCLUDED #ifndef NO_DAEMON #include @@ -97,7 +98,7 @@ private: void do_chroot(std::string const& chrootdir) { if (getuid() != 0) - AnytunError::throwErr() << "this programm has to be run as root in order to run in a chroot"; + AnytunError::throwErr() << "this program has to be run as root in order to run in a chroot"; if(chroot(chrootdir.c_str())) AnytunError::throwErr() << "can't chroot to " << chrootdir; @@ -162,4 +163,3 @@ void daemonize() } #endif #endif - diff --git a/src/datatypes.h b/src/datatypes.h index 141aae3..4e5977d 100644 --- a/src/datatypes.h +++ b/src/datatypes.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _DATATYPES_H_ -#define _DATATYPES_H_ +#ifndef ANYTUN_datatypes_h_INCLUDED +#define ANYTUN_datatypes_h_INCLUDED #include #include diff --git a/src/deviceConfig.hpp b/src/deviceConfig.hpp index d8702b9..6353cd1 100644 --- a/src/deviceConfig.hpp +++ b/src/deviceConfig.hpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _DEVICE_CONFIG_HPP_ -#define _DEVICE_CONFIG_HPP_ +#ifndef ANYTUN_deviceConfig_hpp_INCLUDED +#define ANYTUN_deviceConfig_hpp_INCLUDED #include "networkAddress.h" #include diff --git a/src/encryptedPacket.cpp b/src/encryptedPacket.cpp index a5aec86..46235c5 100644 --- a/src/encryptedPacket.cpp +++ b/src/encryptedPacket.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/encryptedPacket.h b/src/encryptedPacket.h index 618fa44..bd321b3 100644 --- a/src/encryptedPacket.h +++ b/src/encryptedPacket.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _ENCRYPTED_PACKET_H_ -#define _ENCRYPTED_PACKET_H_ +#ifndef ANYTUN_encryptedPacket_h_INCLUDED +#define ANYTUN_encryptedPacket_h_INCLUDED #include "datatypes.h" #include "buffer.h" diff --git a/src/endian.h b/src/endian.h index 9d96126..75646e7 100644 --- a/src/endian.h +++ b/src/endian.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _ENDIAN_H_ -#define _ENDIAN_H_ +#ifndef ANYTUN_endian_h_INCLUDED +#define ANYTUN_endian_h_INCLUDED #ifndef _WIN32 #include diff --git a/src/keyDerivation.cpp b/src/keyDerivation.cpp index cdf6368..6b102b9 100644 --- a/src/keyDerivation.cpp +++ b/src/keyDerivation.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -41,6 +42,7 @@ #include #include #include +#include #ifndef NO_CRYPT #ifndef NO_PASSPHRASE @@ -85,7 +87,7 @@ void KeyDerivation::calcMasterKey(std::string passphrase, u_int16_t length) #endif master_key_.setLength(length); - memcpy(master_key_.getBuf(), &digest.getBuf()[digest.getLength() - master_key_.getLength()], master_key_.getLength()); + std::memcpy(master_key_.getBuf(), &digest.getBuf()[digest.getLength() - master_key_.getLength()], master_key_.getLength()); } void KeyDerivation::calcMasterSalt(std::string passphrase, u_int16_t length) @@ -114,7 +116,7 @@ void KeyDerivation::calcMasterSalt(std::string passphrase, u_int16_t length) #endif master_salt_.setLength(length); - memcpy(master_salt_.getBuf(), &digest.getBuf()[digest.getLength() - master_salt_.getLength()], master_salt_.getLength()); + std::memcpy(master_salt_.getBuf(), &digest.getBuf()[digest.getLength() - master_salt_.getLength()], master_salt_.getLength()); } #endif #endif @@ -287,7 +289,7 @@ bool AesIcmKeyDerivation::calcCtr(kd_dir_t dir, satp_prf_label_t label, seq_nr_t cLog.msg(Log::PRIO_ERROR) << "KeyDerivation::calcCtr: salt lengths don't match"; return false; } - memcpy(ctr_[dir].salt_.buf_, master_salt_.getBuf(), SALT_LENGTH); + std::memcpy(ctr_[dir].salt_.buf_, master_salt_.getBuf(), SALT_LENGTH); ctr_[dir].salt_.zero_ = 0; ctr_[dir].params_.label_ ^= SATP_PRF_LABEL_T_HTON(convertLabel(dir, label)); ctr_[dir].params_.seq_ ^= SEQ_NR_T_HTON(seq_nr); diff --git a/src/keyDerivation.h b/src/keyDerivation.h index 12d370c..eea4266 100644 --- a/src/keyDerivation.h +++ b/src/keyDerivation.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _KEYDERIVATION_H_ -#define _KEYDERIVATION_H_ +#ifndef ANYTUN_keyDerivation_h_INCLUDED +#define ANYTUN_keyDerivation_h_INCLUDED #include "datatypes.h" #include "buffer.h" @@ -47,6 +48,7 @@ #endif #include #include +#include #define LABEL_ENC 0 #define LABEL_AUTH 1 @@ -200,4 +202,3 @@ private: #endif #endif - diff --git a/src/keyDerivationFactory.cpp b/src/keyDerivationFactory.cpp index 75df38a..d325c35 100644 --- a/src/keyDerivationFactory.cpp +++ b/src/keyDerivationFactory.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/keyDerivationFactory.h b/src/keyDerivationFactory.h index 77caf58..caafe7e 100644 --- a/src/keyDerivationFactory.h +++ b/src/keyDerivationFactory.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _KEYDERIVATION_FACTORY_H_ -#define _KEYDERIVATION_FACTORY_H_ +#ifndef ANYTUN_keyDerivationFactory_h_INCLUDED +#define ANYTUN_keyDerivationFactory_h_INCLUDED #include diff --git a/src/linux/tunDevice.cpp b/src/linux/tunDevice.cpp index b34ae9d..57b1c7c 100644 --- a/src/linux/tunDevice.cpp +++ b/src/linux/tunDevice.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -31,6 +32,7 @@ #include #include +#include #include #include @@ -46,6 +48,7 @@ #include "threadUtils.hpp" #include "log.h" #include "anytunError.h" +#include "sysExec.h" TunDevice::TunDevice(std::string dev_name, std::string dev_type, std::string ifcfg_addr, u_int16_t ifcfg_prefix) : conf_(dev_name, dev_type, ifcfg_addr, ifcfg_prefix, 1400) { @@ -155,19 +158,8 @@ void TunDevice::init_post() void TunDevice::do_ifconfig() { - std::ostringstream command; - command << "/sbin/ifconfig " << actual_name_ << " " << conf_.addr_.toString() - << " netmask " << conf_.netmask_.toString() << " mtu " << conf_.mtu_; - - int result = system(command.str().c_str()); - if(result == -1) - cLog.msg(Log::PRIO_ERROR) << "Execution of ifconfig failed: " << AnytunErrno(errno); - else { - if(WIFEXITED(result)) - cLog.msg(Log::PRIO_NOTICE) << "ifconfig returned " << WEXITSTATUS(result); - else if(WIFSIGNALED(result)) - cLog.msg(Log::PRIO_NOTICE) << "ifconfig terminated after signal " << WTERMSIG(result); - else - cLog.msg(Log::PRIO_ERROR) << "Execution of ifconfig: unkown error"; - } + std::ostringstream mtu_ss; + mtu_ss << conf_.mtu_; + StringVector args = boost::assign::list_of(actual_name_)(conf_.addr_.toString())("netmask")(conf_.netmask_.toString())("mtu")(mtu_ss.str()); + anytun_exec("/sbin/ifconfig", args); } diff --git a/src/log.cpp b/src/log.cpp index d0ed7f8..d1049b2 100644 --- a/src/log.cpp +++ b/src/log.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of diff --git a/src/log.h b/src/log.h index dcdedc4..8ff24e3 100644 --- a/src/log.h +++ b/src/log.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _LOG_H_ -#define _LOG_H_ +#ifndef ANYTUN_log_h_INCLUDED +#define ANYTUN_log_h_INCLUDED #include #include diff --git a/src/logTargets.cpp b/src/logTargets.cpp index 9a07309..5b19954 100644 --- a/src/logTargets.cpp +++ b/src/logTargets.cpp @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -44,6 +45,8 @@ #include #endif +#include + LogTarget::LogTarget() : opened(false), enabled(false), max_prio(Log::PRIO_NOTICE) { } @@ -326,7 +329,8 @@ void LogTargetFile::log(std::string msg, int prio) if(!opened) return; - logfile << Log::prioToString(prio) << ": " << msg << std::endl; + std::string timestamp = boost::posix_time::to_simple_string(boost::posix_time::second_clock::local_time()); + logfile << timestamp << " " << Log::prioToString(prio) << ": " << msg << std::endl; } LogTargetFile& LogTargetFile::setLogFilename(std::string l) @@ -366,7 +370,8 @@ void LogTargetStdout::log(std::string msg, int prio) if(!opened) return; - stream << "LOG-" << Log::prioToString(prio) << ": " << msg << std::endl; + std::string timestamp = boost::posix_time::to_simple_string(boost::posix_time::second_clock::local_time()); + stream << timestamp << " " << Log::prioToString(prio) << ": " << msg << std::endl; } #endif diff --git a/src/logTargets.h b/src/logTargets.h index 64ad945..63156c1 100644 --- a/src/logTargets.h +++ b/src/logTargets.h @@ -11,14 +11,15 @@ * tunneling and relaying of packets of any protocol. * * - * Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, + * Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, * Christian Pointner * * This file is part of Anytun. * * Anytun is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 3 as - * published by the Free Software Foundation. + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. * * Anytun is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,8 +30,8 @@ * along with anytun. If not, see . */ -#ifndef _LOG_TARGETS_H_ -#define _LOG_TARGETS_H_ +#ifndef ANYTUN_logTargets_h_INCLUDED +#define ANYTUN_logTargets_h_INCLUDED #include #include diff --git a/src/man/Makefile b/src/man/Makefile index cdd45a6..adc9919 100644 --- a/src/man/Makefile +++ b/src/man/Makefile @@ -11,14 +11,15 @@ ## tunneling and relaying of packets of any protocol. ## ## -## Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl, +## Copyright (C) 2007-2009 Othmar Gsenger, Erwin Nindl, ## Christian Pointner ## ## This file is part of Anytun. ## ## Anytun is free software: you can redistribute it and/or modify -## it under the terms of the GNU General Public License version 3 as -## published by the Free Software Foundation. +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation, either version 3 of the License, or +## any later version. ## ## Anytun is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -29,29 +30,28 @@ ## along with anytun. If not, see . ## -all: manpage - -anytun.8: anytun.8.txt - a2x -f manpage anytun.8.txt +VERSION=$(shell cat ../../version) -anytun-controld.8: anytun-controld.8.txt - a2x -f manpage anytun-controld.8.txt +MANPAGES := anytun.8 anytun-controld.8 anytun-config.8 anytun-showtables.8 #anyrtpproxy.8 +XML := $(MANPAGES:%.8=%.8.xml) -anytun-config.8: anytun-config.8.txt - a2x -f manpage anytun-config.8.txt +.PHONY: clean -anytun-showtables.8: anytun-showtables.8.txt - a2x -f manpage anytun-showtables.8.txt +all: manpage -anyrtpproxy.8: anyrtpproxy.8.txt - a2x -f manpage anyrtpproxy.8.txt +define create-manpage + a2x -f manpage $(1) + @ sed -i -e 's/\[FIXME: source\]/anytun ${VERSION}/' $(2) + @ sed -i -e 's/\[FIXME: manual\]/$(2:.8=) user manual/' $(2) + @ sed -i -e 's/^\($(subst -,\\-,$(2:.8=))\)$$/\\fB\1\\fR/' $(2) + @ sed -i -e 's/^ \[ \([^ ]*\)/ [ \\fB\1\\fR/' $(2) +endef +%.8: %.8.txt + $(call create-manpage,$<,$@) -manpage: anytun.8 anytun-controld.8 anytun-config.8 anytun-showtables.8 anyrtpproxy.8 +manpage: $(MANPAGES) clean: - rm -f anytun.8 anytun.8.xml - rm -f anytun-controld.8 anytun-controld.8.xml - rm -f anytun-config.8 anytun-config.8.xml - rm -f anytun-showtables.8 anytun-showtables.8.xml - rm -f anyrtpproxy.8 anyrtpproxy.8.xml \ No newline at end of file + rm -f $(MANPAGES) + rm -f $(XML) diff --git a/src/man/anyrtpproxy.8.txt b/src/man/anyrtpproxy.8.txt index a867631..a92d2e6 100644 --- a/src/man/anyrtpproxy.8.txt +++ b/src/man/anyrtpproxy.8.txt @@ -8,20 +8,22 @@ anyrtpproxy - anycast rtpproxy SYNOPSIS -------- -*anyrtpproxy* -[ *-h|--help* ] -[ *-D|--nodaemonize* ] -[ *-C|--chroot* ] -[ *-u|--username* ] -[ *-H|--chroot-dir* ] -[ *-P|--write-pid* ] -[ *-i|--interface* ] -[ *-s|--control* [:] ] -[ *-p|--port-range* ] -[ *-n|--nat* ] -[ *-o|--no-nat-once* ] -[ *-S|--sync-port* port> ] -[ *-M|--sync-hosts* :[,:[...]] ] +.... +anyrtpproxy + [ -h|--help ] + [ -D|--nodaemonize ] + [ -C|--chroot ] + [ -u|--username ] + [ -H|--chroot-dir ] + [ -P|--write-pid ] + [ -i|--interface ] + [ -s|--control [:] ] + [ -p|--port-range ] + [ -n|--nat ] + [ -o|--no-nat-once ] + [ -S|--sync-port port> ] + [ -M|--sync-hosts :[,:[...]] ] +.... DESCRIPTION @@ -29,89 +31,62 @@ DESCRIPTION *anyrtpproxy* is a rtpproxy which can be used in combination with anycast. It uses the same control protocol than rtpproxy though it can be controled through the nathelper -plugin of openser. *anyrtpproxy* uses the same synchronisation protocol than *anytun* +plugin of openser. *anyrtpproxy* uses the same synchronisation protocol than *Anytun* to sync the session information among all anycast instances. OPTIONS ------- --D|--nodaemonize -~~~~~~~~~~~~~~~~ +*-D, --nodaemonize*:: + This option instructs *anyrtpproxy* to run in the foreground + instead of becoming a daemon. -This option instructs *anyrtpproxy* to run in the foreground -instead of becoming a daemon. +*-C, --chroot*:: + chroot and drop privileges --C|--chroot -~~~~~~~~~~~ +*-u, --username *:: + if chroot change to this user -chroot and drop privileges +*-H, --chroot-dir *:: + chroot to this directory --u|--username -~~~~~~~~~~~~~~~~~~~~~~~~ +*-P, --write-pid *:: + write pid to this file -if chroot change to this user +*-i, --interface *:: + The local interface to listen on for RTP packets --H|--chroot-dir -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*-s, --control [:]*:: + The local address and port to listen on for control messages from openser -chroot to this directory +*-p, --port-range *:: + A pool of ports which should be used by *anyrtpproxy* to relay RTP packets. + The range may not overlap between the anycast instances --P|--write-pid -~~~~~~~~~~~~~~~~~~~~~~~~~ +*-n, --nat*:: + Allow to learn the remote address and port in order to handle clients behind nat. + This option should only be enabled if the source is authenticated (i.e. through + *anytun*) -write pid to this file +*-o, --no-nat-once*:: + Disable learning of remote address and port in case the first packet does not + come from the client which is specified by openser during configuration. Invoking + this parameter increases the security level of the system but in case of nat needs + a working nat transversal such as stun. --i|--interface -~~~~~~~~~~~~~~~~~~~~~~~~~~~ +*-S, --sync-port *:: + local unicast(sync) port to bind to + + This port is used by anycast hosts to synchronize information about tunnel + endpoints. No payload data is transmitted via this port. + + It is possible to obtain a list of active connections by telnetting into + this port. This port is read-only and unprotected by default. It is advised + to protect this port using firewall rules and, eventually, IPsec. -The local interface to listen on for RTP packets - --s|--control [:] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The local address and port to listen on for control messages from openser - --p|--port-range -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -A pool of ports which should be used by *anyrtpproxy* to relay RTP packets. -The range may not overlap between the anycast instances - --n|--nat -~~~~~~~~ - -Allow to learn the remote address and port in order to handle clients behind nat. -This option should only be enabled if the source is authenticated (i.e. through -*anytun*) - --o|--no-nat-once -~~~~~~~~~~~~~~~~ - -Disable learning of remote address and port in case the first packet does not -come from the client which is specified by openser during configuration. Invoking -this parameter increases the security level of the system but in case of nat needs -a working nat transversal such as stun. - --S|--sync-port -~~~~~~~~~~~~~~~~~~~~~ - -local unicast(sync) port to bind to - -This port is used by anycast hosts to synchronize information about tunnel -endpoints. No payload data is transmitted via this port. - -It is possible to obtain a list of active connections by telnetting into -this port. This port is read-only and unprotected by default. It is advised -to protect this port using firewall rules and, eventually, IPsec. - --M|--sync-hosts :,[:[...]] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -remote hosts to sync with - -Here, one has to specify all unicast IP addresses of all -other anycast hosts that comprise the anycast tunnel endpoint. +*-M, --sync-hosts :,[:[...]]*:: + remote hosts to sync with + + Here, one has to specify all unicast IP addresses of all + other anycast hosts that comprise the anycast tunnel endpoint. EXAMPLES -------- @@ -141,8 +116,6 @@ hostname anycast.anytun.org: -------------------------------------------------------------------------------------- - - BUGS ---- Most likely there are some bugs in *anyrtpproxy*. If you find a bug, please let @@ -154,19 +127,11 @@ anytun(8) AUTHORS ------- -Design of SATP and wizards of this implementation: Othmar Gsenger Erwin Nindl Christian Pointner -Debian packaging: - -Andreas Hirczy - -Manual page: - -Alexander List RESOURCES --------- @@ -177,8 +142,9 @@ Main web site: http://www.anytun.org/ COPYING ------- -Copyright \(C) 2007-2008 Othmar Gsenger, Erwin Nindl and Christian -Pointner. This program is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. +Copyright \(C) 2007-2009 Othmar Gsenger, Erwin Nindl and Christian +Pointner. This program is free software: you can redistribute it +and/or modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, either version 3 of +the License, or any later version. diff --git a/src/man/anytun-config.8.txt b/src/man/anytun-config.8.txt index 8eb2839..6a80b4d 100644 --- a/src/man/anytun-config.8.txt +++ b/src/man/anytun-config.8.txt @@ -8,21 +8,23 @@ anytun-config - anycast tunneling configuration utility SYNOPSIS -------- -*anytun-config* -[ *-h|--help* ] -[ *-L|--log* :[,[,[..]]] -[ *-r|--remote-host* ] -[ *-o|--remote-port* ] -[ *-4|--ipv4-only* ] -[ *-6|--ipv6-only* ] -[ *-R|--route* / ] -[ *-m|--mux* ] -[ *-w|--window-size* ] -[ *-k|--kd-prf* ] -[ *-e|--role * ] -[ *-E|--passphrase* ] -[ *-K|--key* ] -[ *-A|--salt* ] +.... +anytun-config + [ -h|--help ] + [ -L|--log :[,[,[..]]] + [ -r|--remote-host ] + [ -o|--remote-port ] + [ -4|--ipv4-only ] + [ -6|--ipv6-only ] + [ -R|--route / ] + [ -m|--mux ] + [ -w|--window-size ] + [ -k|--kd-prf ] + [ -e|--role ] + [ -E|--passphrase ] + [ -K|--key ] + [ -A|--salt ] +.... DESCRIPTION ----------- @@ -32,138 +34,100 @@ DESCRIPTION OPTIONS ------- --L|--log :[,[,[..]]] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -add log target to logging system. This can be invoked several times -in order to log to different targets at the same time. Every target -hast its own log level which is a number between 0 and 5. Where 0 means -disabling log and 5 means debug messages are enabled. - -The following targets are supported: - -* *syslog* - log to syslog daemon, parameters [,[,]] -* *file* - log to file, parameters [,] -* *stdout* - log to standard output, parameters -* *stderr* - log to standard error, parameters - -The file target can be used more the once with different levels. -If no target is provided at the command line a single target with the -following config is added: - -*syslog:3,uanytun,daemon* - --r|--remote-host -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -remote host - -This option can be used to specify the remote tunnel -endpoint. In case of anycast tunnel endpoints, the -anycast IP address has to be used. If you do not specify -an address, it is automatically determined after receiving -the first data packet. - --o|--remote-port -~~~~~~~~~~~~~~~~~~~~~~~ -remote port - -The UDP port used for payload data by the remote host -(specified with -p on the remote host). If you do not specify -a port, it is automatically determined after receiving -the first data packet. - --4|--ipv4-only -~~~~~~~~~~~~~~ - -Resolv to IPv4 addresses only. The default is to resolv both -IPv4 and IPv6 addresses. - --6|--ipv6-only -~~~~~~~~~~~~~~ - -Resolv to IPv6 addresses only. The default is to resolv both -IPv4 and IPv6 addresses. - --R|--route / -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -add a route to connection. This can be invoked several times. - --m|--mux -~~~~~~~~~~~~~~~~~ - -the multiplex id to use. default: 0 - --w|--window-size -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -seqence window size - -Sometimes, packets arrive out of order on the receiver -side. This option defines the size of a list of received -packets' sequence numbers. If, according to this list, -a received packet has been previously received or has -been transmitted in the past, and is therefore not in -the list anymore, this is interpreted as a replay attack -and the packet is dropped. A value of 0 deactivates this -list and, as a consequence, the replay protection employed -by filtering packets according to their secuence number. -By default the sequence window is disabled and therefore a -window size of 0 is used. - --k|--kd--prf -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -key derivation pseudo random function. - -The pseudo random function which is used for calculating the -session keys and session salt. - -Possible values: - -* *null* - no random function, keys and salt are set to 0..00 -* *aes-ctr* - AES in counter mode with 128 Bits, default value -* *aes-ctr-128* - AES in counter mode with 128 Bits -* *aes-ctr-192* - AES in counter mode with 192 Bits -* *aes-ctr-256* - AES in counter mode with 256 Bits - --e|--role -~~~~~~~~~~~~~~~~ - -SATP uses different session keys for inbound and outbound traffic. The -role parameter is used to determine which keys to use for outbound or -inbound packets. On both sides of a vpn connection different roles have -to be used. Possible values are *left* and *right*. You may also use -*alice* or *server* as a replacement for *left* and *bob* or *client* as -a replacement for *right*. By default *left* is used. - --E|--passphrase -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -This passphrase is used to generate the master key and master salt. -For the master key the last n bits of the SHA256 digest of the -passphrase (where n is the length of the master key in bits) is used. -The master salt gets generated with the SHA1 digest. -You may force a specific key and or salt by using *--key* and *--salt*. - --K|--key -~~~~~~~~~~~~~~~~~~~~~ - -master key to use for key derivation - -Master key in hexadecimal notation, eg -01a2b3c4d5e6f708a9b0cadbecfd0fa1, with a mandatory length -of 32, 48 or 64 characters (128, 192 or 256 bits). - --A|--salt -~~~~~~~~~~~~~~~~~~~~~~~ - -master salt to use for key derivation - -Master salt in hexadecimal notation, eg -01a2b3c4d5e6f708a9b0cadbecfd, with a mandatory length -of 28 characters (14 bytes). +*-L, --log :[,[,[..]]]*:: + add log target to logging system. This can be invoked several times + in order to log to different targets at the same time. Every target + hast its own log level which is a number between 0 and 5. Where 0 means + disabling log and 5 means debug messages are enabled. + + The file target can be used more the once with different levels. + If no target is provided at the command line a single target with the + config *syslog:3,anytun-config,daemon* is added. + + The following targets are supported: + + *syslog*;; log to syslog daemon, parameters [,[,]] + *file*;; log to file, parameters [,] + *stdout*;; log to standard output, parameters + *stderr*;; log to standard error, parameters + +*-r, --remote-host *:: + This option can be used to specify the remote tunnel + endpoint. In case of anycast tunnel endpoints, the + anycast IP address has to be used. If you do not specify + an address, it is automatically determined after receiving + the first data packet. + +*-o, --remote-port *:: + The UDP port used for payload data by the remote host + (specified with -p on the remote host). If you do not specify + a port, it is automatically determined after receiving + the first data packet. + +*-4, --ipv4-only*:: + Resolv to IPv4 addresses only. The default is to resolv both + IPv4 and IPv6 addresses. + +*-6, --ipv6-only*:: + Resolv to IPv6 addresses only. The default is to resolv both + IPv4 and IPv6 addresses. + +*-R, --route /*:: + add a route to connection. This can be invoked several times. + +*-m, --mux *:: + the multiplex id to use. default: 0 + +*-w, --window-size *:: + seqence window size + + Sometimes, packets arrive out of order on the receiver + side. This option defines the size of a list of received + packets' sequence numbers. If, according to this list, + a received packet has been previously received or has + been transmitted in the past, and is therefore not in + the list anymore, this is interpreted as a replay attack + and the packet is dropped. A value of 0 deactivates this + list and, as a consequence, the replay protection employed + by filtering packets according to their secuence number. + By default the sequence window is disabled and therefore a + window size of 0 is used. + +*-k, --kd--prf *:: + key derivation pseudo random function + + The pseudo random function which is used for calculating the + session keys and session salt. + + Possible values: + + *null*;; no random function, keys and salt are set to 0..00 + *aes-ctr*;; AES in counter mode with 128 Bits, default value + *aes-ctr-128*;; AES in counter mode with 128 Bits + *aes-ctr-192*;; AES in counter mode with 192 Bits + *aes-ctr-256*;; AES in counter mode with 256 Bits + +*-e, --role *:: + SATP uses different session keys for inbound and outbound traffic. The + role parameter is used to determine which keys to use for outbound or + inbound packets. On both sides of a vpn connection different roles have + to be used. Possible values are *left* and *right*. You may also use + *alice* or *server* as a replacement for *left* and *bob* or *client* as + a replacement for *right*. By default *left* is used. + +*-E, --passphrase *:: + This passphrase is used to generate the master key and master salt. + For the master key the last n bits of the SHA256 digest of the + passphrase (where n is the length of the master key in bits) is used. + The master salt gets generated with the SHA1 digest. + You may force a specific key and or salt by using *--key* and *--salt*. + +*-K, --key *:: + master key to use for key derivation + + Master key in hexadecimal notation, e.g. + 01a2b3c4d5e6f708a9b0cadbecfd0fa1, with a mandatory length + of 32, 48 or 64 characters (128, 192 or 256 bits). + +*-A, --salt *:: + master salt to use for key derivation + + Master salt in hexadecimal notation, e.g. + 01a2b3c4d5e6f708a9b0cadbecfd, with a mandatory length + of 28 characters (14 bytes). EXAMPLES @@ -178,7 +142,7 @@ Add a client with Connection ID (Mux) 12 and add 2 Routes to this client BUGS ---- -Most likely there are some bugs in *anytun*. If you find a bug, please let +Most likely there are some bugs in *Anytun*. If you find a bug, please let the developers know at satp@anytun.org. Of course, patches are preferred. SEE ALSO @@ -187,19 +151,11 @@ anytun(8), anytun-controld(8), anytun-showtables(8) AUTHORS ------- -Design of SATP and wizards of this implementation: Othmar Gsenger Erwin Nindl Christian Pointner -Debian packaging: - -Andreas Hirczy - -Manual page: - -Alexander List RESOURCES --------- @@ -210,8 +166,8 @@ Main web site: http://www.anytun.org/ COPYING ------- -Copyright \(C) 2007-2008 Othmar Gsenger, Erwin Nindl and Christian -Pointner. This program is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - +Copyright \(C) 2007-2009 Othmar Gsenger, Erwin Nindl and Christian +Pointner. This program is free software: you can redistribute it +and/or modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, either version 3 of +the License, or any later version. diff --git a/src/man/anytun-controld.8.txt b/src/man/anytun-controld.8.txt index 2b1c7a1..0d3e0b8 100644 --- a/src/man/anytun-controld.8.txt +++ b/src/man/anytun-controld.8.txt @@ -8,96 +8,77 @@ anytun-controld - anycast tunneling control daemon SYNOPSIS -------- -*anytun-controld* -[ *-h|--help* ] -[ *-D|--nodaemonize* ] -[ *-u|--username* ] -[ *-g|--groupname* ] -[ *-C|--chroot* ] -[ *-P|--write-pid* ] -[ *-L|--log* :[,[,[..]]] ] -[ *-f|--file* ] -[ *-X|--control-host* < [:port>] | : > ] +.... +anytun-controld + [ -h|--help ] + [ -D|--nodaemonize ] + [ -u|--username ] + [ -g|--groupname ] + [ -C|--chroot ] + [ -P|--write-pid ] + [ -L|--log :[,[,[..]]] ] + [ -f|--file ] + [ -X|--control-host < [:port>] | : > ] +.... DESCRIPTION ----------- -*anytun-controld* configures the multi-connection support for *anytun*. It reads a connection/routing table and outputs it via a tcp socket to all connected *anytun* servers. When the control daemon is restarted with a new connection/routing table all *anytun* servers automatically load the new configuration. Please make sure to protect that information as it contains the connection keys. +*anytun-controld* configures the multi-connection support for *Anytun*. It reads a connection/routing table and outputs it via a tcp socket to all connected *Anytun* servers. When the control daemon is restarted with a new connection/routing table all *Anytun* servers automatically load the new configuration. Please make sure to protect that information as it contains the connection keys. OPTIONS ------- --D|--nodaemonize -~~~~~~~~~~~~~~~~ - -This option instructs *anytun* to run in foreground -instead of becoming a daemon which is the default. - --u|--username -~~~~~~~~~~~~~~~~~~~~~~~~ - -run as this user. If no group is specified (*-g*) the default group of -the user is used. The default is to not drop privileges. - --g|--groupname -~~~~~~~~~~~~~~~~~~~~~~~~~~ - -run as this group. If no username is specified (*-u*) this gets ignored. -The default is to not drop privileges. - --C|--chroot -~~~~~~~~~~~~~~~~~~ - -Instruct *anytun* to run in a chroot jail. The default is -to not run in chroot. - --P|--write-pid -~~~~~~~~~~~~~~~~~~~~~~~~~ - -Instruct *anytun* to write it's pid to this file. The default is -to not create a pid file. - --L|--log :[,[,[..]]] -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -add log target to logging system. This can be invoked several times -in order to log to different targets at the same time. Every target -hast its own log level which is a number between 0 and 5. Where 0 means -disabling log and 5 means debug messages are enabled. - -The following targets are supported: - -* *syslog* - log to syslog daemon, parameters [,[,]] -* *file* - log to file, parameters [,] -* *stdout* - log to standard output, parameters -* *stderr* - log to standard error, parameters - -The file target can be used more the once with different levels. -If no target is provided at the command line a single target with the -following config is added: - -*syslog:3,uanytun,daemon* - --f|--file -~~~~~~~~~~~~~~~~ - -The path to the file which holds the sync information. - --X|--control-host < [:] | : > -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -The local ip address and or tcp port to bind to. Mind that if an -address is given the port can be omitted in which case port 2323 -is used. You can also specify to listen on an specific port but on -all interfaces by omitting the address. If you want to specify an -ipv6 address and a port you have to use [ and ] to seperate the address -from the port, eg.: [::1]:1234. If you want to use the default port -[ and ] can be omitted. default: 127.0.0.1:2323 +*-D, --nodaemonize*:: + This option instructs *anytun-controld* to run in foreground + instead of becoming a daemon which is the default. + +*-u, --username *:: + run as this user. If no group is specified (*-g*) the default group of + the user is used. The default is to not drop privileges. + +*-g, --groupname *:: + run as this group. If no username is specified (*-u*) this gets ignored. + The default is to not drop privileges. + +*-C, --chroot *:: + Instruct *anytun-controld* to run in a chroot jail. The default is + to not run in chroot. + +*-P, --write-pid *:: + Instruct *anytun-controld* to write it's pid to this file. The default is + to not create a pid file. + +*-L, --log :[,[,[..]]]*:: + add log target to logging system. This can be invoked several times + in order to log to different targets at the same time. Every target + hast its own log level which is a number between 0 and 5. Where 0 means + disabling log and 5 means debug messages are enabled. + + The file target can be used more the once with different levels. + If no target is provided at the command line a single target with the + config *syslog:3,anytun-controld,daemon* is added. + + The following targets are supported: + + *syslog*;; log to syslog daemon, parameters [,[,]] + *file*;; log to file, parameters [,] + *stdout*;; log to standard output, parameters + *stderr*;; log to standard error, parameters + +*-f, --file *:: + The path to the file which holds the sync information. + +*-X, --control-host [:]*:: + fetch the config from this host. The default is not to use a control + host and therefore this is empty. Mind that the port can be omitted + in which case port 2323 is used. If you want to specify an + ipv6 address and a port you have to use [ and ] to seperate the address + from the port, eg.: [::1]:1234. If you want to use the default port + [ and ] can be omitted. BUGS ---- -Most likely there are some bugs in *anytun*. If you find a bug, please let +Most likely there are some bugs in *Anytun*. If you find a bug, please let the developers know at satp@anytun.org. Of course, patches are preferred. SEE ALSO @@ -106,19 +87,11 @@ anytun(8), anytun-config(8), anytun-showtables(8) AUTHORS ------- -Design of SATP and wizards of this implementation: Othmar Gsenger Erwin Nindl Christian Pointner -Debian packaging: - -Andreas Hirczy - -Manual page: - -Alexander List RESOURCES --------- @@ -129,8 +102,9 @@ Main web site: http://www.anytun.org/ COPYING ------- -Copyright \(C) 2007-2008 Othmar Gsenger, Erwin Nindl and Christian -Pointner. This program is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. +Copyright \(C) 2007-2009 Othmar Gsenger, Erwin Nindl and Christian +Pointner. This program is free software: you can redistribute it +and/or modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, either version 3 of +the License, or any later version. diff --git a/src/man/anytun-showtables.8.txt b/src/man/anytun-showtables.8.txt index 9a04f26..3a1fa8d 100644 --- a/src/man/anytun-showtables.8.txt +++ b/src/man/anytun-showtables.8.txt @@ -8,12 +8,14 @@ anytun-showtables - anycast tunneling routing table visualization utility SYNOPSIS -------- -*anytun-showtables* +.... +anytun-showtables +.... DESCRIPTION ----------- -*anytun-showtables* displays routing and connection tables used by *anytun*. It can be used to display a saved routing/connection table used by *anytun-controld* or to connect to a the sync port of *anytun*. +*anytun-showtables* displays routing and connection tables used by *Anytun*. It can be used to display a saved routing/connection table used by *anytun-controld* or to connect to a the sync port of *Anytun*. OPTIONS ------- @@ -38,7 +40,7 @@ Print current routing table and watch changes BUGS ---- -Most likely there are some bugs in *anytun*. If you find a bug, please let +Most likely there are some bugs in *Anytun*. If you find a bug, please let the developers know at satp@anytun.org. Of course, patches are preferred. SEE ALSO @@ -47,19 +49,11 @@ anytun(8), anytun-controld(8), anytun-config(8) AUTHORS ------- -Design of SATP and wizards of this implementation: Othmar Gsenger Erwin Nindl Christian Pointner -Debian packaging: - -Andreas Hirczy - -Manual page: - -Alexander List RESOURCES --------- @@ -70,8 +64,8 @@ Main web site: http://www.anytun.org/ COPYING ------- -Copyright \(C) 2007-2008 Othmar Gsenger, Erwin Nindl and Christian -Pointner. This program is free software; you can redistribute -it and/or modify it under the terms of the GNU General Public License -version 2 as published by the Free Software Foundation. - +Copyright \(C) 2007-2009 Othmar Gsenger, Erwin Nindl and Christian +Pointner. This program is free software: you can redistribute it +and/or modify it under the terms of the GNU General Public License +as published by the Free Software Foundation, either version 3 of +the License, or any later version. diff --git a/src/man/anytun.8.txt b/src/man/anytun.8.txt index fa30441..377bb2d 100644 --- a/src/man/anytun.8.txt +++ b/src/man/anytun.8.txt @@ -8,47 +8,49 @@ anytun - anycast tunneling daemon SYNOPSIS -------- -*anytun* -[ *-h|--help* ] -[ *-D|--nodaemonize* ] -[ *-u|--username* ] -[ *-g|--groupname* ] -[ *-C|--chroot* ] -[ *-P|--write-pid* ] -[ *-L|--log* :[,[,[..]]] ] -[ *-i|--interface* ] -[ *-p|--port* ] -[ *-r|--remote-host* ] -[ *-o|--remote-port* ] -[ *-4|--ipv4-only* ] -[ *-6|--ipv6-only* ] -[ *-I|--sync-interface* ] -[ *-S|--sync-port* port> ] -[ *-M|--sync-hosts* [:][,[:][...]] ] -[ *-X|--control-host* [:] -[ *-d|--dev* ] -[ *-t|--type* ] -[ *-n|--ifconfig* / ] -[ *-x|--post-up-script*