From: Carsten Schlote <c.schl...@konzeptpark.de> This packet provides IPV6 networking with the tereodo protocol.
Default generic files are taken from miredo sources. Signed-off-by: Carsten Schlote <c.schl...@konzeptpark.de> --- generic/etc/init.d/miredo-server | 89 ++++++++++++++++++++++++++++++ generic/etc/miredo/client-hook | 70 ++++++++++++++++++++++++ generic/etc/miredo/miredo-server.conf | 22 ++++++++ generic/etc/miredo/miredo.conf | 35 ++++++++++++ patches/miredo-1.2.2/autogen.sh | 1 + patches/miredo-1.2.2/series | 3 + rules/miredo.in | 19 +++++++ rules/miredo.make | 96 +++++++++++++++++++++++++++++++++ 8 files changed, 335 insertions(+), 0 deletions(-) create mode 100644 generic/etc/init.d/miredo-server create mode 100644 generic/etc/miredo/client-hook create mode 100644 generic/etc/miredo/miredo-server.conf create mode 100644 generic/etc/miredo/miredo.conf create mode 120000 patches/miredo-1.2.2/autogen.sh create mode 100644 patches/miredo-1.2.2/dummy.patch create mode 100644 patches/miredo-1.2.2/series create mode 100644 rules/miredo.in create mode 100644 rules/miredo.make diff --git a/generic/etc/init.d/miredo-server b/generic/etc/init.d/miredo-server new file mode 100644 index 0000000..271d173 --- /dev/null +++ b/generic/etc/init.d/miredo-server @@ -0,0 +1,89 @@ +#! /bin/sh +# $Id: miredo-server.init 1754 2006-09-18 14:25:04Z remi $ +# +# miredo-server start/stop script for Debian GNU/Linux +# Author: Rémi Denis-Courmont <rdenis (at) simphalempin (dot) com> +# +# chkconfig: 345 17 83 +# description: Starts and stops the miredo-server daemon \ +# used to provide a Teredo server. +# +### BEGIN INIT INFO +# Provides: +# Required-Start: $local_fs $remote_fs $network $syslog $time +# Required-Stop: $local_fs $remote_fs $syslog +# Short-Description: Teredo server +# Description: miredo-server daemon to provide a Teredo server +# Default-Start: 3 4 5 +# Default-Stop: 0 1 2 6 +### END INIT INFO + + +PATH=/usr/sbin:/usr/bin:/sbin:/bin +DESC="Teredo server daemon" +NAME=miredo-server +DAEMON=/usr/sbin/$NAME +DAEMON_ARGS="" +PIDFILE=/var/run/$NAME.pid +SCRIPTNAME=/etc/init.d/$NAME + +[ -x "$DAEMON" ] || exit 0 + +# Source defaults. +[ -r /etc/default/$NAME ] && . /etc/default/$NAME + +# Ensure configuration is readable. +[ -r /etc/$NAME.conf ] || exit 0 + +. /lib/lsb/init-functions + +check_start() { + if [ "x$START_MIREDO_SERVER" != "xtrue" ]; then + echo "START_MIREDO_SERVER is set to false in /etc/default/$NAME" + echo "$DAEMON not starting" + exit 0 + fi +} + +check_chroot_dir() { + if [ -d "/var/run/$NAME" ]; then + mkdir -p "/var/run/$NAME" + chmod 0755 "/var/run/$NAME" + fi +} + + +case "$1" in + start) + check_start + check_chroot_dir + log_daemon_msg "Starting $DESC" "$NAME" + start-stop-daemon --start --quiet --pidfile "$PIDFILE" \ + --exec "$DAEMON" --oknodo -- $DAEMON_ARGS + log_end_msg $? + ;; + stop) + log_daemon_msg "Stopping $DESC" "$NAME" + start-stop-daemon --stop --quiet --pidfile "$PIDFILE" \ + --retry 1 --oknodo + log_end_msg $? + ;; + reload|force-reload) + log_daemon_msg "Reloading $DESC" "$NAME" + start-stop-daemon --stop --signal 1 --quiet --pidfile "$PIDFILE" \ + --exec "$DAEMON" + log_end_msg $? + ;; + restart) + check_start # avoid stopping if would not restart + $0 stop + sleep 1 + $0 start + ;; + *) + echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 + exit 1 + ;; +esac + +exit $? diff --git a/generic/etc/miredo/client-hook b/generic/etc/miredo/client-hook new file mode 100644 index 0000000..87ae405 --- /dev/null +++ b/generic/etc/miredo/client-hook @@ -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="/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 diff --git a/generic/etc/miredo/miredo-server.conf b/generic/etc/miredo/miredo-server.conf new file mode 100644 index 0000000..b2e2613 --- /dev/null +++ b/generic/etc/miredo/miredo-server.conf @@ -0,0 +1,22 @@ +#! /usr/sbin/miredo-server -f -c +# +# Sample configuration file for miredo-server + +# Please refer to the miredo-server.conf(5) manpage for details. + +# Server primary IPv4 address. +# Two public IPv4 addresses are needed to operate a Teredo server. +# Miredo will open UDP port 3544 on both addresses. +ServerBindAddress 192.0.2.221 + +# Server secondary IPv4 address. +# The Microsoft Windows Teredo client implementation assumes that the +# secondary address is the primary address plus one. This is the +# default unless uncommented. +#ServerBindAddress2 192.0.2.222 + +#SyslogFacility user + +# Think twice before modifying the settings above. +#Prefix 2001:0:: +#InterfaceMTU 1280 diff --git a/generic/etc/miredo/miredo.conf b/generic/etc/miredo/miredo.conf new file mode 100644 index 0000000..732de88 --- /dev/null +++ b/generic/etc/miredo/miredo.conf @@ -0,0 +1,35 @@ +#! /usr/sbin/miredo -f -c +# +# Sample configuration file for Miredo + +# Please refer to the miredo.conf(5) man page for details. + +# Miredo can safely run as a Teredo client, which is the default. +#RelayType client + +# Name of the network tunneling interface. +InterfaceName teredo + +# Depending on the local firewall/NAT rules, you might need to force +# Miredo to use a fixed UDP port and or IPv4 address. +#BindPort 3545 +#BindAddress 192.0.2.100 + +#SyslogFacility user + +## CLIENT-SPECIFIC OPTIONS +# The hostname or primary IPv4 address of the Teredo server. +# This setting is required if Miredo runs as a Teredo client. +#**************************************************************************# +# teredo.remlab.net is an experimental service for testing only. # +# Please use another server for production and/or large scale deployments. # +#**************************************************************************# +#ServerAddress teredo.ipv6.microsoft.com +#ServerAddress teredo.ginzado.ne.jp +#ServerAddress teredo.iks-jena.de +ServerAddress teredo.remlab.net +#ServerAddress2 teredo2.remlab.net + +## RELAY-SPECIFIC OPTIONS +#Prefix 2001:0:: +#InterfaceMTU 1280 diff --git a/patches/miredo-1.2.2/autogen.sh b/patches/miredo-1.2.2/autogen.sh new file mode 120000 index 0000000..9f8a4cb --- /dev/null +++ b/patches/miredo-1.2.2/autogen.sh @@ -0,0 +1 @@ +../autogen.sh \ No newline at end of file diff --git a/patches/miredo-1.2.2/dummy.patch b/patches/miredo-1.2.2/dummy.patch new file mode 100644 index 0000000..e69de29 diff --git a/patches/miredo-1.2.2/series b/patches/miredo-1.2.2/series new file mode 100644 index 0000000..5f57aaf --- /dev/null +++ b/patches/miredo-1.2.2/series @@ -0,0 +1,3 @@ +# Required dummy patch to get autogen.sh executed without error +dummy.patch + diff --git a/rules/miredo.in b/rules/miredo.in new file mode 100644 index 0000000..17b4f28 --- /dev/null +++ b/rules/miredo.in @@ -0,0 +1,19 @@ +## SECTION=networking + +menuconfig MIREDO + tristate + prompt "miredo" + help + Miredo is an open-source implementation of the Teredo: Tunneling IPv6 over UDP + through NATs Internet proposed standard (RFC 4380), targetting the Linux kernel + and BSD operating systems. The purpose of Teredo IPv6 tunneling is to provide + IPv6 connectivity to users behind NAT devices, such as most broadband routers, + most of which do not support IPv6. + +if MIREDO + +config MIREDO_INSTALL_SERVER + bool + prompt "Install miredo-server.conf and init.d script" + +endif diff --git a/rules/miredo.make b/rules/miredo.make new file mode 100644 index 0000000..afee558 --- /dev/null +++ b/rules/miredo.make @@ -0,0 +1,96 @@ +# -*-makefile-*- +# +# Copyright (C) 2008 by Carsten Schlote <c.schl...@konzeptpark.de> +# +# See CREDITS for details about who has contributed to this project. +# +# For further information about the PTXdist project and license conditions +# see the README file. +# + +# +# We provide this package +# +PACKAGES-$(PTXCONF_MIREDO) += miredo + +# +# Paths and names +# +MIREDO_VERSION := 1.2.2 +MIREDO := miredo-$(MIREDO_VERSION) +MIREDO_SUFFIX := tar.bz2 +MIREDO_URL := http://www.remlab.net/files/miredo/$(MIREDO).$(MIREDO_SUFFIX) +MIREDO_SOURCE := $(SRCDIR)/$(MIREDO).$(MIREDO_SUFFIX) +MIREDO_DIR := $(BUILDDIR)/$(MIREDO) + +# ---------------------------------------------------------------------------- +# Get +# ---------------------------------------------------------------------------- + +$(MIREDO_SOURCE): + @$(call targetinfo) + @$(call get, MIREDO) + +# ---------------------------------------------------------------------------- +# Prepare +# ---------------------------------------------------------------------------- + +MIREDO_PATH := PATH=$(CROSS_PATH) +MIREDO_ENV := $(CROSS_ENV) + +# +# autoconf +# +MIREDO_AUTOCONF := $(CROSS_AUTOCONF_USR) \ + --localstatedir=/var \ + --without-Judy + +# ---------------------------------------------------------------------------- +# Target-Install +# ---------------------------------------------------------------------------- + +$(STATEDIR)/miredo.targetinstall: + @$(call targetinfo) + + @$(call install_init, miredo) + @$(call install_fixup, miredo,PACKAGE,miredo) + @$(call install_fixup, miredo,PRIORITY,optional) + @$(call install_fixup, miredo,VERSION,$(MIREDO_VERSION)) + @$(call install_fixup, miredo,SECTION,base) + @$(call install_fixup, miredo,AUTHOR,"Carsten Schlote <c.schl...@konzeptpark.de>") + @$(call install_fixup, miredo,DEPENDS,) + @$(call install_fixup, miredo,DESCRIPTION,missing) + +# # -- Library section + + @$(call install_copy, miredo, 0, 0, 0644, -, /usr/lib/libteredo.so.5.0.0) + @$(call install_link, miredo, libteredo.so.5.0.0, /usr/lib/libteredo.so.5) + + @$(call install_copy, miredo, 0, 0, 0644, -, /usr/lib/libtun6.so.0.1.1) + @$(call install_link, miredo, libtun6.so.0.1.1, /usr/lib/libtun6.so.0.1) + @$(call install_link, miredo, libtun6.so.0.1.1, /usr/lib/libtun6.so.0) + + @$(call install_copy, miredo, 0, 0, 0755, -, /usr/lib/miredo/miredo-privproc) + +# # -- Executables + + @$(call install_copy, miredo, 0, 0, 0755, -, /usr/bin/teredo-mire) + + @$(call install_copy, miredo, 0, 0, 0755, -, /usr/sbin/miredo) + @$(call install_copy, miredo, 0, 0, 0755, -, /usr/sbin/miredo-checkconf) + +# # -- Configs + + @$(call install_copy, miredo, 0, 0, 0755, -, /etc/miredo/client-hook) + @$(call install_alternate, miredo, 0, 0, 0644, /etc/miredo/miredo.conf) + + ifdef PTXCONF_MIREDO_INSTALL_SERVER + @$(call install_alternate, miredo, 0, 0, 0644, /etc/miredo/miredo-server.conf) + @$(call install_alternate, miredo, 0, 0, 0644, /etc/init.d/miredo-server, n) + @$(call install_copy, miredo, 0, 0, 0755, -, /usr/sbin/miredo-server) + endif + @$(call install_finish, miredo) + @$(call touch) + + +# vim: syntax=make -- 1.6.5.6.gb3118
-- ptxdist mailing list ptxdist@pengutronix.de