#!/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.
{
# 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]+)")