summaryrefslogtreecommitdiff
path: root/net/hf6to4
diff options
context:
space:
mode:
authorhubertf <hubertf@pkgsrc.org>2005-05-30 22:49:42 +0000
committerhubertf <hubertf@pkgsrc.org>2005-05-30 22:49:42 +0000
commit89058e319922a2fd6960348a9d5936b79bf6014d (patch)
treee811395d21d8e6592c3eb9351868ead4a34af6bd /net/hf6to4
parente880d865366ae665c81c76171effd4544062e3d8 (diff)
downloadpkgsrc-89058e319922a2fd6960348a9d5936b79bf6014d.tar.gz
* Copyright maintenance
* make "stf-start" and "stf-stop" aliases to "start" and "stop" * don't use RFC 1918 or 3927 IPs as outer address Inspired by OpenDarwin/MacOS X's ip6config (== old perl version of hf6to4! :-).
Diffstat (limited to 'net/hf6to4')
-rw-r--r--net/hf6to4/Makefile4
-rwxr-xr-xnet/hf6to4/files/hf6to449
-rw-r--r--net/hf6to4/files/hf6to4.860
-rw-r--r--net/hf6to4/files/hf6to4.html126
4 files changed, 174 insertions, 65 deletions
diff --git a/net/hf6to4/Makefile b/net/hf6to4/Makefile
index f2ddac653c3..b2a5473fba4 100644
--- a/net/hf6to4/Makefile
+++ b/net/hf6to4/Makefile
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.5 2005/03/15 13:26:07 tv Exp $
+# $NetBSD: Makefile,v 1.6 2005/05/30 22:49:42 hubertf Exp $
#
-DISTNAME= hf6to4-1.2
+DISTNAME= hf6to4-1.3
CATEGORIES= net
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/net/hf6to4/files/hf6to4 b/net/hf6to4/files/hf6to4
index 9f3d7e29ac3..21e5efd03ea 100755
--- a/net/hf6to4/files/hf6to4
+++ b/net/hf6to4/files/hf6to4
@@ -1,8 +1,39 @@
#!/bin/sh
#
-# hf6to4 - Setup 6to4 IPv6, for NetBSD (and maybe others)
+# $NetBSD: hf6to4,v 1.4 2005/05/30 22:49:43 hubertf Exp $
#
-# (c) Copyright 2000, 2003 Hubert Feyrer <hubert@feyrer.de>
+# Copyright (c) 2000-2005 Hubert Feyrer <hubert@feyrer.de>
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by Hubert Feyrer
+# for the NetBSD Project.
+# 4. The name of the author may not be used to endorse or promote products
+# derived from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+
+#
+# hf6to4 - Setup 6to4 IPv6, for NetBSD (and others)
#
etcdir="/usr/pkg/etc";
@@ -37,7 +68,7 @@ run()
###########################################################################
usage()
{
- echo "Usage: $0 [-n] [-v] {start | stop | rtadvd-start | rtadvd-stop}";
+ echo "Usage: $0 [-n] [-v] {stf-start | stf-stop | rtadvd-start | rtadvd-stop}";
}
###########################################################################
@@ -95,12 +126,18 @@ fi
#
-# Figure out IP#s etc.
+# Figure out IP#s etc. - ignore RFC 1918 and 3927 IPs
#
localadr4=`ifconfig $out_if inet \
| grep inet \
| sed 's/^.*inet *//' \
| sed 's/ .*$//' \
+ | grep -v '^192\.168\.' \
+ | grep -v '^10\.' \
+ | grep -v '^172\.1[6-9]\.' \
+ | grep -v '^172\.2[0-9]\.' \
+ | grep -v '^172\.3[01]\.' \
+ | grep -v '^169\.254\.' \
| head -1`
l4c=`echo $localadr4 | sed 's,\., ,g'`
@@ -156,7 +193,7 @@ fi
#
# stop:
-if [ "$1" = "stop" ]
+if [ "$1" = "stf-stop" -o "$1" = "stop" ]
then
run ifconfig stf0 down
@@ -194,7 +231,7 @@ fi
# start:
-if [ "$1" = "start" ]
+if [ "$1" = "stf-start" -o "$1" = "start" ]
then
run ifconfig stf0 inet6 $localadr6:$hostbits6 prefixlen $v6_prefixlen alias
run route add -inet6 default $remoteadr6 >/dev/null
diff --git a/net/hf6to4/files/hf6to4.8 b/net/hf6to4/files/hf6to4.8
index 8c3755caf16..090e8587547 100644
--- a/net/hf6to4/files/hf6to4.8
+++ b/net/hf6to4/files/hf6to4.8
@@ -1,5 +1,35 @@
-.\" $NetBSD: hf6to4.8,v 1.3 2004/01/31 23:56:47 snj Exp $
-.Dd August 23, 2003
+.\" $NetBSD: hf6to4.8,v 1.4 2005/05/30 22:49:43 hubertf Exp $
+.\"
+.\" Copyright (c) 2000-2005 Hubert Feyrer <hubert@feyrer.de>.
+.\" All rights reserved.
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\" notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\" notice, this list of conditions and the following disclaimer in the
+.\" documentation and/or other materials provided with the distribution.
+.\" 3. All advertising materials mentioning features or use of this software
+.\" must display the following acknowledgement:
+.\" This product includes software developed by Hubert Feyrer for
+.\" the NetBSD Project.
+.\" 4. The name of the author may not be used to endorse or promote products
+.\" derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd May 31, 2005
.Dt hf6to4 8
.Os
.Sh NAME
@@ -48,12 +78,18 @@ Show usage.
Possible commands are:
.Bl -tag -width rtadvd-start
.It Sy start
+Same as
+.Sy stf-start .
+.It Sy stop
+Same as
+.Sy stf-stop .
+.It Sy stf-start
Configure 6to4 IPv6. The
.Xr stf 4
interface is configured, and a default route to a remote 6to4
gateway is established. In addition, the internal
network interface is assigned an address.
-.It Sy stop
+.It Sy stf-stop
Stops 6to4 IPv6. All addresses are removed from the
.Xr stf 4
device, and the default route is removed. If
@@ -181,14 +217,17 @@ script can be run automatically by
when a connection is made. For this, put the following into
.Pa /etc/ppp/ip-up :
.Bd -literal -offset
-( /usr/pkg/sbin/hf6to4 stop
- /usr/pkg/sbin/hf6to4 start ) &
+( /usr/pkg/sbin/hf6to4 stf-stop
+ /usr/pkg/sbin/hf6to4 stf-start
+ /usr/pkg/sbin/hf6to4 rtadvd-stop
+ /usr/pkg/sbin/hf6to4 rtadvd-start ) &
.Ed
.Pp
To shut down properly, put this into
.Pa /etc/ppp/ip-down :
.Bd -literal -offset
-/usr/pkg/sbin/hf6to4 stop
+/usr/pkg/sbin/hf6to4 stf-stop
+/usr/pkg/sbin/hf6to4 rtadvd-stop
.Ed
.Sh SEE ALSO
.Xr stf 4 ,
@@ -204,6 +243,15 @@ The
.Nm
utility and manpage were written by
Hubert Feyrer <hubert@feyrer.de>.
+.Pp
+The utility was initially written in perl and called
+.Dq 6to4
+but later rewritten as shell script and renamed to a name different
+than the protocol it configures to emphasize the difference
+between the protocol (6to4) and the implementation (hf6to4).
+.Pp
+The older (perl) version is also shipped by Apple with versions
+10.3 and 10.4 (and probably newer) of their MacOS X operating system.
.Sh BUGS
On systems running past-1.5, the
.Dq ifconfig stf0 create
diff --git a/net/hf6to4/files/hf6to4.html b/net/hf6to4/files/hf6to4.html
index 0f76c6e6326..fa0103f9e40 100644
--- a/net/hf6to4/files/hf6to4.html
+++ b/net/hf6to4/files/hf6to4.html
@@ -1,35 +1,35 @@
<html>
<head>
- <title>
- August 23, 2003 hf6to4 8
+ <title>
+ May 31, 2005 hf6to4 8
- </title>
+ </title>
<style type="text/css">
<!--
- body { margin-left:4%; }
- H1, H2, H3, H4, H5 {
- color: maroon; padding: 4pt; margin-left: -4%;
- border: solid; border-width: thin; width: 100%;
- background: rgb(204,204,255)
- }
+ body { margin-left:4%; }
+ H1, H2, H3, H4, H5 {
+ color: maroon; padding: 4pt; margin-left: -4%;
+ border: solid; border-width: thin; width: 100%;
+ background: rgb(204,204,255)
+ }
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
- <h3>
- NAME
- </h3>
+ <h3>
+ NAME
+ </h3>
<b>hf6to4</b>
- setup automatic 6to4 IPv6 tunnelling
- <h3>
- SYNOPSIS
- </h3>
+ <h3>
+ SYNOPSIS
+ </h3>
<b>hf6to4</b>
[<b>-</b><b></b><b>vn</b>]
<i></i><i>command</i>
- <h3>
- DESCRIPTION
- </h3>
+ <h3>
+ DESCRIPTION
+ </h3>
The
<b>hf6to4</b>
script can be used to setup IPv6 on your home machine and
@@ -42,17 +42,17 @@ Replies are routed back to you over IPv4 via (possibly) other
packets are accepted from all v4-hosts. See
<a href="../html4/stf.html">stf(4)</a>
for security discussion.
- <p>
+ <p>
From your (single) IPv4 address, you get a whole IPv6 /48 network,
which allows you to split your network in 2^16 subnets, with 2^64
hosts each. You need to setup routing for your internal network
properly, help is provided for setting up the border router here.
- <p>
+ <p>
This script takes the burden to calculate your IPv6 address from
existing IPv4 address and runs the commands to setup (and tear down)
automatic 6to4 IPv6 tunnelling. In a separate step, router
advertisement for the inside network can be started and stopped.
- <p>
+ <p>
Possible options are:
<dl compact>
<p><dt><b>-</b><b></b><b>n</b><dd>
@@ -64,19 +64,27 @@ running them. Displays some additional information.
<p><dt><b>-</b><b></b><b>h</b><dd>
Show usage.
</dl>
- <p>
+ <p>
Possible commands are:
<dl compact>
<p><dt><b></b><b>start</b><dd>
+Same as
+<b></b><b>stf-start</b>.
+<p><dt><b></b><b>stop</b><dd>
+Same as
+<b></b><b>stf-stop</b>.
+<p><dt><b></b><b>stf-start</b><dd>
Configure 6to4 IPv6. The
<a href="../html4/stf.html">stf(4)</a>
interface is configured, and a default route to a remote 6to4
gateway is established. In addition, the internal
network interface is assigned an address.
-<p><dt><b></b><b>stop</b><dd>
+<p><dt><b></b><b>stf-stop</b><dd>
Stops 6to4 IPv6. All addresses are removed from the
<a href="../html4/stf.html">stf(4)</a>
-device, and the default route is removed.
+device, and the default route is removed. If
+<b></b><b>in_if</b>
+is set, the 6to4 addresses are removed from that interface too.
<p><dt><b></b><b>rtadvd-start</b><dd>
Starts router advertizement and IPv6 packet forwarding,
turning the machine into a IPv6 router.
@@ -94,9 +102,9 @@ Stops router advertizement and IPv6 packet forwarding.
<a href="../html8/rtadvd.html">rtadvd(8)</a>
is stopped.
</dl>
- <h3>
- REQUIREMENTS
- </h3>
+ <h3>
+ REQUIREMENTS
+ </h3>
Besides IPv4 connectivity, you need support for IPv6 and the
<a href="../html4/stf.html">stf(4)</a>
device in your kernel. While the GENERIC
@@ -104,18 +112,18 @@ NetBSD
1.5 kernel does support IPv6, it does not contain support for the
<a href="../html4/stf.html">stf(4)</a>
device.
- <p>
+ <p>
Make sure you have the following options in your kernel config file:
<dl compact><dt><dd>
<code>
<pre>
-options INET # IP + ICMP + TCP + UDP
+options INET # IP + ICMP + TCP + UDP
options INET6 # IPV6
-pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
+pseudo-device stf 1 # 6to4 IPv6 over IPv4 encapsulation
</pre>
</code>
</dl>
- <p>
+ <p>
In systems that run past-1.5,
you will have to explicitly create an
<a href="../html4/stf.html">stf(4)</a>
@@ -140,15 +148,15 @@ ifconfig_stf0="create"
</pre>
</code>
</dl>
- <p>
+ <p>
See also the comment on setting up IPv6-clients
`behind'
your 6to4 router for the
<b></b><b>rtadvd-start</b>
command!
- <h3>
- CONFIGURATION
- </h3>
+ <h3>
+ CONFIGURATION
+ </h3>
The
<b>hf6to4</b>
script reads its configuration from a config file named
@@ -207,9 +215,9 @@ and
can be set to strings containing the numerical IPv4 and IPv6 numbers
directly.
</dl>
- <h3>
- EXAMPLES
- </h3>
+ <h3>
+ EXAMPLES
+ </h3>
The
<b>hf6to4</b>
script can be run automatically by
@@ -219,24 +227,27 @@ when a connection is made. For this, put the following into
<dl compact><dt><dd>
<code>
<pre>
-( /usr/pkg/sbin/hf6to4 stop
- /usr/pkg/sbin/hf6to4 start ) &
+( /usr/pkg/sbin/hf6to4 stf-stop
+ /usr/pkg/sbin/hf6to4 stf-start
+ /usr/pkg/sbin/hf6to4 rtadvd-stop
+ /usr/pkg/sbin/hf6to4 rtadvd-start ) &
</pre>
</code>
</dl>
- <p>
+ <p>
To shut down properly, put this into
<code></code><code>/etc/ppp/ip-down</code>:
<dl compact><dt><dd>
<code>
<pre>
-/usr/pkg/sbin/hf6to4 stop
+/usr/pkg/sbin/hf6to4 stf-stop
+/usr/pkg/sbin/hf6to4 rtadvd-stop
</pre>
</code>
</dl>
- <h3>
- SEE ALSO
- </h3>
+ <h3>
+ SEE ALSO
+ </h3>
<a href="../html4/stf.html">stf(4)</a>,
``6to4 IPv6 Explained''
at
@@ -245,20 +256,33 @@ NetBSD
IPv6 Documentation at
<code></code><code>http://www.netbsd.org/Documentation/network/ipv6/</code>,
RFC 3068.
- <h3>
- HISTORY
- </h3>
+ <h3>
+ HISTORY
+ </h3>
The
<b>hf6to4</b>
utility and manpage were written by
Hubert Feyrer <hubert@feyrer.de>.
- <h3>
- BUGS
- </h3>
+ <p>
+The utility was initially written in perl and called
+``6to4''
+but later rewritten as shell script and renamed to a name different
+than the protocol it configures to emphasize the difference
+between the protocol (6to4) and the implementation (hf6to4).
+ <p>
+The older (perl) version is also shipped by Apple with versions
+10.3 and 10.4 (and probably newer) of their MacOS X operating system.
+ <h3>
+ BUGS
+ </h3>
On systems running past-1.5, the
``ifconfig stf0 create''
should be run automatically.
+ <p>
+Might be good to use /etc/rc.d/rtadvd for rtadvd handling.
</font></body>
</html>
+
+