]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - sysconfig/network-scripts/functions.network
One more fix.
[projects/rc-scripts.git] / sysconfig / network-scripts / functions.network
index 6ab36748ccc056f42ba42aa82a0e0e639038a1c9..e4e3bd9f6417e303e3631ae46b6fb1ec1d89438b 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)
@@ -336,6 +348,18 @@ set_up_loopback()
                ip addr add 127.0.0.1/8 dev lo
        fi
        ip link set dev lo up
+       grep -E "^(lo|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
+               if [[ "$args" = *:* ]]; then
+                       is_no "$IPV6_NETWORKING" && continue
+               else
+                       is_no "$IPV4_NETWORKING" && continue
+               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()
@@ -346,8 +370,12 @@ set_down_loopback()
 
 modprobe_net()
 {
-       if is_yes "$IPV6_NETWORKING" && is_module "ipv6"; then
-               _modprobe single ipv6
+       if is_yes "$IPV6_NETWORKING"; then
+               if is_module "ipv6"; then
+                       _modprobe single ipv6
+               fi
+       elif [ -d /proc/sys/net/ipv6 ]; then
+               sysctl -w net.ipv6.conf.all.disable_ipv6=1
        fi
 
        if is_yes "$IPX" && is_module "ipx"; then
@@ -452,7 +480,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
@@ -598,19 +638,24 @@ check_iwconfig ()
 # 2 - unknown/unsupported
 check_link_down ()
 {
-       local e i m timeout
+       local e i m timeout device max_timeout
+       device="$1"
+       max_timeout="$2"
+
        if [ ! -x /sbin/mii-tool -a ! -x /sbin/ethtool -a ! -x /sbin/iwconfig ]; then
                return 2
        fi
 
-       if ! LC_ALL=C ip link show dev $1 2>/dev/null | grep -q UP; then
-               ip link set dev $1 up >/dev/null 2>&1
+       [ -z "$max_timeout" ] && max_timeout=6
+
+       if ! LC_ALL=C ip link show dev $device 2>/dev/null | grep -q UP; then
+               ip link set dev $device up >/dev/null 2>&1
        fi
        timeout=0
-       while [ $timeout -le 6 ]; do
-               check_ethtool $1
+       while [ $timeout -le $max_timeout ]; do
+               check_ethtool $device
                e=$?
-               check_iwconfig $1
+               check_iwconfig $device
                i=$?
                # trust ethtool and iwconfig
                if [ $i -eq 1 ] || [ $e -eq 1 ]; then
@@ -618,7 +663,7 @@ check_link_down ()
                fi
                # use mii check only if all other check are unsupported
                # (mii check lies too often)
-               check_mii_tool $1
+               check_mii_tool $device
                m=$?
                if [ $m -eq 1 ] && [ $i -eq 2 ] && [ $e -eq 2 ]; then
                        return 1
This page took 0.037671 seconds and 4 git commands to generate.