]> git.pld-linux.org Git - projects/rc-scripts.git/commitdiff
- add static-routes6 support (IPv6-only ip routes and rules)
authorJan Rękorajski <baggins@pld-linux.org>
Mon, 21 Mar 2011 22:15:00 +0000 (22:15 +0000)
committerJan Rękorajski <baggins@pld-linux.org>
Mon, 21 Mar 2011 22:15:00 +0000 (22:15 +0000)
svn-id: @12211

doc/sysconfig.docb
doc/sysconfig.txt
sysconfig/Makefile.am
sysconfig/network-scripts/functions.network
sysconfig/network-scripts/ifup-routes

index bf57e99fed330152d61e4998cd888523f71bd64c..49065559dd42145dcfd35d036b9e91c62c7877c0 100644 (file)
     <para>For more informations see iproute2 documentation .</para>
   </refsect1>
 
+  <refsect1>
+    <title><filename>/etc/sysconfig/static-routes6</filename></title>
+    <para>Same as <filename>/etc/sysconfig/static-routes</filename> but
+      for IPv6.</para>
+  </refsect1>
+
   <refsect1>
     <title><filename>/etc/sysconfig/routed</filename></title>
     <simplelist>
index d396229862eae1a778cc07494a4f04e67bfafb00..d978da212f225911c6f776b46c0b35a3b02afb6a 100644 (file)
@@ -61,7 +61,7 @@ Files in /etc/sysconfig
 
   <device> may be a device name to have the route brought up and
   down with the device, or "any" to have the correct devices calculated
-  at run time. [type] is optional. RH style isn't supported !
+  at run time. [type] is optional. RH style isn't supported!
 
   Also you can set few options after "<gateway>":
     tos <tos>
@@ -77,7 +77,11 @@ Files in /etc/sysconfig
     protocol <rtproto>
     onlink
     equalize
-  For more informations see iproute2 documentation .
+  For more informations see iproute2 documentation.
+
+/etc/sysconfig/static-routes6:
+
+  Same as /etc/sysconfig/static-routes but for IPv6.
 
 /etc/sysconfig/routed:
 
index 0bf398d8b3b001689daad649999f52423f5364ab..67616bacf5a1f9dbf61d1e7f63033dccbf31ea82 100644 (file)
@@ -10,6 +10,7 @@ sysconfig_DATA = \
        system \
        network \
        static-routes \
+       static-routes6 \
        static-nat \
        static-arp \
        i18n
index d163aa8933f61ff45084caa9aae19aa86fe01c23..92684cd487e2451fe2a860e450607fe72cc3de7f 100644 (file)
@@ -327,6 +327,18 @@ setup_routes()
                        done
                fi
        fi
+       is_no "$IPV6_NETWORKING" && return
+       if [ -f /etc/sysconfig/static-routes6 ]; then
+               if [ "$1" = "on" -o "$1" = "yes" ]; then
+                       grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do
+                               /sbin/ip -6 route add $args
+                       done
+               else
+                       grep -E "^(none|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do
+                               /sbin/ip -6 route del $args 2>/dev/null
+                       done
+               fi
+       fi
 }
 
 # Add ONLY IPv4 address (IPv6 address is added automaticly)
@@ -344,6 +356,10 @@ set_up_loopback()
                fi
                /sbin/ip route add $args dev lo
        done
+       is_no "$IPV6_NETWORKING" && return
+       grep -E "^(lo|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do
+               /sbin/ip -6 route add $args dev lo
+       done
 }
 
 set_down_loopback()
@@ -460,7 +476,19 @@ setup_ip_rules ()
                        done
                elif is_no "$1"; then
                        LC_ALL=C /sbin/ip rule show | grep -vE -e "from all lookup (main|default|local) \$" -e " map-to " | while read prio from src args; do
-                               [ "$src" = "all" ] && ip rule delete $args || ip rule delete $from $src $args
+                               [ "$src" = "all" ] && /sbin/ip rule delete $args || /sbin/ip rule delete $from $src $args
+                       done
+               fi
+       fi
+       is_no "$IPV6_NETWORKING" && return
+       if [ -f /etc/sysconfig/static-routes6 ]; then
+               if is_yes "$1"; then
+                       grep -E "^(from|to|iif|tos|fwmark|dev|pref|priority|prio)[[:blank:]]" /etc/sysconfig/static-routes6 | while read args; do
+                               /sbin/ip -6 rule add $args
+                       done
+               elif is_no "$1"; then
+                       LC_ALL=C /sbin/ip -6 rule show | grep -vE -e "from all lookup (main|default|local) \$" -e " map-to " | while read prio from src args; do
+                               [ "$src" = "all" ] && /sbin/ip -6 rule delete $args || /sbin/ip -6 rule delete $from $src $args
                        done
                fi
        fi
index 93c887e90aaccdde1f129b95a5763b668a6f6ccf..d27c860524857a3950c9552d1c8eda1413206dbd 100644 (file)
@@ -5,7 +5,7 @@
 # Adds static routes which go through device $DEVICE
 # Called from ifup-post.
 
-if [ ! -f /etc/sysconfig/static-routes ]; then
+if [ ! -f /etc/sysconfig/static-routes -a ! -f /etc/sysconfig/static-routes6 ]; then
        return
 fi
 
@@ -23,6 +23,11 @@ grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-routes | while read de
        /sbin/ip route add $args dev $REALDEVICE
 done
 
+if ! is_no "$IPV6_NETWORKING"; then
+       grep -E "^($DEVICE|any)[[:blank:]]" /etc/sysconfig/static-routes6 | while read device args; do
+               /sbin/ip -6 route add $args dev $REALDEVICE
+       done
+fi
 
 # based on information from http://avahi.org/wiki/AvahiAutoipd#Routes
 if is_yes "$ZEROCONF" && ! /sbin/ip link show dev $REALDEVICE | grep -q POINTOPOINT ; then
This page took 0.045422 seconds and 4 git commands to generate.