]> git.pld-linux.org Git - projects/rc-scripts.git/blobdiff - lib/functions.network
If an iface type is specified NEVER override it
[projects/rc-scripts.git] / lib / functions.network
index 76be8d83d9a38ab3a60efa8b415c7bdde624c7b9..0543059fcbd06594d4389fd4f0fc3c6900dfe1f4 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]+)")
This page took 0.032886 seconds and 4 git commands to generate.