|
From: Friedrich L. <fl...@fl...> - 2004-01-30 22:34:04
|
Hi Arnaud!
Arnaud Gomes-do-Vale wrote on 20.01.2004 11:53 MET:
>
> Here is the second part of my patch for 1.0.x, namely IPv6
> support. Same as the previous one, it has not been heavily tested but
> it should work.
>
I have reworked your patch for 1.1.x. Can you please test it
since I have no IPv6 network up and running.
PS: Please create a sample config file ifcfg-eth5.sample where you
add the IPv6 stuff and don't forget to add enought comments. THX.
Index: config/etc/init.d/network
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/init.d/network,v
retrieving revision 1.27
diff -u -r1.27 network
--- config/etc/init.d/network 31 Dec 2003 21:26:53 -0000 1.27
+++ config/etc/init.d/network 30 Jan 2004 22:27:07 -0000
@@ -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
@@ -249,6 +267,22 @@
route add -$CMD ${target} ${netmask:+netmask $netmask} ${gateway:+gw $gateway} dev $DEVICE
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
}
@@ -371,10 +405,27 @@
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
+ # set up default gateways for IPv6 (FIXME: should probably be done in the interface config file)
+ if [ -n "$DEFAULTIPV6GATEWAY" -a -n "$DEFAULTIPV6GATEWAY_IF" ]; then
+ echo -n "Setting up routing for $DEFAULTIPV6GATEWAY_IF interface"
+ ip -f inet6 route add ::/0 via $DEFAULTIPV6GATEWAY dev $DEFAULTIPV6GATEWAY_IF
+ evaluate_retval
+ fi
+
+ # 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]"
+ echo "1" > /proc/sys/net/ipv6/conf/all/forwarding
+ fi
+
print_status success
fi
Index: config/etc/sysconfig/config
===================================================================
RCS file: /cvsroot/devil-linux/build/config/etc/sysconfig/config,v
retrieving revision 1.20
diff -u -r1.20 config
--- config/etc/sysconfig/config 30 Dec 2003 18:43:56 -0000 1.20
+++ config/etc/sysconfig/config 30 Jan 2004 22:27:07 -0000
@@ -12,10 +12,14 @@
HOSTNAME=Devil
DOMAIN=devil-linux.org
+#DEFAULTIPV6GATEWAY=3ffe:1:2::1
# enable routing -> yes/no
START_ROUTING=yes
+# enable IPv6 routing -> yes/no
+START_IPV6_ROUTING=yes
+
# Start the firewall script -> yes/no
START_FIREWALL=yes
--
MfG / Regards
Friedrich Lobenstock
____________________________________________________________________
Friedrich Lobenstock Linux Services Lobenstock
URL: http://www.lsl.at/ Email: fl...@fl...
____________________________________________________________________
|