#!/bin/sh
#	IPv6 setup for duvel{-v6.ipv6}.inria.fr (FreeBSD 2.2.2)
#

#if [ "X${autoconf6}" != X"NO" ]; then
	autoconf6 -v >/tmp/autoconf6 2>&1 &
	cat /home/dupont/cache.au > /dev/audio
#else
#	sysctl net.inet6.ipv6.multi_homed
#
#	ifconfig de0 inet6 fe80::220:feff:fe00:8781/128
#	route -n add -iface -inet6 ff02::/16 fe80::220:feff:fe00:8781
#	route -n add -iface -inet6 ff12::/16 fe80::220:feff:fe00:8781
#
#	ifconfig fpa0 inet6 fe80::a00:2bff:feb4:8ff3/128
#
#	ifconfig ll0 inet6 fe80::220:feff:fe00:8781/64
#
#	ifconfig sit0 inet6 ::128.93.9.50/96
#	ifconfig sit1 inet6 ::193.51.193.60/123
#
#	ifconfig lo0 inet6 ::1/128
#	route -n add -inet6 ff01::/16 -iface ::1
#	route -n add -inet6 ff11::/16 -iface ::1
#
#	route -n add -iface -cloning -inet6 ::/0 fe80::220:feff:fe00:8781
#fi

# eui64 magic option can easily used here!

ifconfig de0 inet6 firstalias 3ffe:0306:1051:8300::/64 eui64
ifconfig fpa0 inet6 firstalias 3ffe:0306:1051:d6d2::/64 eui64

# route to 6bone via a configured tunnel
#
#(cticonfig -v -4 -l -s 128.93.9.50 cti0 129.88.26.1;
# cticonfig -v -4 -s 128.93.9.50 cti1 192.44.68.18) >/tmp/cticonfig 2>&1
#
#ifconfig cti0 inet6 3ffe:0306:1051:8300:1:0:805d:932/128 ::129.88.26.1
#
#ifconfig cti1 inet6 firstalias 3ffe:0306:1051:8300:1:0:805d:932/128 ::192.44.68.18

#route -n add -inet6 ::/0 ::129.88.26.1
#route -n add -inet6 3ffe:306:1051:d6d0::/60 fe80::240:bff:fe40:94bb -ifa 3ffe:0306:1051:d6d2:a00:2bff:feb4:8ff3

# turn IP forwarding on

sysctl -w net.inet6.ipv6.forwarding=1
sysctl -w net.inet6.ipv6.mforwarding=1
#ndpd-router -s -g
ndpd-router -s

if [ "X${forceloop}" = X"YES" ]; then
	ping6 -n -q -c 1 fe80::220:feff:fe00:8781
	ping6 -n -q -c 1 fe80::a00:2bff:feb4:8ff3
	ping6 -n -q -c 1 ::128.93.9.50
	ping6 -n -q -c 1 ::193.51.193.60
	ping6 -n -q -c 1 3ffe:0306:1051:8300:220:feff:fe00:8781
	ping6 -n -q -c 1 3ffe:0306:1051:d6d2:a00:2bff:feb4:8ff3
#	route -n add -iface -local -host -inet6 3ffe:0306:1051:8300:1:0:805d:932 -link cti0:
fi

# fast timers

if [ "X${fasttimers}" = X"YES" ]; then
	sysctl -w net.inet6.ipv6.prune=1
	sysctl -w net.inet6.ipv6.keep=120
	sysctl -w net.inet6.ipv6.reachable=30
	sysctl -w net.inet6.ipv6.retrans=1
	sysctl -w net.inet6.ipv6.probe=5
	sysctl -w net.inet6.ipv6.hold_down=3
fi

# for testing purpose

#route -v -n get -inet6 ff02::1
#route -v -n get -inet6 fe80::a00:2bff:feb4:8ff3
#route -v -n get -inet6 fe80::a00:20ff:fe0f:28ce
#route -v -n get -inet6 ::128.93.1.21
#route -v -n get -inet6 ::192.87.110.60
#route -v -n get -host -inet6 ganesha-v6.ipv6.imag.fr
#route -v -n get -host -inet6 3ffe:604::c0:4fc6:9cc7
