[package] update miredo to 1.2.3, packaged miredo-privproc, add client-hook script...
authorFlorian Fainelli <florian@openwrt.org>
Sun, 22 Aug 2010 16:36:35 +0000 (16:36 +0000)
committerFlorian Fainelli <florian@openwrt.org>
Sun, 22 Aug 2010 16:36:35 +0000 (16:36 +0000)
SVN-Revision: 22763

ipv6/miredo/Makefile
ipv6/miredo/files/client-hook [new file with mode: 0644]

index 387ccd5..bdc5f83 100644 (file)
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=miredo
-PKG_VERSION:=1.1.7
-PKG_RELEASE:=4
+PKG_VERSION:=1.2.3
+PKG_RELEASE:=1
 
 PKG_SOURCE_URL:=http://www.remlab.net/files/miredo/
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_MD5SUM:=4fb5e7df6a6255528e4c5380401ad3ea
+PKG_MD5SUM:=6ba484ad5e331514a8a3452da2b144e7
 
 PKG_FIXUP:=libtool
 PKG_INSTALL:=1
@@ -76,20 +76,24 @@ MAKE_FLAGS := \
 define Package/miredo-common/install
        $(INSTALL_DIR) $(1)/usr/lib
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/lib{teredo,tun6}.so.* $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/miredo
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/miredo/miredo-privproc $(1)/usr/lib/miredo
 endef
 
 define Package/miredo-server/install
        $(INSTALL_DIR) $(1)/etc/miredo
        $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/miredo/examples/miredo-server.conf $(1)/etc/miredo/miredo-server.conf
+       $(INSTALL_BIN) ./files/client-hook $(1)/etc/miredo/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/miredo-server.init $(1)/etc/init.d/miredo-server
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/miredo-server $(1)/usr/sbin/
 endef
 
-define Package/miredo-client/install   
+define Package/miredo-client/install
        $(INSTALL_DIR) $(1)/etc/miredo
        $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/miredo/examples/miredo.conf $(1)/etc/miredo/miredo.conf
+       $(INSTALL_BIN) ./files/client-hook $(1)/etc/miredo/
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/miredo.init $(1)/etc/init.d/miredo
        $(INSTALL_DIR) $(1)/usr/sbin
diff --git a/ipv6/miredo/files/client-hook b/ipv6/miredo/files/client-hook
new file mode 100644 (file)
index 0000000..b4c3ce8
--- /dev/null
@@ -0,0 +1,70 @@
+#! /bin/sh
+#
+# Miredo client hook script for Linux/iproute2
+# Copyright © 2007 Rémi Denis-Courmont.
+# Distributed under the terms of the GNU General Public License version 2.
+
+# Linux iproute2 path:
+IP="/usr/sbin/ip"
+
+# Linux default route default metric is 1024
+# (we put 1029 so that Teredo is used as a last resort):
+METRIC=1029
+
+# Linux routing table ID
+# (possible values: 1-252 from /etc/iproute/rt_tables):
+TABLE="teredo"
+
+# Linux routing rule priority
+# (possible values: 1-32765, lowest number is highest priority):
+PRIO=32765
+
+# MTU for the tunnel interface
+# (default: specified by the Teredo server, or 1280)
+#MTU=1400
+
+if ! test -x "$IP"; then
+       echo "$0: iproute2 is required! Please install it." >&2
+       exit 1
+fi
+
+# Nothing to do with destroy event
+if test "$STATE" = "destroy"; then exit 0; fi
+
+# If the source routing table is not configured, ignore it.
+if ! "$IP" route show table "$TABLE" >/dev/null 2>&1; then
+       unset TABLE
+else
+       if test "$OLD_ADDRESS"; then
+               "$IP" -6 rule del from "$OLD_ADDRESS" \
+                       prio "$PRIO" table "$TABLE" 2>/dev/null
+       fi
+       "$IP" -6 route flush table "$TABLE" 2>/dev/null
+fi
+
+"$IP" -6 route flush dev "$IFACE" 2>/dev/null
+"$IP" -6 address flush dev "$IFACE" 2>/dev/null
+
+"$IP" -6 link set dev "$IFACE" "$STATE"
+if test "$MTU"; then
+       "$IP" link set dev "$IFACE" mtu "$MTU"
+fi
+
+case "$STATE" in
+       up)
+               "$IP" -6 address add "${LLADDRESS}/64" dev "$IFACE"
+               "$IP" -6 address add "${ADDRESS}/32" dev "$IFACE"
+               "$IP" -6 route add default dev "$IFACE" metric "$METRIC"
+
+               if test "$TABLE"; then
+                       "$IP" -6 route add default dev "$IFACE" table "$TABLE"
+                       "$IP" -6 rule add from "$ADDRESS" \
+                               prio "$PRIO" table "$TABLE"
+               fi
+esac
+
+# This should be required when changing policy routing rules, but it
+# seems to confuse certain kernels into removing our default route!
+#"$IP" -6 route flush cache 2>/dev/null
+
+exit 0