If memory serves me right, Yoshinobu Inoue wrote:
> In KAME environment, IPv6 related configurations are done at
> last of rc.conf. So it is at almost end of configuration.
It turns out this won't work real well, because if I do this, then
inetd gets started before we start up the IPv6 interfaces, which is
bad for any IPv6 services to get started from inetd.
> I don't know if still such kind of change is permitted to
> commit or not, but if you try to make some initial patch for
> it, I think that is anyway good start and very helpful.
OK, I've attached the results of a few hours of hacking. There's a
diff for /etc/defaults/rc.conf, a diff for /etc/rc, and a new
/etc/rc.net6 file all attached here. The /etc/rc.net6 file is a
modified version of /usr/local/v6/etc/rc.net6 from the KAME
distribution. Patches are all against 4.0-CURRENT, as of the middle of
last week.
I haven't really tested it very well (in particular, the router-specific
code is completely untested, because, well I don't really have the
ability at the moment). Comments welcome, or if one of the KAME team
members with commit privileges wants to fix it up and/or try to get
this code commited, that's fine too.
Cheers,
Bruce.
*** /etc/rc Mon Feb 7 14:53:30 2000
--- /etc/rc.dist Mon Feb 7 14:47:44 2000
***************
*** 191,205 ****
network_pass1
fi
- case ${ipv6_enable} in
- [Yy][Ee][Ss])
- if [ -r /etc/rc.net6 ]; then
- . /etc/rc.net6 # We only need to do this once also.
- net6_pass1
- fi
- ;;
- esac
-
# Mount NFS filesystems.
echo -n "Mounting NFS file systems"
mount -a -t nfs
--- 191,196 ----
*** /etc/defaults/rc.conf.dist Mon Feb 7 13:42:45 2000
--- /etc/defaults/rc.conf Mon Feb 7 14:55:23 2000
***************
*** 183,188 ****
--- 183,199 ----
### Miscellaneous network options: ###
icmp_bmcastecho="NO" # respond to broadcast ping packets
+ ### IPv6 options: ###
+ ipv6_enable="NO" # Set to YES to set up for IPv6.
+ ipv6_network_interfaces="auto" # List of network interfaces (or "auto").
+ ipv6_gateway="NO" # Set to YES if this host will be a gateway.
+ route6d_enable="NO" # Set to YES to enable an IPv6 routing daemon.
+ route6d="/usr/sbin/route6d" # Name of IPv6 routing daemon.
+ route6dflags="" # Flags to IPv6 routing daemon.
+ mroute6d_enable="NO" # Do IPv6 multicast routing.
+ mroute6d="/usr/sbin/pim6dd" # Name of IPv6 multicast routing daemon.
+ mroute6dflags="" # Flags to IPv6 multicast routing daemon.
+ gifs="NO" # List of GIF tunnels (or "NO").
##############################################################
### System console options #################################
#! /bin/sh
# $FreeBSD$
# Note that almost all of the user-configurable behavior is no longer in
# this file, but rather in /etc/defaults/rc.conf. Please check that file
# first before contemplating any changes here. If you do need to change
# this file for some reason, we would like to know about it.
# IPv6 startup
net6_pass1() {
echo -n 'Doing IPv6 network setup:'
if [ X"${ipv6_gateway}" = X"YES" ]; then
#
# list of interfaces, and prefix for interfaces
# NOTE: no trailing double colon necessary here!
#
case ${ipv6_network_interfaces} in
[Aa][Uu][Tt][Oo])
ipv6_network_interfaces="`ifconfig -l`"
;;
esac
# ipv6_network_interfaces="ed0 ep0"
# prefix_ed0="fec0:0000:0000:0001"
# prefix_ep0="fec0:0000:0000:0002"
#
# list of outer ip addresses for gif.
#
# gifs="gif0 gif1"
# gifconfig_gif0="10.1.1.1 10.1.2.1"
# gifconfig_gif1="10.1.1.2 10.1.2.2"
else
#
# manual configurations - in case ip6router=NO
# you can configure only single interface, as specification assumes
that
# autoconfigured host has single interface only.
#
case ${ipv6_network_interfaces} in
[Aa][Uu][Tt][Oo])
ipv6_network_interfaces="`ifconfig -l | sed -e 's/ .*//'`"
;;
esac
fi
# tool locations
prefixconfig=/usr/sbin/prefix
rtsol=/sbin/rtsol
gifconfig=/usr/sbin/gifconfig
route=/sbin/route
ndp=/usr/sbin/ndp
# just to make sure
ifconfig lo0 up
#determine the "default interface" used below
if [ X"$defaultiface" = X"" ]; then
for i in $ipv6_network_interfaces; do # use 1st interface in the list
defaultiface=$ipv6_network_interfaces
break
done
fi
# disallow unicast packets without outgoing scope identifiers.
# if you instead want to route such packets to a "default" interface,
# comment out the 1st two lines, and enable the lines after them.
$route add -inet6 fe80:: -prefixlen 10 ::1 -reject
$route add -inet6 fec0:: -prefixlen 10 ::1 -reject
#if [ X"$defaultiface" = X"" ]; then
# for i in $ipv6_network_interfaces; do # use 1st interface in the list
# defaultiface=$ipv6_network_interfaces
# break
# done
#fi
#if [ X"$defaultiface" != X"" ]; then
# $route add -inet6 fe80:: ::1 -prefixlen 10 -interface -ifp $defaultiface
-cloning
# $route add -inet6 fec0:: ::1 -prefixlen 10 -interface -ifp $defaultiface
-cloning
#fi
# disallow "internal" addresses to appear on the wire
$route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
$route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
if [ X"${ipv6_gateway}" = X"YES" ]; then
# act as a router
sysctl -w net.inet6.ip6.forwarding=1
sysctl -w net.inet6.ip6.accept_rtadv=0
# wait for DAD
for i in $ipv6_network_interfaces; do
ifconfig $i up
done
sleep `sysctl net.inet6.ip6.dad_count | awk '{print $NF}'`
sleep 1
# setting up interfaces
for i in $ipv6_network_interfaces; do
eval prefix=\$prefix_$i
if [ X"$prefix" = X"" ]; then
continue
fi
for j in $prefix; do
if [ -x $prefixconfig ]; then
$prefixconfig $i $j::
else
# NetBSD *requires* inet6
laddr=`ifconfig $i inet6 | grep 'inet6 fe80:'
| head -1 | \
awk '{print $2}'`
hostid=`echo $laddr | sed -e
's/fe80:[0-9a-fA-F]+::/fe80::/' -e 's/fe80:://' -e 's/@.*//'`
address=$j\:$hostid
eval hostid_$i=$hostid
eval address_$i=$address
ifconfig $i inet6 $address prefixlen 64 alias
fi
# subnet-router anycast address (rfc2373)
ifconfig $i inet6 $j:: prefixlen 64 alias anycast
done
ifconfig $i inet6
done
# again, wait for DAD's completion (for global addrs)
sleep `sysctl net.inet6.ip6.dad_count | awk '{print $NF}'`
sleep 1
# gifconfig
case ${gifs} in
[Nn][Oo] | '')
;;
*)
for i in $gifs; do
eval peers=\$gifconfig_$i
if [ X"$peers" = X"" ]; then
continue
fi
$gifconfig $i $peers
done
;;
esac
# route6d
if [ X"${route6d_enable}" = X"YES" -a -x $route6d ]; then
$route6d $route6dflags
fi
# rtadvd
# This should enabled with a great care.
# You may want to fine-tune /usr/local/v6/etc/rtadvd.conf.
if [ X"${rtadvd_enable}" = X"YES" -a -x $rtadvd ]; then
$rtadvd $ipv6_network_interfaces
fi
# mroute6d
if [ X"${mroute6d_enable}" = X"YES" -a -x $mroute6d ]; then
$mroute6d $mroute6dflags
fi
else
# act as endhost - automatically configured
sysctl -w net.inet6.ip6.forwarding=0
sysctl -w net.inet6.ip6.accept_rtadv=1
ifconfig $ipv6_network_interfaces up
$rtsol $ipv6_network_interfaces
# install the "default interface" to kernel, which will be used
# as the default route when there's no router.
# [ -x $ndp ] && $ndp -I $defaultiface
# wait for DAD's completion (for global addrs)
sleep `sysctl net.inet6.ip6.dad_count | awk '{print $NF}'`
sleep 1
fi
echo '.'
# Let future generations know we made it.
#
net6_pass1_done=YES
}