pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/hf6to4 Add hf6to4 1.0.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d35dc7a27da8
branches:  trunk
changeset: 460157:d35dc7a27da8
user:      hubertf <hubertf%pkgsrc.org@localhost>
date:      Sat Aug 23 13:30:35 2003 +0000

description:
Add hf6to4 1.0.

The hf6to4 script can be used to setup IPv6 on your home machine and net-
work for exploring IPv6 without any registrations. 6to4 is a mechanism by
which your IPv6 address(es) are derived from an assigned IPv4 address,
and which involves automatic tunnelling to one or more remote 6to4 hubs,
which will then forward your v6 packets on the 6bone etc. Replies are
routed back to you over IPv4 via (possibly) other 6to4 capable remote
gateways. As such, IPv6-in-IPv4-encapsulated packets are accepted from
all v4-hosts.

XXX this is a rewrite of 6to4 in /bin/sh, no more perl required.

diffstat:

 net/hf6to4/DESCR             |    8 +
 net/hf6to4/MESSAGE           |   11 +
 net/hf6to4/Makefile          |   33 +++++
 net/hf6to4/PLIST             |    6 +
 net/hf6to4/files/Makefile    |    2 +
 net/hf6to4/files/hf6to4      |  214 ++++++++++++++++++++++++++++++++++
 net/hf6to4/files/hf6to4.8    |  208 +++++++++++++++++++++++++++++++++
 net/hf6to4/files/hf6to4.conf |   35 +++++
 net/hf6to4/files/hf6to4.html |  264 +++++++++++++++++++++++++++++++++++++++++++
 9 files changed, 781 insertions(+), 0 deletions(-)

diffs (truncated from 817 to 300 lines):

diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/DESCR
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/hf6to4/DESCR  Sat Aug 23 13:30:35 2003 +0000
@@ -0,0 +1,8 @@
+The hf6to4 script can be used to setup IPv6 on your home machine and net-
+work for exploring IPv6 without any registrations. 6to4 is a mechanism by
+which your IPv6 address(es) are derived from an assigned IPv4 address,
+and which involves automatic tunnelling to one or more remote 6to4 hubs,
+which will then forward your v6 packets on the 6bone etc. Replies are
+routed back to you over IPv4 via (possibly) other 6to4 capable remote
+gateways. As such, IPv6-in-IPv4-encapsulated packets are accepted from
+all v4-hosts.
diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/MESSAGE
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/hf6to4/MESSAGE        Sat Aug 23 13:30:35 2003 +0000
@@ -0,0 +1,11 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1.1.1 2003/08/23 13:30:35 hubertf Exp $
+
+To configure a 6to4 tunnel, modify the configuration file
+${PKG_SYSCONFDIR}/hf6to4.conf for your system, then run
+
+       ${RCD_SCRIPTS_DIR}/hf6to4 -v start
+
+You should then be able to ping6 www.kame.net.
+
+===========================================================================
diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/hf6to4/Makefile       Sat Aug 23 13:30:35 2003 +0000
@@ -0,0 +1,33 @@
+# $NetBSD: Makefile,v 1.1.1.1 2003/08/23 13:30:35 hubertf Exp $
+#
+
+DISTNAME=              hf6to4-1.0
+WRKSRC=                        ${WRKDIR}
+CATEGORIES=            net
+MASTER_SITES=          # empty
+DISTFILES=             # empty
+
+MAINTAINER=            hubertf%NetBSD.org@localhost
+HOMEPAGE=              http://www.NetBSD.org/packages/net/hf6to4/files/hf6to4.html
+COMMENT=               Enables 6to4 IPv6 automatic tunnels
+
+USE_PKGINSTALL=                YES
+
+# This pkg doesn't regard USE_INET6 (leave this comment for README-IPv6.html!)
+EXTRACT_ONLY=  # empty
+NO_CHECKSUM=   yes
+NO_CONFIGURE=  yes
+
+CONF_FILES+=   ${PREFIX}/share/examples/hf6to4/hf6to4.conf ${PKG_SYSCONFDIR}/hf6to4.conf
+
+do-build:
+       @${SED} ${FILES_SUBST_SED} ${FILESDIR}/hf6to4 > ${WRKSRC}/hf6to4
+
+do-install:
+       ${INSTALL_DATA_DIR} ${PREFIX}/share/examples/hf6to4
+       ${INSTALL_SCRIPT} ${WRKSRC}/hf6to4 ${PREFIX}/sbin/hf6to4
+       ${INSTALL_MAN} ${FILESDIR}/hf6to4.8 ${PREFIX}/man/man8
+       ${INSTALL_DATA} ${FILESDIR}/hf6to4.html ${PREFIX}/share/doc/hf6to4.html
+       ${INSTALL_DATA} ${FILESDIR}/hf6to4.conf ${PREFIX}/share/examples/hf6to4
+
+.include "../../mk/bsd.pkg.mk"
diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/PLIST
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/hf6to4/PLIST  Sat Aug 23 13:30:35 2003 +0000
@@ -0,0 +1,6 @@
+@comment $NetBSD: PLIST,v 1.1.1.1 2003/08/23 13:30:35 hubertf Exp $
+sbin/hf6to4
+share/doc/hf6to4.html
+share/examples/hf6to4/hf6to4.conf
+man/man8/hf6to4.8
+@dirrm share/examples/hf6to4
diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/files/Makefile
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/hf6to4/files/Makefile Sat Aug 23 13:30:35 2003 +0000
@@ -0,0 +1,2 @@
+hf6to4.html: hf6to4.8
+       nroff -mdoc2html hf6to4.8 > hf6to4.html
diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/files/hf6to4
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/hf6to4/files/hf6to4   Sat Aug 23 13:30:35 2003 +0000
@@ -0,0 +1,214 @@
+#!/bin/sh
+#
+# hf6to4 - Setup 6to4 IPv6, for NetBSD (and maybe others)
+#
+# (c) Copyright 2000, 2003 Hubert Feyrer <hubert%feyrer.de@localhost>
+#
+
+etcdir="/usr/pkg/etc";
+
+not=false
+verbose=false
+
+f=$etcdir/hf6to4.conf
+if [ -f "$f" ]
+then
+    . $f
+else
+    echo "$0: config file $f missing."
+    exit 1
+fi
+
+###########################################################################
+run()
+{
+    if $not
+    then
+       echo "$@"
+    else
+       if $verbose
+       then
+           echo "$@"
+       fi
+       "$@"
+    fi
+}
+
+###########################################################################
+usage()
+{
+    echo "Usage: $0 [-n] [-v] {start | stop | rtadvd-start | rtadvd-stop}";
+}
+
+###########################################################################
+### M A I N
+###########################################################################
+#
+# Process options
+#
+args=`getopt nvh $*`
+if [ $? != 0 ]
+then
+    usage
+    exit 1
+fi
+
+set -- $args
+while [ $# -gt 0 ]
+do
+  case "$1" in
+  -n)
+       not=true
+       ;;
+  -v)
+        verbose=true
+       ;;
+  --)
+        shift
+       break
+       ;;
+  -h)
+        usage
+       exit 0
+       ;;
+  *)
+        usage
+       exit 1
+       ;;
+  esac
+  shift
+done
+
+
+# maybe ifconfig stf0 create?
+
+
+#
+# Some sanity checks
+#
+if  [ `ifconfig -a | grep fe80: | wc -l` -le 0 -o \
+      `ifconfig -a | grep stf | wc -l` -le 0 ]; then
+    echo "$0: It seems your kernel does not support IPv6 or 6to4 (stf)."
+    echo "Add 'options INET6' and 'pseudo-device stf 1' to your kernel and retry!";
+    exit 1
+fi
+
+
+#
+# Figure out IP#s etc.
+#
+localadr4=`ifconfig $out_if inet \
+           | grep inet \
+          | sed 's/^.*inet *//' \
+          | sed 's/ .*$//'`
+
+l4c=`echo $localadr4 | sed 's,\., ,g'`
+prefix=`printf "2002:%02x%02x:%02x%02x" $l4c`
+
+localadr6=`printf "$prefix:%04x" $v6_net`
+
+
+if [ "$peer" = "6to4-anycast" ]
+then
+    # magic values from rfc 3068
+    remoteadr4="192.88.99.1"
+    remoteadr6="2002:c058:6301::"
+else
+    if [ `expr "$remoteadr4" : "^[0-9.]*$"` -gt 0 ]
+    then
+       $verbose && \
+           echo "IPv4 address of peer given numerically, no resolving needed"
+    else
+       # Hostname, needs resolving
+       
+       remoteadr4=`host $peer | sed 's/^.*address //'`
+
+       $verbose && \
+           echo "resolving IPv4 address of peer $peer as $remoteadr4"
+    fi
+
+    if [ `expr "$remoteadr6" : "^[0-9a-fA-Z:]*$"` -gt 0 ]
+    then
+       $verbose && \
+       echo "IPv6 address of peer given numerically, no resolving needed"
+    else
+       remoteadr6=`host -t AAAA $peer | sed 's/^.*address //'`
+
+       $verbose && \
+       echo "resolving IPv6 address of peer $peer as $remoteadr6"
+    fi
+fi
+
+
+if $verbose
+then
+    echo "remote v4 address: $remoteadr4"
+    echo "local  v4 address: $localadr4"
+    echo "remote v6 address: $remoteadr6"
+    echo "local  v6 address: $localadr6:$hostbits6"
+    echo ""
+fi
+
+
+#
+# Handle commands
+#
+
+# stop:
+if [ "$1" = "stop" ]
+then
+       run ifconfig stf0 down
+       
+       # remove all v6 addresses from stf interface:
+       adrs=`ifconfig stf0 inet6 \
+             | grep inet6 \
+             | sed -e 's/inet6//' \
+                   -e 's/prefix.*//g' \
+                   -e 's/^[    ]*//' \
+                   -e 's/[     ]*\$//'`
+       for adr in $adrs
+       do
+               run ifconfig stf0 inet6 -alias $adr
+       done
+
+       # remove default route:
+       run route delete -inet6 default
+fi
+
+
+# start:
+if [ "$1" = "start" ]
+then
+       run ifconfig stf0 inet6 $localadr6:$hostbits6 prefixlen $v6_prefixlen alias
+       run route add -inet6 default $remoteadr6
+       if [ "$in_if" != "" ]
+       then
+           run ifconfig $in_if inet6 $prefix:$v6_innernet:$hostbits6
+       fi
+fi
+
+# rtadvd-stop:
+if [ "$1" = "rtadvd-stop" -o "$1" = "stop-rtadvd" ]
+then
+    if [ -f "/var/run/rtadvd.pid" ]
+    then
+       pid=`cat /var/run/rtadvd.pid`
+       run kill -TERM $pid
+       run rm -f /var/run/rtadvd.pid
+    else
+       echo $0: no rtadvd running!
+    fi
+fi
+
+# rtadvd-start:
+if [ "$1" = "rtadvd-start" -o "$1" = "start-rtadvd" ]
+then
+    if [ -f "/var/run/rtadvd.pid" ]
+    then
+       echo $0: rtadvd already running!
+    else
+       run sysctl -w net.inet6.ip6.forwarding=1
+       run sysctl -w net.inet6.ip6.accept_rtadv=0
+       run rtadvd $in_if
+    fi
+fi
diff -r 9917efd9b272 -r d35dc7a27da8 net/hf6to4/files/hf6to4.8
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000



Home | Main Index | Thread Index | Old Index