]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - lib/functions.network
Onlink doesn't work for IPv6, so add gate route manually first.
[projects/rc-scripts.git] / lib / functions.network
index 76be8d83d9a38ab3a60efa8b415c7bdde624c7b9..d151b04ecc567879b896fea3eaae1cb4dd6fd9e0 100644 (file)
@@ -1,6 +1,5 @@
 #!/bin/sh - keep it for file(1) to get bourne shell script result
 #
-# $Id$
 #
 # This is not a shell script; it provides functions to network scripts
 # that source it.
@@ -183,13 +182,14 @@ setup_ip_param ()
 {
        # detect network device type (ie. dummy, eth for dummy0, eth0 ..)
        if [ -z "$DEVICETYPE" ]; then
-               DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[\.:]?[0-9]*[\.:]?[0-9]*$/,NUL); print $0 } ')
+               # If there's a dot, it's a vlan
+               if echo ${DEVICE} | LC_ALL=C grep -qE '^[a-z0-9]+\.[0-9]+$'; then
+                       DEVICETYPE=vlan
+               else
+                       DEVICETYPE=$(echo $DEVICE | awk ' { gsub(/[\.:]?[0-9]*[\.:]?[0-9]*$/,NUL); print $0 } ')
+               fi
        fi
 
-       # Setup DEVICETYPE for special cases.
-       if echo ${DEVICE} | LC_ALL=C grep -qE '^[a-z0-9]+\.[0-9]+$'; then
-               DEVICETYPE=vlan
-       fi
 
        # real name of device (ie. is eth0 for eth0,eth0:1,eth0:alias)
        SUBDEVICE=$(echo "$DEVICE" | grep -E "([0-9]+:[0-9]+)")
@@ -232,11 +232,11 @@ setup_ip_param ()
        esac
 
        # Multicast ready devices
-       if is_yes "$MULTICAST"; then
-               MULTICAST="on"
+       if [ -n "$MULTICAST" ]; then
+               MULTICAST="$MULTICAST"
        else
                case "$DEVICETYPE" in
-                 eth|br)
+                 eth|br|vlan)
                        MULTICAST="on"
                        ;;
                  *)
@@ -299,6 +299,7 @@ setup_ip_gw_ro ()
                if [ -z "${IPV6_GLOBALROUTEDEV}" -o "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then
                        # set up default route
                        if [ "${IPV6_GLOBALROUTEGW}" ]; then
+                               ip -6 route add ${IPV6_GLOBALROUTEGW} dev ${DEVICE} ${IP6SRCADDR} onlink
                                ip -6 route add 2000::/3 via ${IPV6_GLOBALROUTEGW} dev ${DEVICE} ${IP6SRCADDR} onlink
                        elif [ "${IPV6_GLOBALROUTEDEV}" = "${DEVICE}" ]; then
                                ip -6 route add 2000::/3 dev ${DEVICE} ${IP6SRCADDR}
@@ -348,7 +349,6 @@ set_up_loopback()
                ip addr add 127.0.0.1/8 dev lo
        fi
        ip link set dev lo up
-       emit net-device-up IFACE=lo
 
        grep -E "^(lo|any)[[:blank:]]" /etc/sysconfig/static-routes | while read device args; do
                if [[ "$args" = *:* ]]; then
@@ -662,7 +662,6 @@ check_link_down ()
 
        if ! LC_ALL=C ip link show dev $device 2>/dev/null | grep -Fq UP; then
                ip link set dev $device up >/dev/null 2>&1
-               emit net-device-up IFACE=$device
        fi
        timeout=0
        while [ $timeout -le $max_timeout ]; do
This page took 0.211264 seconds and 4 git commands to generate.