From a972c165e8045a0ae0cf2f9af16a1011441031af Mon Sep 17 00:00:00 2001 From: Edwin Groothuis Date: Fri, 7 Sep 2007 23:29:56 +0000 Subject: New port: net/gateway6 free IPv6 tunnel From README: TSP is a control protocol used to establish and maintain static tunnels. The Gateway6 Client 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. The Gateway6 Client code is mostly identical for all client platforms. However, creating the static tunnel is operating system dependent and is done by a script called by the Gateway6 Client. These scripts are located under the template directory in the Gateway6 Client installation directory. The script executed by the Gateway6 Client to configure the tunnel interface is customized for each type of supported operating system and takes care of all specifics for the target operating system. On Unix systems, it is a shell script. This separation of the binary and script enables fast and easy additions of new operating systems, as has been shown by the community contributions for many operating systems. WWW: http://www.go6.net/ PR: ports/114544 Submitted by: Michael Scholz --- net/Makefile | 1 + net/gateway6/Makefile | 73 ++++++++++++++++++++++ net/gateway6/distinfo | 3 + net/gateway6/files/gateway6.sh.in | 35 +++++++++++ net/gateway6/files/patch-Mk.mk-freebsd.mk | 11 ++++ .../files/patch-platform.freebsd.tsp_local.c | 36 +++++++++++ net/gateway6/files/patch-src.lib.config.c | 11 ++++ net/gateway6/files/patch5-template.freebsd.sh | 11 ++++ net/gateway6/files/pkg-message.in | 12 ++++ net/gateway6/pkg-descr | 23 +++++++ net/gateway6/pkg-plist | 14 +++++ 11 files changed, 230 insertions(+) create mode 100644 net/gateway6/Makefile create mode 100644 net/gateway6/distinfo create mode 100644 net/gateway6/files/gateway6.sh.in create mode 100644 net/gateway6/files/patch-Mk.mk-freebsd.mk create mode 100644 net/gateway6/files/patch-platform.freebsd.tsp_local.c create mode 100644 net/gateway6/files/patch-src.lib.config.c create mode 100644 net/gateway6/files/patch5-template.freebsd.sh create mode 100644 net/gateway6/files/pkg-message.in create mode 100644 net/gateway6/pkg-descr create mode 100644 net/gateway6/pkg-plist (limited to 'net') diff --git a/net/Makefile b/net/Makefile index c0ca8757fd56..6d68d7b6a924 100644 --- a/net/Makefile +++ b/net/Makefile @@ -144,6 +144,7 @@ SUBDIR += gacxtool SUBDIR += gastman SUBDIR += gatekeeper + SUBDIR += gateway6 SUBDIR += generic-nqs SUBDIR += geotrace SUBDIR += ggsd diff --git a/net/gateway6/Makefile b/net/gateway6/Makefile new file mode 100644 index 000000000000..af802850e541 --- /dev/null +++ b/net/gateway6/Makefile @@ -0,0 +1,73 @@ +# New ports collection makefile for: gateway6 +# Date created: 11 Jul 2007 +# Whom: Michael Scholz (mike@fth-devel.net) +# +# $FreeBSD$ +# + +PORTNAME= gateway6 +PORTVERSION= 5.0 +CATEGORIES= net ipv6 +MASTER_SITES= ftp://ftp.fth-devel.net/pub/freenet6/ +MASTER_SITES+= http://www.go6.net/4105/file.asp?file_id=142/ +DISTNAME= gw6c-5_0-RELEASE-src + +MAINTAINER= mike@fth-devel.net +COMMENT= Gateway6 Tunnel Setup Protocol Client - Free IPv6 tunnel + +USE_RC_SUBR= gateway6.sh +WRKSRC= ${WRKDIR}/tspc-advanced + +MAN8= gw6c.8 +MAN5= gw6c.conf.5 + +PKGMESSAGE= ${WRKDIR}/pkg-message +SUB_FILES= gateway6.sh pkg-message + +.include + +.if ${OSVERSION} < 400000 +IGNORE= this program might not be working on FreeBSD version below 4.0 +.endif +.if ${OSVERSION} > 500000 +EXTRA_PATCHES= ${FILESDIR}/patch5-template.freebsd.sh +.endif + +MAKE_ARGS= target=freebsd installdir=${PREFIX} +GW6C_DATA= CLIENT-LICENSE.TXT GUI-LICENSE.TXT INSTALL README + +do-install: + @${MKDIR} ${EXAMPLESDIR} + @${MKDIR} ${DATADIR} + @${INSTALL_PROGRAM} ${WRKSRC}/bin/gw6c ${PREFIX}/bin/gw6c + @${INSTALL_MAN} ${WRKSRC}/man/man8/gw6c.8 ${PREFIX}/man/man8 + @${INSTALL_MAN} ${WRKSRC}/man/man5/gw6c.conf.5 ${PREFIX}/man/man5 + @${INSTALL_SCRIPT} ${WRKSRC}/template/checktunnel.sh ${DATADIR} + @${INSTALL_SCRIPT} ${WRKSRC}/template/freebsd.sh ${DATADIR} + @${INSTALL_DATA} ${WRKSRC}/bin/gw6c.conf.sample ${PREFIX}/etc + @${INSTALL_DATA} ${WRKDIR}/HEX_DC_0005_Gateway6_Client_Guide.pdf ${DATADIR} + @${INSTALL_DATA} ${WRKDIR}/HEX_DC_0007_Gateway6_Client_Release_Notes.pdf ${DATADIR} + +.for f in ${GW6C_DATA} + @${INSTALL_DATA} ${WRKSRC}/$f ${DATADIR} +.endfor + +post-install: + @if [ ! -f ${PREFIX}/etc/orbit.conf ]; then \ + ${CP} -p ${PREFIX}/etc/gw6c.conf.sample ${PREFIX}/etc/gw6c.conf ; \ + fi + @${CAT} ${PKGMESSAGE} + +post-patch: + @${REINPLACE_CMD} \ + -e "s|/installdir/bin|${PREFIX}/etc|g" \ + ${WRKSRC}/man/man8/gw6c.8 + + @${REINPLACE_CMD} \ + -e "s|/usr/local/gw6c|${PREFIX}|g" \ + -e "s|/install/dir/bin/gw6c.conf.sample|${EXAMPLESDIR}/gw6c.conf.sample|g" \ + -e "s|/install/dir/bin/gw6c.conf|${PREFIX}/etc/gw6c.conf|g" \ + -e "s|template=linux|template=freebsd|g" \ + ${WRKSRC}/man/man5/gw6c.conf.5 + +.include diff --git a/net/gateway6/distinfo b/net/gateway6/distinfo new file mode 100644 index 000000000000..ea9ffe3cac03 --- /dev/null +++ b/net/gateway6/distinfo @@ -0,0 +1,3 @@ +MD5 (gw6c-5_0-RELEASE-src.tar.gz) = 5dda7941133a199adf3453d105cecf5d +SHA256 (gw6c-5_0-RELEASE-src.tar.gz) = 431e59a6590f0826f1cb34a6319bd69d024ca89e36f8578a2befe039a489e894 +SIZE (gw6c-5_0-RELEASE-src.tar.gz) = 2441593 diff --git a/net/gateway6/files/gateway6.sh.in b/net/gateway6/files/gateway6.sh.in new file mode 100644 index 000000000000..0cde258a3c24 --- /dev/null +++ b/net/gateway6/files/gateway6.sh.in @@ -0,0 +1,35 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# +# PROVIDE: gateway6 +# REQUIRE: FILESYSTEMS netif +# BEFORE: ip6addrctl +# KEYWORD: shutdown +# + +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable the IPv6 tunnel to Freenet6.net: +# +# gateway6_enable (bool): Set to NO by default. +# Set it to YES to enable gateway6. +# gateway6_flags (flags): Set to "" by default. +# + +. %%RC_SUBR%% + +name="gateway6" +rcvar=`set_rcvar` + +command=%%PREFIX%%/bin/gw6c +required_files=%%PREFIX%%/etc/gw6c.conf + +load_rc_config $name + +: ${gateway6_enable="NO"} +: ${gateway6_flags=""} + +run_rc_command "$1" diff --git a/net/gateway6/files/patch-Mk.mk-freebsd.mk b/net/gateway6/files/patch-Mk.mk-freebsd.mk new file mode 100644 index 000000000000..76fa425bcacc --- /dev/null +++ b/net/gateway6/files/patch-Mk.mk-freebsd.mk @@ -0,0 +1,11 @@ +--- Mk/mk-freebsd.mk.orig 2006-09-23 01:06:20.000000000 +0200 ++++ Mk/mk-freebsd.mk 2007-07-12 17:58:04.000000000 +0200 +@@ -16,7 +16,7 @@ + install_bin=$(installdir)/bin + install_etc=$(installdir)/etc + install_lib=$(installdir)/lib +-install_template=$(installdir)/template ++install_template=$(installdir)/share/gateway6 + install_man=$(installdir)/man + subdirs=src/net src/lib src/tsp src/xml platform/unix-common platform/freebsd template conf man + ifname=gif0 diff --git a/net/gateway6/files/patch-platform.freebsd.tsp_local.c b/net/gateway6/files/patch-platform.freebsd.tsp_local.c new file mode 100644 index 000000000000..5cb0b74b24c5 --- /dev/null +++ b/net/gateway6/files/patch-platform.freebsd.tsp_local.c @@ -0,0 +1,36 @@ +--- platform/freebsd/tsp_local.c.orig 2007-04-25 21:31:31.000000000 +0200 ++++ platform/freebsd/tsp_local.c 2007-07-12 18:38:01.000000000 +0200 +@@ -53,11 +53,11 @@ + #include "tsp_tun.h" /* freebsd's tun */ + + +-char *FileName = "gw6c.conf"; ++char *FileName = "/usr/local/etc/gw6c.conf"; + char *ScriptInterpretor = "/bin/sh"; + char *ScriptExtension = "sh"; + char *ScriptDir = NULL; +-char *TspHomeDir = "/usr/local/etc/gw6"; ++char *TspHomeDir = "/usr/local"; + char DirSeparator = '/'; + + int RootUid = 0; +@@ -77,17 +77,12 @@ + void + tspSetEnv(char *Variable, char *Value, int Flag) + { +- char *buf; + if(Value) { +- int size=(strlen(Variable) + strlen(Value) + 2); +- if((buf=malloc(size)) == NULL) { ++ if(setenv(Variable, Value, Flag) == -1) { + Display(LOG_LEVEL_3, ELError, "SetEnv", HEX_STR_NOT_ENOUGH_MEM); + return; + } +- snprintf(buf, size, "%s=%s", Variable, Value); +- putenv(buf); +- Display(LOG_LEVEL_3, ELNotice, "tspSetEnv", "%s", buf); +- free(buf); ++ Display(LOG_LEVEL_3, ELNotice, "tspSetEnv", "%s=%s", Variable, Value); + } + } + diff --git a/net/gateway6/files/patch-src.lib.config.c b/net/gateway6/files/patch-src.lib.config.c new file mode 100644 index 000000000000..77ddfcc4774c --- /dev/null +++ b/net/gateway6/files/patch-src.lib.config.c @@ -0,0 +1,11 @@ +--- src/lib/config.c.orig 2007-05-07 20:55:25.000000000 +0200 ++++ src/lib/config.c 2007-07-12 00:10:55.000000000 +0200 +@@ -274,7 +274,7 @@ + int status = NO_ERROR; + struct in_addr addr; + struct in6_addr addr6; +- const char* cszTemplDir = "template"; ++ const char* cszTemplDir = "share/gateway6"; + + // Hard-coded parameters. Not configurable anymore. + pConf->syslog = FALSE; diff --git a/net/gateway6/files/patch5-template.freebsd.sh b/net/gateway6/files/patch5-template.freebsd.sh new file mode 100644 index 000000000000..4fba4427a807 --- /dev/null +++ b/net/gateway6/files/patch5-template.freebsd.sh @@ -0,0 +1,11 @@ +--- template/freebsd.sh.orig 2005-10-25 20:38:02.000000000 +0200 ++++ template/freebsd.sh 2007-07-11 23:33:20.000000000 +0200 +@@ -76,7 +76,7 @@ + Display 1 '--- Start of configuration script. ---' + Display 1 "Script: " `basename $0` + +-gifconfig=/usr/sbin/gifconfig ++gifconfig=/sbin/ifconfig + ifconfig=/sbin/ifconfig + route=/sbin/route + rtadvd=/usr/sbin/rtadvd diff --git a/net/gateway6/files/pkg-message.in b/net/gateway6/files/pkg-message.in new file mode 100644 index 000000000000..7358c785bc9e --- /dev/null +++ b/net/gateway6/files/pkg-message.in @@ -0,0 +1,12 @@ +Now that the package is installed, please finish it with the following steps: + +- Check the values of %%PREFIX%%/etc/gw6c.conf. If you have registered at + the website, fill in your userid and password there. +- Run '%%PREFIX%%/etc/rc.d/gateway6 start' to start the tunnel. +- Try to ping a IPv6 host, for example: ping6 www.jp.freebsd.org + +Net/gateway6 supports rc.subr. +Please add 'gateway6_enable="YES"' to your /etc/rc.conf to make it +start autoamtically at startup. + +WWW: http://www.go6.net/ diff --git a/net/gateway6/pkg-descr b/net/gateway6/pkg-descr new file mode 100644 index 000000000000..8266938ead2f --- /dev/null +++ b/net/gateway6/pkg-descr @@ -0,0 +1,23 @@ +From README: + +TSP is a control protocol used to establish and maintain static +tunnels. The Gateway6 Client 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. + +The Gateway6 Client code is mostly identical for all client platforms. +However, creating the static tunnel is operating system dependent and +is done by a script called by the Gateway6 Client. These scripts are +located under the template directory in the Gateway6 Client +installation directory. + +The script executed by the Gateway6 Client to configure the tunnel +interface is customized for each type of supported operating system +and takes care of all specifics for the target operating system. +On Unix systems, it is a shell script. This separation of the binary +and script enables fast and easy additions of new operating systems, +as has been shown by the community contributions for many operating +systems. + +WWW: http://www.go6.net/ diff --git a/net/gateway6/pkg-plist b/net/gateway6/pkg-plist new file mode 100644 index 000000000000..23c3b420a2bb --- /dev/null +++ b/net/gateway6/pkg-plist @@ -0,0 +1,14 @@ +bin/gw6c +@unexec if cmp -s %D/etc/gw6c.conf.sample %D/etc/gw6c.conf; then rm -f %D/etc/gw6c.conf; fi +etc/gw6c.conf.sample +@exec if [ ! -f %D/etc/gw6c.conf ] ; then cp -p %D/%F %B/gw6c.conf; fi +%%DATADIR%%/CLIENT-LICENSE.TXT +%%DATADIR%%/GUI-LICENSE.TXT +%%DATADIR%%/HEX_DC_0005_Gateway6_Client_Guide.pdf +%%DATADIR%%/HEX_DC_0007_Gateway6_Client_Release_Notes.pdf +%%DATADIR%%/INSTALL +%%DATADIR%%/README +%%DATADIR%%/checktunnel.sh +%%DATADIR%%/freebsd.sh +@dirrm %%DATADIR%% +@dirrm %%EXAMPLESDIR%% -- cgit v1.2.3