debian/0000755000000000000000000000000012222143461007163 5ustar debian/README.Debian0000644000000000000000000000257312222134230011225 0ustar README file for Debian package gogoc ==================================== Obtaining Server Key -------------------- If you use the authentication methods to login to the broker, you will need to get the server key. The program will check for the correct key and not start without it. To obtain the key, run /usr/sbin/gogoc -n on the command line and agree to add the key. Server Key Checks ----------------- The init script by default will check for a server key file and to see if the right server key is present to stop the daemon from hanging and waiting for input. If you want to disable this check, edit the /etc/default/gogoc file and change the CHECK_KEYFILE line to "no". Directory Changes ----------------- The default placement for all the files, binaries and dynamic files included, is to put them all into one directory. This package follows the FHS and so you will find the files in different places: gogoc.conf configuration file : in /etc/gogoc linux.sh setup script : in /usr/share/gogoc/template radvd.conf script generated by linux.sh : in /var/run/gogoc log files : in /var/log/gogoc Multiple Interfaces ------------------- gogoc can get radvd to advertise multiple subnets on different interfaces. To do this, interfaces.conf needs to be created in /etc/gogoc. There is an example of the configuration file in /usr/share/doc/gogoc/examples debian/control0000644000000000000000000000176512222134043010573 0ustar Source: gogoc Section: net Priority: extra Maintainer: Craig Small Build-Depends: debhelper (>= 9), libssl-dev Standards-Version: 3.9.4 Vcs-Browser: http://git.debian.org/?p=collab-maint/gw6c.git Vcs-Git: git://git.debian.org/collab-maint/gw6c.git Homepage: http://go6.net/4105/application.asp Package: gogoc Architecture: any Depends: ${misc:Depends}, ${shlibs:Depends}, net-tools, iproute2 [linux-any] Recommends: radvd Suggests: sipcalc Description: Client to connect to IPv6 tunnel brokers TSP is a control protocol used to establish and maintain static tunnels. The Gateway6 client (gogoc) is used on the host computer to connect to a tunnel broker using the TSP protocol and to get the information for its tunnel. When it receives the information for the tunnel, the Gateway6 client creates the static tunnel on its operating system. . This package was previously called gw6c or tspc. . sipcalc is only required if you have multiple LAN interfaces you need configuring debian/patches/0000755000000000000000000000000012222143126010610 5ustar debian/patches/fix_ldflags0000644000000000000000000001045712222143126013024 0ustar --- a/gogoc-messaging/Makefile +++ b/gogoc-messaging/Makefile @@ -28,13 +28,13 @@ AR=ar ifdef DEBUG -CXXFLAGS=-g -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) -CFLAGS=-g -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) -LDFLAGS=-g -L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocmessaging -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) +CXXFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) +CFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) +LDFLAGS+=-g -L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocmessaging -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) else -CXXFLAGS=-O2 -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) -CFLAGS=-O2 -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) -LDFLAGS=-O2 -L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocmessaging -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) +CXXFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) +CFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) +LDFLAGS+=-L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocmessaging -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) endif --- a/gogoc-tsp/platform/freebsd/Makefile +++ b/gogoc-tsp/platform/freebsd/Makefile @@ -13,11 +13,11 @@ -include platform.mak ifdef DEBUG -CFLAGS=-g -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT -DDEBUG -LDFLAGS=-g $(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ +CFLAGS+=-g -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT -DDEBUG +LDFLAGS+=-g $(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ else -CFLAGS=-O2 -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT -LDFLAGS=$(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ +CFLAGS+=-O2 -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT +LDFLAGS+=$(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ endif CC=gcc --- a/gogoc-tsp/platform/linux/Makefile +++ b/gogoc-tsp/platform/linux/Makefile @@ -13,11 +13,11 @@ -include platform.mak ifdef DEBUG -CFLAGS=-g -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT -DDEBUG -LDFLAGS=-g $(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ +CFLAGS+=-g -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT -DDEBUG +LDFLAGS+=-g $(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ else -CFLAGS=-O2 -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT -LDFLAGS=$(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ +CFLAGS+=-O2 -Wall $(CC_INC_PATHS) $(PLATFORM_CFLAGS) -D_REENTRANT +LDFLAGS+=$(LD_LIB_PATHS) $(LD_LIBRARIES) -lcrypto -lpthread -lstdc++ endif CC=gcc --- a/gogoc-config/Makefile +++ b/gogoc-config/Makefile @@ -30,13 +30,13 @@ AR=ar ifdef DEBUG -CXXFLAGS=-g -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) -CFLAGS=-g -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) -LDFLAGS=-g -L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocconfig -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) +CXXFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) +CFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) +LDFLAGS+=-L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocconfig -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) else -CXXFLAGS=-O2 -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) -CFLAGS=-O2 -I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) -LDFLAGS=-O2 -L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocconfig -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) +CXXFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CXXFLAGS) +CFLAGS+=-I. -I$(GOGOCPALINC_DIR) -I$(GOGOCPALDEFS_DIR) -Wall -D_REENTRANT -DNDEBUG $(HACCESS_DEFINES) $(EXTRA_CFLAGS) +LDFLAGS+=-L$(LIB_DIR) -L$(GOGOCPALLIB_DIR) -lgogocconfig -l$(GOGOCPALLIB) $(EXTRA_LDFLAGS) endif debian/patches/series0000644000000000000000000000026312222142252012025 0ustar fix_ldflags 651251_multi_ints 694973_linux_sh_quoted fhs_directories.patch lp418176_client_v4.patch gogoc_conf_5.patch daemon_early.patch stddef_include note-if_prefix-blank.diff debian/patches/694973_linux_sh_quoted0000644000000000000000000000332612222136353014622 0ustar --- a/gogoc-tsp/template/linux.sh +++ b/gogoc-tsp/template/linux.sh @@ -12,30 +12,29 @@ LANGUAGE=C -if [ -z $TSP_VERBOSE ]; then +if [ -z "$TSP_VERBOSE" ]; then TSP_VERBOSE=0 fi KillProcess() { - if [ ! -z $TSP_VERBOSE ]; then - if [ $TSP_VERBOSE -ge 2 ]; then + if [ ! -z "$TSP_VERBOSE" ]; then + if [ "$TSP_VERBOSE" -ge 2 ]; then echo killing $* fi fi PID=`ps axww | grep $1 | grep -v grep | awk '{ print $1;}'` - echo $PID - if [ ! -z $PID ]; then - kill $PID + if [ ! -z "$PID" ]; then + kill "$PID" fi } Display() { - if [ -z $TSP_VERBOSE ]; then + if [ -z "$TSP_VERBOSE" ]; then return; fi - if [ $TSP_VERBOSE -lt $1 ]; then + if [ "$TSP_VERBOSE" -lt "$1" ]; then return; fi shift @@ -44,8 +43,8 @@ Exec() { - if [ ! -z $TSP_VERBOSE ]; then - if [ $TSP_VERBOSE -ge 2 ]; then + if [ ! -z "$TSP_VERBOSE" ]; then + if [ "$TSP_VERBOSE" -ge 2 ]; then echo $* fi fi @@ -59,8 +58,8 @@ ExecNoCheck() { - if [ ! -z $TSP_VERBOSE ]; then - if [ $TSP_VERBOSE -ge 2 ]; then + if [ ! -z "$TSP_VERBOSE" ]; then + if [ "$TSP_VERBOSE" -ge 2 ]; then echo $* fi fi @@ -107,18 +106,18 @@ rtadvdconfigfile=$TSP_HOME_DIR/$rtadvdconfigfilename resolv_conf=/etc/resolv.conf -if [ -z $TSP_HOME_DIR ]; then +if [ -z "$TSP_HOME_DIR" ]; then echo "TSP_HOME_DIR variable not specified!;" exit 1 fi -if [ ! -d $TSP_HOME_DIR ]; then +if [ ! -d "$TSP_HOME_DIR" ]; then echo "Error : directory $TSP_HOME_DIR does not exist" exit 1 fi # -if [ -z $TSP_HOST_TYPE ]; then +if [ -z "$TSP_HOST_TYPE" ]; then echo Error: TSP_HOST_TYPE not defined. exit 1 fi debian/patches/651251_multi_ints0000644000000000000000000000500012222134234013540 0ustar --- a/gogoc-tsp/template/linux.sh +++ b/gogoc-tsp/template/linux.sh @@ -67,6 +67,31 @@ $* # Execute command } +SubInterfaces() +{ + if [ -f /etc/gogoc/interfaces.conf ] ; then + cat /etc/gogoc/interfaces.conf | sed -e 's/#.*$//' -e 's/[[:space:]]*$//' -e 's/^[[:space:]]//' -e '/^$/d' | nl -n ln + fi +} + +SubNet() +{ + net="$1" + mask=64 + test -z "$3" || mask="$3" + sub="$2" + + subnet="`sipcalc -S "$mask" "$net" | grep '^Network' | sed -e 's/^Network[[:space:]]*-[[:space:]]//' -e 's/[[:space:]]*-[[:space:]]*$//'`" + if [ "$sub" -ne 0 ] ; then + pref="`echo "$subnet" | tail -n +2 | head -n "$sub" | tail -n 1`" + else + pref="`echo "$subnet" | head -n 1`" + fi + test -z "$pref" && return 1 + echo "$pref" | sed 's/:0000:0000:0000:0000$//' +} + + # Program localization Display 1 "--- Start of configuration script. ---" @@ -135,6 +160,12 @@ # Remove address from TSP HOME INTERFACE ExecNoCheck $ifconfig $TSP_HOME_INTERFACE inet6 del $TSP_PREFIX::1/64 + + subif="`SubInterfaces`" + echo "$subif" | while read sub int ; do + PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" + ExecNoCheck $ifconfig "$int" inet6 del ${PREF}::1/64 + done fi # Delete default IPv6 route(s). @@ -242,6 +273,18 @@ Display 1 "Adding prefix to $TSP_HOME_INTERFACE" Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64 + subif="`SubInterfaces`" + echo "$subif" | while read sub int ; do + PREF=`echo $TSP_PREFIX | sed 's/00$//'` + OLDADDR=`$ifconfig "$int" | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"` + if [ ! -z $OLDADDR ]; then + Display 1 "Removing old IPv6 address $OLDADDR from $int" + Exec $ifconfig "$int" inet6 del $OLDADDR + fi + PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" + Display 1 "Adding prefix ${PREF} to $int" + Exec $ifconfig "$int" inet6 add "${PREF}::1/64" + done # Stop radvd daemon if it was running. Twice. /etc/init.d/radvd stop @@ -264,6 +307,22 @@ }; EOF + echo "$subif" | while read sub int ; do + PREF="`SubNet "${TSP_PREFIX}::0/${TSP_PREFIXLEN}" "$sub"`" + cat >> "$rtadvdconfigfile" < Description: Fix some directories so they are FHS compliant --- a/gogoc-tsp/conf/gogoc.conf.in +++ b/gogoc-tsp/conf/gogoc.conf.in @@ -225,7 +225,7 @@ # # broker_list= # -broker_list=tsp-broker-list.txt +broker_list=/var/lib/gogoc/tsp-broker-list.txt # # Last Server Used File Name: @@ -235,7 +235,7 @@ # # last_server= # -last_server=tsp-last-server.txt +last_server=/var/lib/gogoc/tsp-last-server.txt # # Always Use Last Known Working Server: @@ -284,7 +284,7 @@ # log_syslog=0 # #log_console= -#log_stderr= +log_stderr=0 #log_file= #log_syslog= @@ -295,7 +295,7 @@ # # log_filename= # -log_filename=gogoc.log +log_filename=/var/log/gogoc/gogoc.log # # Log File Rotation: --- a/gogoc-tsp/platform/freebsd/tsp_local.c +++ b/gogoc-tsp/platform/freebsd/tsp_local.c @@ -34,11 +34,11 @@ #define IFNAMSIZ 16 // from net/if.h -char *FileName = "gogoc.conf"; +char *FileName = "/etc/gogoc/gogoc.conf"; char *ScriptInterpretor = "/bin/sh"; char *ScriptExtension = "sh"; char *ScriptDir = NULL; -char *TspHomeDir = "/usr/local/etc/gogoc"; +char *TspHomeDir = "/usr/share/gogoc"; char DirSeparator = '/'; int indSigHUP = 0; // Set to 1 when HUP signal is trapped. --- a/gogoc-tsp/platform/linux/tsp_local.c +++ b/gogoc-tsp/platform/linux/tsp_local.c @@ -33,11 +33,11 @@ /* these globals are defined by US used by alot of things in */ -char *FileName = "gogoc.conf"; +char *FileName = "/etc/gogoc/gogoc.conf"; char *ScriptInterpretor = "/bin/sh"; char *ScriptExtension = "sh"; char *ScriptDir = NULL; -char *TspHomeDir = "/usr/local/etc/gogoc"; +char *TspHomeDir = "/usr/share/gogoc"; char DirSeparator = '/'; int indSigHUP = 0; // Set to 1 when HUP signal is trapped. --- a/gogoc-tsp/template/linux.sh +++ b/gogoc-tsp/template/linux.sh @@ -9,6 +9,9 @@ # Note: IPV6 support and tun Support must be enabled before calling this script. # +# Changed here for Debian systems - used for radvd config file only +TSP_HOME_DIR=/var/run/gogoc + LANGUAGE=C --- a/gogoc-tsp/src/tsp/tsp_auth_passdss.c +++ b/gogoc-tsp/src/tsp/tsp_auth_passdss.c @@ -31,7 +31,7 @@ #define TSP_AUTH_PASSDSS_STRING "PASSDSS-3DES-1" #define TSP_AUTH_PASSDSS_BUFFERSIZE 4096 -#define TSPC_DSA_KEYFILE "gogockeys.pub" +#define TSPC_DSA_KEYFILE "/var/lib/gogoc/gogockeys.pub" #if defined(WIN32) && !defined(WINCE) extern BOOL IsService; // Declared in winpc/tsp_local.c debian/patches/gogoc_conf_5.patch0000644000000000000000000000056511354363444014202 0ustar --- a/gogoc-tsp/man/man5/gogoc.conf.5 +++ b/gogoc-tsp/man/man5/gogoc.conf.5 @@ -327,7 +327,7 @@ .It Sy log_rotation_size The `log_rotation_size' directive specifies the maximum size a log file may reach before rotation occurs (if rotation has been enabled via the -'log_rotation' directive). +`log_rotation' directive). .Pp The value is expressed in kilobytes. .Pp debian/patches/lp418176_client_v4.patch0000644000000000000000000000071411354352062014716 0ustar Author: Philippe Gauthier Description: Fix crash on 64-bit architectures occuring when the client_v4 option is not set to "auto". --- a/gogoc-config/src/gogocvalidation.cc +++ b/gogoc-config/src/gogocvalidation.cc @@ -512,7 +512,7 @@ if( sClientV4 != STR_AUTO ) { struct in_addr address; - unsigned long net; + in_addr_t net; net = inet_addr( sClientV4.c_str() ); memcpy(&address, &net, sizeof(net)); debian/patches/stddef_include0000644000000000000000000000064511557772042013533 0ustar Description: Include stddef.h to define offset Around gcc 4.6 the compile failed because offset was not defined Bug-Debian: http://bugs.debian.org/625067 Author: Craig Small Last-Update: 2011-05-03 --- a/gogoc-messaging/gogocmessaging/message.h +++ b/gogoc-messaging/gogocmessaging/message.h @@ -22,6 +22,7 @@ #include +#include // Undefine Windows Win32 API PostMessage debian/patches/daemon_early.patch0000644000000000000000000000713511364526125014310 0ustar Author: Craig Small Description: Make gogoc a daemon earlier The original code will only fork if it succeeds in contacting the broker first, causing significant problems with non network-connected devices. This patch moves the daemon code earlier into the start chain Bug-Debian: http://bugs.debian.org/577618 --- a/gogoc-tsp/platform/linux/tsp_local.c +++ b/gogoc-tsp/platform/linux/tsp_local.c @@ -167,20 +167,6 @@ return status; } - // Check if we're already daemon. Calling multiple times the daemon() messes up pthreads. - if( !c->nodaemon && getppid() != 1 ) - { - // Detach from controlling terminal and run in the background. - Display( LOG_LEVEL_3, ELInfo, "tspStartLocal", GOGO_STR_GOING_DAEMON ); - if( daemon(1,0) == -1 ) - { - // Error: Failed to detach. - Display( LOG_LEVEL_1, ELError, "tspStartLocal", GOGO_STR_CANT_FORK ); - return make_status(CTX_TUNINTERFACESETUP, ERR_INTERFACE_SETUP_FAILED); - } - } - - // Check tunnel mode. if( strcasecmp(t->type, STR_CONFIG_TUNNELMODE_V4V6) == 0 ) { @@ -307,3 +293,21 @@ return status; } + +int tspGoDaemon(tConf *c) +{ + + // Check if we're already daemon. Calling multiple times the daemon() messes up pthreads. + if( !c->nodaemon && getppid() != 1 ) + { + // Detach from controlling terminal and run in the background. + Display( LOG_LEVEL_3, ELInfo, "tspGoDaemon", GOGO_STR_GOING_DAEMON ); + if( daemon(1,0) == -1 ) + { + // Error: Failed to detach. + Display( LOG_LEVEL_1, ELError, "tspGoDaemon", GOGO_STR_CANT_FORK ); + return -1; + } + } + return 0; +} --- a/gogoc-tsp/src/tsp/tsp_client.c +++ b/gogoc-tsp/src/tsp/tsp_client.c @@ -962,6 +962,12 @@ // Log the OS information through the log system. tspLogOSInfo(); + // Go to a daemon early + if (tspGoDaemon(&c) != 0) + { + /* FIXME - Needs to set some error status */ + goto endtspc; + } // Keep track of the broker list. gszBrokerListFile = c.broker_list_file; // For BROKER_LIST gogocmessaging message. --- a/gogoc-tsp/platform/freebsd/tsp_local.c +++ b/gogoc-tsp/platform/freebsd/tsp_local.c @@ -154,19 +154,6 @@ return make_status(CTX_TUNINTERFACESETUP, ERR_INTERFACE_SETUP_FAILED); } - // Check if we're already daemon. Calling multiple times the daemon() messes up pthreads. - if( !c->nodaemon && getppid() != 1 ) - { - // Detach from controlling terminal and run in the background. - Display(LOG_LEVEL_3, ELInfo, "tspStartLocal", GOGO_STR_GOING_DAEMON); - if( daemon(1, 0) == -1 ) - { - // Error: Failed to detach. - Display(LOG_LEVEL_1, ELError, "tspStartLocal", GOGO_STR_CANT_FORK); - return make_status(CTX_TUNINTERFACESETUP, ERR_INTERFACE_SETUP_FAILED); - } - } - // Check tunnel mode. if (strcasecmp(t->type, STR_CONFIG_TUNNELMODE_V6UDPV4) == 0 ) { @@ -309,3 +296,21 @@ return status; } + +int tspGoDaemon(tConf *c) +{ + + // Check if we're already daemon. Calling multiple times the daemon() messes up pthreads. + if( !c->nodaemon && getppid() != 1 ) + { + // Detach from controlling terminal and run in the background. + Display( LOG_LEVEL_3, ELInfo, "tspGoDaemon", GOGO_STR_GOING_DAEMON ); + if( daemon(1,0) == -1 ) + { + // Error: Failed to detach. + Display( LOG_LEVEL_1, ELError, "tspGoDaemon", GOGO_STR_CANT_FORK ); + return -1; + } + } + return 0; +} --- a/gogoc-tsp/include/tsp_client.h +++ b/gogoc-tsp/include/tsp_client.h @@ -60,5 +60,7 @@ extern char* tspGetRemoteAddress ( pal_socket_t, char *, sint32_t ); #endif +extern int tspGoDaemon ( tConf *pConf); + #endif debian/patches/note-if_prefix-blank.diff0000644000000000000000000000125411617202514015453 0ustar Description: Note that if_prefix can be blank Bug-Debian: http://bugs.debian.org/636556 Author: Karl Goetz diff -ruNa gogoc-1.2/gogoc-tsp/conf/gogoc.conf.in gogoc-1.2.cfg/gogoc-tsp/conf/gogoc.conf.in --- gogoc-1.2/gogoc-tsp/conf/gogoc.conf.in 2011-08-04 10:47:35.000000000 +1000 +++ gogoc-1.2.cfg/gogoc-tsp/conf/gogoc.conf.in 2011-08-04 11:05:43.474701851 +1000 @@ -98,6 +98,7 @@ # Name of the interface that will be configured to send router advertisements. # This is an interface index on Windows (ex: 4) and a name on Linux # and BSD (ex: eth1 or fxp1). +# This can be blank unless host_type is set to router. # # if_prefix= # debian/patches/636556_gogoc_conf0000644000000000000000000000100212222133060013461 0ustar Author: Craig Small Description: Note in gogoc.conf that if_prefix can be blank Bug-Debian: http://bugs.debian.org/636556 --- a/gogoc-tsp/conf/gogoc.conf.in +++ b/gogoc-tsp/conf/gogoc.conf.in @@ -98,6 +98,7 @@ # Name of the interface that will be configured to send router advertisements. # This is an interface index on Windows (ex: 4) and a name on Linux # and BSD (ex: eth1 or fxp1). +# This can be blank unless host_type is set to router. # # if_prefix= # debian/rules0000755000000000000000000000232311354356052010252 0ustar #!/usr/bin/make -f # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS) ifeq ($(DEB_HOST_ARCH_OS),kfreebsd) PLATFORM=freebsd endif ifeq ($(DEB_HOST_ARCH_OS),linux) PLATFORM=linux endif %: dh $@ override_dh_auto_build: $(MAKE) all installdir=/usr/share/gogoc platform=$(PLATFORM) $(MAKE) -C gogoc-tsp/conf gogoc.conf.sample PLATFORM=$(PLATFORM) PLATFORM_DIR=../platform installdir=/usr/share/gogoc BIN_DIR=. override_dh_auto_clean: $(MAKE) clean platform=$(PLATFORM) -rm gogoc-tsp/conf/gogoc.conf.sample override_dh_auto_install: install -D gogoc-tsp/conf/gogoc.conf.sample debian/gogoc/etc/gogoc/gogoc.conf override_dh_install: dh_install install -m 755 gogoc-tsp/template/$(PLATFORM).sh debian/gogoc/usr/share/gogoc/template override_dh_fixperms: dh_fixperms chmod 600 debian/gogoc/etc/gogoc/gogoc.conf debian/compat0000644000000000000000000000000212222126006010355 0ustar 9 debian/gogoc.examples0000644000000000000000000000007012222133645012021 0ustar gogoc-tsp/conf/gogoc.conf.sample debian/interfaces.conf debian/interfaces.conf0000644000000000000000000000025312222133543012155 0ustar # # Use this file to list interfaces which should get an IPv6 network # assigned beside the if_prefix setting in gogoc.conf # # Guest networks #eth1 # well known guests debian/gogoc.install0000644000000000000000000000003511354353333011655 0ustar gogoc-tsp/bin/gogoc usr/sbin debian/gogoc.default0000644000000000000000000000104311347322444011634 0ustar # # Default file for gogoc # # Time to wait for the server to die, in seconds. If this value is set too # low you might not let some servers time to die gracefully and init.d # restart will not work. # # DIETIME=5 # Check that the keyfile /var/lib/gogoc/gogockeys.pub has the key for your # tunnel broker and abort if not. # "yes" - Default, check for presence of key # "no" - Do not check for key, required if the name of the server is different # from its hostname. (for load balancing reasons for example) # # CHECK_KEYFILE="yes" debian/dirs0000644000000000000000000000006511354356416010063 0ustar usr/share/gogoc/template var/log/gogoc var/lib/gogoc debian/gogoc.lintian-overrides0000644000000000000000000000015511347322674013656 0ustar gogoc: possible-gpl-code-linked-with-openssl gogoc: non-standard-file-perm etc/gogoc/gogoc.conf 0600 != 0644 debian/ppp.ip-up0000644000000000000000000000022411354353314010741 0ustar #!/bin/sh # # ip-up script for gogoc # Check to see we can run the daemon if [ ! -x /usr/sbin/gogoc ]; then exit 0 fi invoke-rc.d gogoc restart debian/if-up0000644000000000000000000000057712222124756010145 0ustar #!/bin/sh # Reload the gogoc daemon when an interface comes up. # We don't restart for loopback if [ "$IFACE" = lo ] ; then exit 0 fi # Make sure the binary is available if [ ! -x /usr/sbin/gogoc ]; then exit 0 fi # Restart only if the daemon was running already /usr/bin/pgrep -f ^/usr/sbin/gogoc >/dev/null if [ $? != 0 ]; then exit 0 fi invoke-rc.d gogoc restart exit 0 debian/changelog0000644000000000000000000001166212222143416011043 0ustar gogoc (1:1.2-5) unstable; urgency=low * Removed set e from ifup script Closes: #641372 * Update to standards 3.9.2 * Change dependency iproute to iproute2 * Small instruction for gogoc.conf Closes: #636556 * README.Debian has references for gw6c changed to gogoc Closes: #653833 * Optional feature to handle multiple interfaces Closes: 651251 * Removing transistional package gw6c * Quote parameters in linux.sh Closes: #694973 * Adjusted makefile to accept harden flags -- Craig Small Mon, 30 Sep 2013 08:29:35 +1000 gogoc (1:1.2-4) unstable; urgency=low * Changed arch dependent iproute dependency to linux-any Closes: #634806 * Update standards to 3.9.2 no changes * Update debhelper to compat version 8 * Fixed copyright to DEP-5 format -- Craig Small Wed, 27 Jul 2011 21:55:31 +1000 gogoc (1:1.2-3) unstable; urgency=low * Include stddef.h to fix gcc 4.6 compile problem Closes: #625067 * Added -n for command line to get key Closes: #605969 -- Craig Small Tue, 03 May 2011 22:28:03 +1000 gogoc (1:1.2-2) unstable; urgency=low * gogoc becomes a daemon earlier Closes: #577618 -- Craig Small Sat, 24 Apr 2010 18:28:07 +1000 gogoc (1:1.2-1) unstable; urgency=low * iproute Dependency is excluded for freebsd * Added note for stopping check keyfile to README Closes: #564963 * Added Alioth VCS lines * Name changed from gw6c to gogoc * Removed patches accepted by upstream -- Craig Small Tue, 30 Mar 2010 21:39:06 +1100 gw6c (6.0.1dfsg.1-8) unstable; urgency=low * Removed a quote out of rules -- Craig Small Mon, 28 Dec 2009 23:48:03 +1100 gw6c (6.0.1dfsg.1-7) unstable; urgency=low * Conditionally depend on iproute * Put correct template in for freebsd -- Craig Small Mon, 28 Dec 2009 23:40:30 +1100 gw6c (6.0.1dfsg.1-6) unstable; urgency=low [ ???????? ???????????????? (Ahmed El-Mahmoudy) ] * debian/rules: + Simplify rules file. + Fix make invocation to properly generate gw6c.sample.conf + Install gw6c.sample.conf also in /etc/gw6c/gw6c.conf (LP: #438658) * debian/patches: remove old dpatch files. * debian/control: + Build-Depend on debhelper >= 7.0.50~ to support debhelper overrides. + Remove quilt from Build-Depends. + Added ${misc:Depends} to Depends. * debian/dirs: Remove dirs that will be created by dh_install anyways. [ Craig Small ] * Added a keyfile check bypass to init * Documented default file -- Craig Small Fri, 11 Dec 2009 16:58:31 +1100 gw6c (6.0.1dfsg.1-5) unstable; urgency=low * Adjust README and init script to die if no server key or config file * Closes: #554911 * Added Ubuntu patch LP:418176 * Removed -c option and fixed default config file path in gw6c.8 * clarified GPL version of debian files * Changed to quilt patching and source format -- Craig Small Mon, 07 Dec 2009 21:42:35 +1100 gw6c (6.0.1dfsg.1-4) unstable; urgency=low [ أحمد المحمودي (Ahmed El-Mahmoudy) ] * debian/patches/10_directories.dpatch: patched tspc-advanced/src/tsp/tsp_auth_passdss.c to set path for TSPC_DSA_KEYFILE to to /var/lib/gw6c. * debian/init.d: increase DIETIME to 5s. [ Craig Small ] * Adjusted init file to create radvd run dir, if needed * Added some more sanity checking in if-up and ppp scripts * Updated to standards version 3.8.3 -- Craig Small Sun, 06 Sep 2009 16:38:16 +1000 gw6c (6.0.1dfsg.1-3) unstable; urgency=low [ أحمد المحمودي (Ahmed El-Mahmoudy) ] * Added if-up, ppp.ip-up and ppp.ip-down scripts. * debian/patches/10_directories.dpatch: patched ./tspc-advanced/conf/gw6c.conf.in to set default path for broker list and last server files to /var/lib/gw6c. * debian/dirs: added var/lib/gw6c [ Craig Small ] * Changed standards version to 3.8.2 * Changes to make it build on kfreebsd -- Craig Small Thu, 06 Aug 2009 21:34:02 +1000 gw6c (6.0.1dfsg.1-2) unstable; urgency=low [ أحمد المحمودي (Ahmed El-Mahmoudy) ] * debian/control: added libssl-dev to Build-Depends. * debian/copyright: use © symbol instead of (C). * debian/init.d: Fix the logic operation in the line that insures existance of /var/run/gw6c. * debian/patches/10_directories.dpatch: edited patch to set TspHomeDir to /usr/share/gw6c. -- Craig Small Mon, 15 Jun 2009 13:57:30 +1000 gw6c (6.0.1dfsg.1-1) unstable; urgency=low * New upstream release Closes: #497476 License clarified and pdf files removed -- Craig Small Sun, 14 Jun 2009 10:01:12 +0300 gw6c (5.1-1) unstable; urgency=low * Initial release Closes: #497476 -- Craig Small Sun, 20 Jul 2008 16:10:21 +1000 debian/ppp.ip-down0000644000000000000000000000022611354353276011275 0ustar #!/bin/sh # # ip-down script for gogoc # Check to see we can run the daemon if [ ! -x /usr/sbin/gogoc ]; then exit 0 fi invoke-rc.d gogoc restart debian/README.source0000644000000000000000000000061011347316216011346 0ustar README.source for Debian package gw6c ===================================== The only difference between the Debian source file and the one you can download from the gw6c site is two pdf files are removed. Basically, if you have the original gw6c source archive and are in its top directory the command rm *.pdf makes it the same as the Debian source archive. debian/gogoc.manpages0000644000000000000000000000007311347322747012013 0ustar gogoc-tsp/man/man5/gogoc.conf.5 gogoc-tsp/man/man8/gogoc.8 debian/init.d0000644000000000000000000001004211354361670010301 0ustar #!/bin/sh ### BEGIN INIT INFO # Provides: gogoc # Required-Start: $network $remote_fs # Required-Stop: $network $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Gateway6 client ### END INIT INFO # Author: Craig Small PATH=/sbin:/bin:/usr/sbin:/usr/bin DESC="IPv6 TSP Client" NAME=gogoc DAEMON=/usr/sbin/gogoc DAEMON_OPTS= GOGOC_CONFIG=/etc/gogoc/gogoc.conf GOGOC_KEYS=/var/lib/gogoc/gogockeys.pub PIDDIR=/var/run/gogoc RADVDDIR=/var/run/radvd SCRIPTNAME=/etc/init.d/$NAME CHECK_KEYFILE="yes" DIETIME=5 [ -x "$DAEMON" ] || exit 0 # Read configuration variable file if it is present [ -r /etc/default/$NAME ] && . /etc/default/$NAME # Load the VERBOSE setting and other rcS variables . /lib/init/vars.sh # Define LSB log_* functions. # Depend on lsb-base (>= 3.0-6) to ensure that this file is present. . /lib/lsb/init-functions # # Function that starts the daemon/service # do_start() { # Return # 0 if daemon has been started # 1 if daemon was already running # 2 if daemon could not be started if [ "$CHECK_KEYFILE" = "yes" ] ; then check_server_key || return $? fi [ -d $PIDDIR ] || mkdir -p $PIDDIR # RADVD if installed may not have its rundir if [ ! -e $RADVDDIR ] && [ -e /usr/sbin/radvd ] ; then install -d -o radvd -g root -m 4755 $RADVDDIR fi start-stop-daemon --start --quiet --exec $DAEMON --test > /dev/null \ || return 1 start-stop-daemon --start --quiet --exec $DAEMON -- $DAEMON_OPTS \ || return 2 } # # Function that stops the daemon/service # do_stop() { # Return # 0 if daemon has been stopped # 1 if daemon was already stopped # 2 if daemon could not be stopped # other if a failure occurred start-stop-daemon --stop --signal HUP --exec $DAEMON RETVAL="$?" [ "$RETVAL" = 2 ] && return 2 return "$RETVAL" } check_server_key() { # Check for config file, if there isn't one then exit test -f $GOGOC_CONFIG || return 1 # Extract the server from config file, mandatory config line GOGOC_SERVER=$(sed '/^server/!d; s/.*[=#]\(.*\)/\1/; q' $GOGOC_CONFIG) if [ -z $GOGOC_SERVER ]; then log_warning_msg "Not starting gogoc - no server line in $GOGOC_CONFIG" return 1 fi # Extract authentication type from config file GOGOC_AUTHTYPE=$(sed '/^auth_method/!d; s/.*[=#]\(.*\)/\1/; q' $GOGOC_CONFIG) # We only care if the method is any or passdss-3des-1 if [ -z $GOGOC_AUTHTYPE ]; then return 0 fi if [ "$GOGOC_AUTHTYPE" != "any" ] && [ "$GOGOC_AUTHTYPE" != "passdss-3des-1-md5" ]; then return 0 fi # Check for cached server key if [ ! -r $GOGOC_KEYS ] || ! grep -q "^$GOGOC_SERVER[[:space:]]" $GOGOC_KEYS ; then log_warning_msg "Not starting gogoc - no server key" return 1 fi return 0 } case "$1" in start) [ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC" "$NAME" do_start case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; stop) [ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME" do_stop case "$?" in 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;; 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;; esac ;; status) status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $? ;; #reload|force-reload) # # If do_reload() is not implemented then leave this commented out # and leave 'force-reload' as an alias for 'restart'. # #log_daemon_msg "Reloading $DESC" "$NAME" #do_reload #log_end_msg $? #;; restart|force-reload) # # If the "reload" option is implemented then remove the # 'force-reload' alias # log_daemon_msg "Restarting $DESC" "$NAME" do_stop case "$?" in 0|1) [ -n "$DIETIME" ] && sleep $DIETIME do_start case "$?" in 0) log_end_msg 0 ;; 1) log_end_msg 1 ;; # Old process is still running *) log_end_msg 1 ;; # Failed to start esac ;; *) # Failed to stop log_end_msg 1 ;; esac ;; *) #echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2 exit 3 ;; esac : debian/copyright0000644000000000000000000000520511613776232011133 0ustar Format: http://dep.debian.net/deps/dep5 Upstream-Name: gogoc Source: http://git.debian.org/?p=collab-maint/gw6c.git;a=summary Copyright: 2006 Charles Nepveu 2006 Hexago 2001-2010 gogo6 Inc. License: BSD-3-Clause All rights reserved. . Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: . * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the gogo6 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. . THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Files: debian/* Copyright: 2008-2011 Craig Small License: GPL-2+ 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 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. debian/source/0000755000000000000000000000000012222137056010466 5ustar debian/source/format0000644000000000000000000000001411347316216011700 0ustar 3.0 (quilt)