Add ptrtd (#1402)
authorFlorian Fainelli <florian@openwrt.org>
Mon, 26 Feb 2007 11:37:12 +0000 (11:37 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Mon, 26 Feb 2007 11:37:12 +0000 (11:37 +0000)
SVN-Revision: 6388

ipv6/ptrtd/Makefile [new file with mode: 0644]
ipv6/ptrtd/files/ptrtd.init [new file with mode: 0644]
ipv6/ptrtd/patches/100-ptrtd-0.5.2-openwrt.patch [new file with mode: 0644]

diff --git a/ipv6/ptrtd/Makefile b/ipv6/ptrtd/Makefile
new file mode 100644 (file)
index 0000000..b7cdd0e
--- /dev/null
@@ -0,0 +1,49 @@
+# 
+# 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:=ptrtd
+PKG_VERSION:=0.5.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://v6web.litech.org/ptrtd/dist/
+PKG_MD5SUM:=bfe026445fdc4fe509a9c70ec4551744
+PKG_CAT:=zcat
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ptrtd
+  SECTION:=ipv6
+  CATEGORY:=IPv6
+  DEPENDS:=+kmod-ipv6 +kmod-tun +ip
+  TITLE:=Portable Transport Relay Translator Daemon
+  DESCRIPTION:=\
+       The Portable Transport Relay Translator Daemon (pTRTd)\\\
+       is a method of allowing IPv6 hosts to communicate with IPv4 hosts.
+  URL:=http://v6web.litech.org/ptrtd/
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               CC=$(TARGET_CC) \
+               all
+endef
+
+define Package/ptrtd/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/$(PKG_NAME) $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/ptrtd.init $(1)/etc/init.d/ptrtd
+endef
+
+$(eval $(call BuildPackage,ptrtd))
diff --git a/ipv6/ptrtd/files/ptrtd.init b/ipv6/ptrtd/files/ptrtd.init
new file mode 100644 (file)
index 0000000..8f4ae24
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006 OpenWrt.org
+
+START=60
+BIN=ptrtd
+RUN_D=/var/run
+PID_F=$RUN_D/$BIN.pid
+
+PREFIX="3ffe:abcd:1234:9876::"
+LEN=64
+
+
+start() {
+       mkdir -p $RUN_D
+       $BIN -p $PREFIX -l $LEN
+}
+
+stop() {
+       [ -f $PID_F ] && kill $(cat $PID_F)
+}
+
+restart() {
+       stop
+       sleep 1
+       start
+}
diff --git a/ipv6/ptrtd/patches/100-ptrtd-0.5.2-openwrt.patch b/ipv6/ptrtd/patches/100-ptrtd-0.5.2-openwrt.patch
new file mode 100644 (file)
index 0000000..3a9d003
--- /dev/null
@@ -0,0 +1,41 @@
+--- ptrtd-0.5.2/ptrtd.old      2007-02-22 16:10:57.896689015 +0100
++++ ptrtd-0.5.2/ptrtd.c        2007-02-22 16:11:39.194388792 +0100
+@@ -201,13 +201,13 @@
+       if( do_config )
+       {
+               printf( "Tunnel: %s\n", ifname );
+-              sprintf( cmd, "/sbin/ip link set %s up", ifname );
++              sprintf( cmd, "/usr/sbin/ip link set %s up", ifname );
+               printf( "command: %s\n", cmd );
+               system( cmd );
+-              sprintf( cmd, "/sbin/ip addr add fe80::1/64 dev %s", ifname );
++              sprintf( cmd, "/usr/sbin/ip addr add fe80::1/64 dev %s", ifname );
+               printf( "command: %s\n", cmd );
+               system( cmd );
+-              sprintf( cmd, "/sbin/ip route add %s/%d dev %s via fe80::5",
++              sprintf( cmd, "/usr/sbin/ip route add %s/%d dev %s via fe80::5",
+                               prefix, plen, ifname );
+               printf( "command: %s\n", cmd );
+               system( cmd );
+--- ptrtd-0.5.2/tap802ipd.old  2007-02-22 16:11:22.600920230 +0100
++++ ptrtd-0.5.2/tap802ipd.c    2007-02-22 16:11:51.040581581 +0100
+@@ -125,16 +125,16 @@
+       tap_get_name( (struct iface *)tap_iface, ifname );
+       printf( "Tunnel: %s\n", ifname );
+-      sprintf( cmd, "/sbin/ip link set %s address %02x:%02x:%02x:%02x:%02x:%02x up\n", ifname,
++      sprintf( cmd, "/usr/sbin/ip link set %s address %02x:%02x:%02x:%02x:%02x:%02x up\n", ifname,
+                       ip_iface->hwaddr[0], ip_iface->hwaddr[1],
+                       ip_iface->hwaddr[2], ip_iface->hwaddr[3],
+                       ip_iface->hwaddr[4], ip_iface->hwaddr[5] );
+       printf( "command: %s\n", cmd );
+       system( cmd );
+-      //sprintf( cmd, "/sbin/ip addr add fe80::1/64 dev %s", ifname );
++      //sprintf( cmd, "/usr/sbin/ip addr add fe80::1/64 dev %s", ifname );
+       //printf( "command: %s\n", cmd );
+       //system( cmd );
+-      //sprintf( cmd, "/sbin/ip route add %s/%d dev %s via fe80::5", prefix, plen, ifname );
++      //sprintf( cmd, "/usr/sbin/ip route add %s/%d dev %s via fe80::5", prefix, plen, ifname );
+       //printf( "command: %s\n", cmd );
+       //system( cmd );
+ }