Author: radek
Date: Sat Oct 25 20:14:41 2008
New Revision: 9918

Modified:
   rc-scripts/trunk/doc/net-scripts.txt
   rc-scripts/trunk/sysconfig/interfaces/ifcfg-eth0
   rc-scripts/trunk/sysconfig/network-scripts/ifdown
   rc-scripts/trunk/sysconfig/network-scripts/ifup
Log:
- support for automatic 6to4 tunnels

Modified: rc-scripts/trunk/doc/net-scripts.txt
==============================================================================
--- rc-scripts/trunk/doc/net-scripts.txt        (original)
+++ rc-scripts/trunk/doc/net-scripts.txt        Sat Oct 25 20:14:41 2008
@@ -149,6 +149,9 @@
        IPV6_CP_PERSISTENT=yes|no
          use EUI-48 addresses as IPv6 addresses
        or by default use address specified by IP6_PRIM_IF and REMIP6
+    ENABLE_6TO4=yes|no
+      configure a 6to4 tunnel, if the interface has a public
+      (non-RFC1918) IPv4 address
     <anything>=<anything>
       Variable name and it's value for use by chat script.
       Note: You don't have to define variables here, if they are defined 

Modified: rc-scripts/trunk/sysconfig/interfaces/ifcfg-eth0
==============================================================================
--- rc-scripts/trunk/sysconfig/interfaces/ifcfg-eth0    (original)
+++ rc-scripts/trunk/sysconfig/interfaces/ifcfg-eth0    Sat Oct 25 20:14:41 2008
@@ -33,3 +33,6 @@
 
 # sane qdisc
 QDISC=sfq
+
+# configure a 6to4 tunnel?
+#ENABLE_6TO4=yes

Modified: rc-scripts/trunk/sysconfig/network-scripts/ifdown
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/ifdown   (original)
+++ rc-scripts/trunk/sysconfig/network-scripts/ifdown   Sat Oct 25 20:14:41 2008
@@ -59,6 +59,15 @@
        fi
 fi
 
+if is_yes "$ENABLE_6TO4"; then
+       tun6to4=tun6to4_$DEVICE 
+       /sbin/ip -6 route flush dev $tun6to4 2>/dev/null
+       if [ $? = 0 ]; then   # the tunnel has been set up in ifup
+               /sbin/ip link set dev $tun6to4 down
+               /sbin/ip tunnel del $tun6to4
+       fi
+fi
+
 if [ -n "$BOOTPROTO" -a "$BOOTPROTO" != "none" -a "$BOOTPROTO" != "static" ]; 
then
        if is_yes "$IPV4_NETWORKING"; then
                set_dhcpclient

Modified: rc-scripts/trunk/sysconfig/network-scripts/ifup
==============================================================================
--- rc-scripts/trunk/sysconfig/network-scripts/ifup     (original)
+++ rc-scripts/trunk/sysconfig/network-scripts/ifup     Sat Oct 25 20:14:41 2008
@@ -216,6 +216,27 @@
        /etc/sysconfig/network-scripts/ifup-ipx $DEVICE
 fi
 
+if is_yes "$ENABLE_6TO4"; then
+       # find an usable IPv4 address for this device; might have been obtained 
by dhcp or ppp
+       for ipv4 in `/sbin/ip addr show dev $DEVICE | awk '/ inet /{print $2}' 
| sed -e 's,/.*,,'`; do
+               if [   `ipcalc -n $ipv4/8`  != "NETWORK=10.0.0.0"    \
+                       -a `ipcalc -n $ipv4/12` != "NETWORK=172.16.0.0"  \
+                       -a `ipcalc -n $ipv4/24` != "NETWORK=192.168.0.0" \
+                       -a `ipcalc -n $ipv4/24` != "NETWORK=169.254.0.0" ]; then
+                       local_ipv4=$ipv4
+                       local_ipv6=`printf "2002:%02x%02x:%02x%02x::1" $(echo 
$ipv4 | tr . ' ')`
+                       break
+               fi
+       done
+       if [ -n "$local_ipv4" ]; then   # we have an usable IPv4 address; set 
up the tunnel
+               tun6to4=tun6to4_$DEVICE 
+               /sbin/ip tunnel add $tun6to4 mode sit ttl 128 remote any local 
$local_ipv4
+               /sbin/ip link set dev $tun6to4 up
+               /sbin/ip -6 addr  add $local_ipv6/16 dev $tun6to4
+               /sbin/ip -6 route add 2000::/3 via ::192.88.99.1 dev $tun6to4 
metric 1
+       fi
+fi
+
 if [ "$HANDLING" = "4" ]; then
        exit 0
 fi
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to