From 297673e165738cc8fea6a649b050d99370a244ea Mon Sep 17 00:00:00 2001 From: kaloz Date: Mon, 19 Feb 2007 15:30:20 +0000 Subject: [PATCH] add tspc package (freenet6 client) git-svn-id: svn://svn.openwrt.org/openwrt/packages@6324 3c298f89-4303-0410-b956-a3cf2f4a3e73 --- ipv6/tspc/Makefile | 53 +++++++ ipv6/tspc/patches/001-debian_patches.patch | 228 +++++++++++++++++++++++++++++ 2 files changed, 281 insertions(+) create mode 100644 ipv6/tspc/Makefile create mode 100644 ipv6/tspc/patches/001-debian_patches.patch diff --git a/ipv6/tspc/Makefile b/ipv6/tspc/Makefile new file mode 100644 index 000000000..f27d8d492 --- /dev/null +++ b/ipv6/tspc/Makefile @@ -0,0 +1,53 @@ +# +# Copyright (C) 2006 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# +# $Id$ + +include $(TOPDIR)/rules.mk + +PKG_NAME:=tspc +PKG_VERSION:=2.1.1 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.gz +PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/t/tspc +PKG_MD5SUM:=65183cae002feaacd8bc92d6a5404cc2 +PKG_CAT:=zcat + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)2 +PKG_INSTALL_DIR:=$(PKG_BUILD_DIR)/ipkg-install + +include $(INCLUDE_DIR)/package.mk + +define Package/tspc + SECTION:=ipv6 + CATEGORY:=IPv6 + TITLE:=Client for Hexago's (Freenet6's) IPv6 service + DESCRIPTION:=\ + Client to configure an IPv6 tunnel to \\\ + Hexago's (Freenet6's) migration broker. + URL:=http://www.hexago.com +endef + +define Build/Compile + rm -rf $(PKG_INSTALL_DIR) + mkdir -p $(PKG_INSTALL_DIR) + $(MAKE) -C $(PKG_BUILD_DIR) \ + CC="$(TARGET_CC)" \ + AR="$(TARGET_AR)" \ + installdir="$(PKG_INSTALL_DIR)" \ + install target=linux +endef + +define Package/tspc/install + $(INSTALL_DIR) $(1)/bin + $(INSTALL_DIR) $(1)/etc + $(INSTALL_DIR) $(1)/etc/tsp + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/bin/tspc $(1)/bin/ + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/bin/tspc.conf $(1)/etc/tsp/ +endef + +$(eval $(call BuildPackage,tspc)) diff --git a/ipv6/tspc/patches/001-debian_patches.patch b/ipv6/tspc/patches/001-debian_patches.patch new file mode 100644 index 000000000..3a958f658 --- /dev/null +++ b/ipv6/tspc/patches/001-debian_patches.patch @@ -0,0 +1,228 @@ +diff -Nur tspc2/conf/Makefile tspc2.owrt/conf/Makefile +--- tspc2/conf/Makefile 2004-03-29 17:37:56.000000000 +0200 ++++ tspc2.owrt/conf/Makefile 2007-02-19 16:07:05.000000000 +0100 +@@ -42,7 +42,7 @@ + sed -e "s+@ifname_tun@+$(ifname_tun)+" -e "s+@ifname@+$(ifname)+" -e "s+@target@+$(target)+" -e "s+@tsp_dir@+$(configdir)+" tspc.conf.in >$(BIN)/tspc.conf.sample; \ + fi + +- chmod 700 $(BIN)/tspc.conf.sample ++ chmod 600 $(BIN)/tspc.conf.sample + + + clean: +diff -Nur tspc2/conf/tspc.conf.in tspc2.owrt/conf/tspc.conf.in +--- tspc2/conf/tspc.conf.in 2004-06-15 17:01:01.000000000 +0200 ++++ tspc2.owrt/conf/tspc.conf.in 2007-02-19 16:07:05.000000000 +0100 +@@ -18,13 +18,6 @@ + # to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, + # MA 02111-1307 USA + #------------------------------------------------------------------------------ +-# +-# +-# tsp directory: +-# the only use is for the OS scripts which will be taken +-# from $tsp_dir/template +-# +-tsp_dir=@tsp_dir@ + + # + # authentication method: +@@ -66,28 +59,19 @@ + + # + # Name of the script: +-# template=checktunnel|freebsd|netbsd|linux|windows|darwin|cisco| +-# solaris|openbsd ++# template=checktunnel|setup + # + # the value is the file name of the script in the tsp_dir/template directory + # The script will be executed after the TSP session is completed. The script + # is configuring the tunnel interface and routes. + # checktunnel is only printing information and does not configure any tunnel +-# freebsd is for FreeBSD 4.X and above +-# netbsd is for NetBSD 1.6 and above +-# linux is for Linux (most distributions) +-# windows is for WindowsXP +-# darwin is for MacOS X 10.2 and above +-# cisco is for Cisco IOS. This script prints the cisco configuration while +-# not configuring the cisco itself. +-# solaris is for Solaris 8 and above. +-# openbsd is for OpenBSD 3.X and above ++# setup will do the actual work + # you could customize your own script, name it and put the filename in + # the template variable. + # on unix, '.sh' is added to the name of the script. + # on windows, '.bat' is added to the name of the script. + # +-template=@target@ ++template=setup + + # + # 'server' is the tunnel broker identifier +diff -Nur tspc2/platform/linux/tsp_local.c tspc2.owrt/platform/linux/tsp_local.c +--- tspc2/platform/linux/tsp_local.c 2004-07-07 21:25:47.000000000 +0200 ++++ tspc2.owrt/platform/linux/tsp_local.c 2007-02-19 16:07:18.000000000 +0100 +@@ -59,13 +59,13 @@ + + /* these globals are defined by US used by alot of things in */ + +-char *FileName = "tspc.conf"; +-char *LogFile = "tspc.log"; ++char *FileName = "/etc/tsp/tspc.conf"; ++char *LogFile = "/var/log/tspc.log"; + char *LogFileName = NULL; +-char *ScriptInterpretor = "/bin/sh"; ++char *ScriptInterpretor = ""; + char *ScriptExtension = "sh"; + char *ScriptDir = NULL; +-char *TspHomeDir = "/usr/local/etc/tsp"; ++char *TspHomeDir = "/etc/tsp"; + char DirSeparator = '/'; + + int Verbose = 0; +@@ -143,7 +143,7 @@ + { + int tunfd; + +- Display(0, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile); ++ Display(1, ELInfo, "tspStartLocal", "Going daemon, check %s for tunnel creation status", LogFile); + + if (daemon(0,0) == -1) { + Display(1, ELError, "tspStartLocal", "Unable to fork."); +diff -Nur tspc2/src/lib/config.c tspc2.owrt/src/lib/config.c +--- tspc2/src/lib/config.c 2004-06-29 17:06:13.000000000 +0200 ++++ tspc2.owrt/src/lib/config.c 2007-02-19 16:07:11.000000000 +0100 +@@ -474,14 +474,17 @@ + if(IsPresent(Conf->dns_server)) { + char *Server; + char *dns = strdup(Conf->dns_server); ++ struct addrinfo *contact; + if (eq(Conf->host_type, "host")) { + Display(1,ELError, "tspVerifyConfig", "DNS delegation is not supported for host_type=host"); + status = 1; + } + for(Server = strtok(dns, ":");Server; Server = strtok(NULL, ":")) { +- if(gethostbyname(Server) == NULL) { ++ if(getaddrinfo(Server, "domain", 0, &contact)!=0) { + Display(1,ELError, "tspVerifyConfig", "DNS server name %s is not resolving.", Server); + status = 1; ++ } else { ++ freeaddrinfo(contact); + } + } + free(dns); +diff -Nur tspc2/src/tsp/tsp_client.c tspc2.owrt/src/tsp/tsp_client.c +--- tspc2/src/tsp/tsp_client.c 2004-04-20 17:10:58.000000000 +0200 ++++ tspc2.owrt/src/tsp/tsp_client.c 2007-02-19 16:07:18.000000000 +0100 +@@ -275,7 +275,7 @@ + + start_show: + +- Display(0, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel"); ++ Display(1, ELInfo, "tspSetupTunnel", "Got tunnel parameters from server, setting up local tunnel"); + + /* and start the show */ + ret = tspStartLocal(socket, conf, &t, nt[conf->transport]); +@@ -337,8 +337,8 @@ + LogInit("tspc", LogFile); + + Display( 1, ELInfo, "tspMain", "----- TSP Client Version %s Initializing -------------------------", TSP_CLIENT_VERSION); +- Display( 0, ELInfo, "tspMain", IDENTIFICATION); +- Display( 0, ELInfo, "tspMain", "Initializing (use -h for help)\n"); ++ Display( 1, ELInfo, "tspMain", IDENTIFICATION); ++ Display( 1, ELInfo, "tspMain", "Initializing (use -h for help)\n"); + + if((status = tspInitialize(argc, argv, &c)) != 0) { // *** we have no uninitialize + if (status == -1) { +@@ -361,12 +361,12 @@ + + /* first try with RUDP */ + c.transport = NET_TOOLS_T_RUDP; +- Display( 0, ELInfo, "tspMain", "\nConnecting to server with reliable udp"); ++ Display( 1, ELInfo, "tspMain", "\nConnecting to server with reliable udp"); + + try_server: + + if (c.transport == NET_TOOLS_T_TCP) +- Display( 0, ELInfo, "tspMain", "\nConnecting to server with tcp"); ++ Display( 1, ELInfo, "tspMain", "\nConnecting to server with tcp"); + + Display( 1, ELInfo, "tspMain", "Using TSP protocol version %s", + TspProtocolVersionStrings[version_index]); +diff -Nur tspc2/template/linux.sh tspc2.owrt/template/linux.sh +--- tspc2/template/linux.sh 2004-06-23 23:29:20.000000000 +0200 ++++ tspc2.owrt/template/linux.sh 2007-02-19 16:08:39.000000000 +0100 +@@ -135,9 +135,7 @@ + # + # Default route + Display 1 "Adding default route" +- ExecNoCheck $route -A inet6 del ::/0 2>/dev/null # delete old default route + ExecNoCheck $route -A inet6 del 2000::/3 2>/dev/null # delete old gw route +- Exec $route -A inet6 add ::/0 dev $TSP_TUNNEL_INTERFACE + Exec $route -A inet6 add 2000::/3 dev $TSP_TUNNEL_INTERFACE + fi + +@@ -147,9 +145,10 @@ + Display 1 "Kernel setup" + if [ X"${TSP_PREFIXLEN}" != X"64" ]; then + #Better way on linux to avoid loop with the remaining /48? +- $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null ++ ExecNoCheck $route -A inet6 del $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE 2>/dev/null ++ Exec $route -A inet6 add $TSP_PREFIX::/$TSP_PREFIXLEN dev $TSP_HOME_INTERFACE + fi +- Exec $sysctl -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled ++ Exec $sysctl -q -w net.ipv6.conf.all.forwarding=1 # ipv6_forwarding enabled + Display 1 "Adding prefix to $TSP_HOME_INTERFACE" + OLDADDR=`$ifconfig $TSP_HOME_INTERFACE | grep "inet6.* $PREF" | sed -e "s/^.*inet6 addr: //" -e "s/ Scope.*\$//"` + if [ ! -z $OLDADDR ]; then +@@ -157,28 +156,28 @@ + Exec $ifconfig $TSP_HOME_INTERFACE inet6 del $OLDADDR + fi + Exec $ifconfig $TSP_HOME_INTERFACE add $TSP_PREFIX::1/64 +- # Router advertisement configuration +- Display 1 "Create new $rtadvdconfigfile" +- echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile" +- echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile" +- echo "{" >> "$rtadvdconfigfile" +- echo " AdvSendAdvert on;" >> "$rtadvdconfigfile" +- echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile" +- echo " {" >> "$rtadvdconfigfile" +- echo " AdvOnLink on;" >> "$rtadvdconfigfile" +- echo " AdvAutonomous on;" >> "$rtadvdconfigfile" +- echo " };" >> "$rtadvdconfigfile" +- echo "};" >> "$rtadvdconfigfile" +- echo "" >> "$rtadvdconfigfile" +- /etc/init.d/radvd stop +- if [ -f $rtadvdconfigfile ]; then +- KillProcess $rtadvdconfigfile +- Exec $rtadvd -u radvd -C $rtadvdconfigfile +- Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile" +- else +- echo "Error : file $rtadvdconfigfile not found" +- exit 1 +- fi ++# # Router advertisement configuration ++# Display 1 "Create new $rtadvdconfigfile" ++# echo "##### rtadvd.conf made by TSP ####" > "$rtadvdconfigfile" ++# echo "interface $TSP_HOME_INTERFACE" >> "$rtadvdconfigfile" ++# echo "{" >> "$rtadvdconfigfile" ++# echo " AdvSendAdvert on;" >> "$rtadvdconfigfile" ++# echo " prefix $TSP_PREFIX::/64" >> "$rtadvdconfigfile" ++# echo " {" >> "$rtadvdconfigfile" ++# echo " AdvOnLink on;" >> "$rtadvdconfigfile" ++# echo " AdvAutonomous on;" >> "$rtadvdconfigfile" ++# echo " };" >> "$rtadvdconfigfile" ++# echo "};" >> "$rtadvdconfigfile" ++# echo "" >> "$rtadvdconfigfile" ++# /etc/init.d/radvd stop ++# if [ -f $rtadvdconfigfile ]; then ++# KillProcess $rtadvdconfigfile ++# Exec $rtadvd -u radvd -C $rtadvdconfigfile ++# Display 1 "Starting radvd: $rtadvd -u radvd -C $rtadvdconfigfile" ++# else ++# echo "Error : file $rtadvdconfigfile not found" ++# exit 1 ++# fi + fi + + Display 1 "--- End of configuration script. ---" -- 2.11.0