From: Friedrich L. <fr...@us...> - 2004-04-10 00:28:14
|
Update of /cvsroot/devil-linux/build/config/etc/init.d In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17603/config/etc/init.d Modified Files: network Log Message: added IPv6 interface configuration support which was contributed to DL from Arnaud Gomes-do-Vale Index: network =================================================================== RCS file: /cvsroot/devil-linux/build/config/etc/init.d/network,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- network 21 Mar 2004 20:15:20 -0000 1.30 +++ network 10 Apr 2004 00:14:49 -0000 1.31 @@ -14,6 +14,7 @@ # Eric Laberge # Friedrich Lobenstock <fl...@fl...> # Thomas Eder <tho...@bu...> +# Arnaud Gomes-do-Vale <Arn...@ir...> # ### BEGIN INIT INFO @@ -146,6 +147,10 @@ ROUTE= BR_IF= + # IPv6 stuff + IPV6ADDR= + IPV6ROUTE= + WIRELESS= ESSID= NWID= @@ -208,12 +213,25 @@ BCAST=""; test -n "$BROADCAST" && BCAST="broadcast $BROADCAST" NMASK=""; test -n "$NETMASK" && NMASK="netmask $NETMASK" - echo -n "Starting interface $DEVICE" + echo -n "Starting interface $DEVICE"; ret=0 if [ -n "$IP" ]; then - ifconfig $DEVICE $IP $BCAST $NMASK up + # configure IPv4 address + echo -n " [IPv4]" + ifconfig $DEVICE $IP $BCAST $NMASK up; let ret=$ret+$? else - ifconfig $DEVICE up + ifconfig $DEVICE up; let ret=$ret+$? fi + + if [ -n "$IPV6ADDR" ]; then + # configure IPv6 address(es) + echo -n " [IPv6]" + for v6addr in $IPV6ADDR; do + ifconfig $DEVICE inet6 add $v6addr; let ret=$ret+$? + done + fi + + # evaluate combined result + test $ret -eq 0 evaluate_retval fi @@ -254,6 +272,22 @@ fi done fi + + # IPv6 routing can be done with link-local addresses even without explicit address configuration + if [ -n "$IPV6ROUTE" ]; then + for route_info in ${IPV6ROUTE} ; do + destination=$(echo $route_info | cut -f1 -d\|) + gateway=$(echo $route_info | cut -f2 -d\|) + + # filter bogus records + test -z "$destination" && continue + + # add the route + echo " adding route to $destination ${gateway:+ via gateway $gateway} on $DEVICE" + ip -f inet6 route add $destination ${gateway:+via $gateway} dev $DEVICE + done + fi + fi } @@ -376,10 +410,24 @@ echo "please set it in the interface configuration file" fi - # enable IP Routing - if [ "$START_ROUTING" = "yes" ]; then - echo -n "Enable Routing" - echo "1" > /proc/sys/net/ipv4/ip_forward + # enable IPv4 and/or IPv6 Routing + if [ "$START_ROUTING" = "yes" -o "$START_IPV6_ROUTING" = "yes" ]; then + echo -n "Enabling Routing" + + if [ "$START_ROUTING" = "yes" ]; then + echo -n " [IPv4]" + echo "1" > /proc/sys/net/ipv4/ip_forward + fi + + if [ "$START_IPV6_ROUTING" = "yes" ]; then + echo -n " [IPv6]" + # when routing IPv6 with link-local addresses only, we + # have to explicitely load the ipv6 module before enabling + # routing + modprobe ipv6 + echo "1" > /proc/sys/net/ipv6/conf/all/forwarding + fi + print_status success fi |