diff options
author | Miloslav Trmac <mitr@volny.cz> | 2006-07-28 04:42:05 +0000 |
---|---|---|
committer | Miloslav Trmac <mitr@volny.cz> | 2006-07-28 04:42:05 +0000 |
commit | 10aa11e371b371c1a8840e90528bc7187555a62d (patch) | |
tree | 04ff3269275aa67aac43b329a6a2b0968b910e06 /sysconfig/network-scripts | |
parent | 7795bfc3de4bdf0bc1dbd24b4a12a0fbcbff4085 (diff) | |
download | initscripts-10aa11e371b371c1a8840e90528bc7187555a62d.tar initscripts-10aa11e371b371c1a8840e90528bc7187555a62d.tar.gz initscripts-10aa11e371b371c1a8840e90528bc7187555a62d.tar.bz2 initscripts-10aa11e371b371c1a8840e90528bc7187555a62d.tar.xz initscripts-10aa11e371b371c1a8840e90528bc7187555a62d.zip |
Simplify $DEVICE parsing to get VLAN info
Diffstat (limited to 'sysconfig/network-scripts')
-rwxr-xr-x | sysconfig/network-scripts/ifup | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index f9b7f51c..503b53c5 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -62,23 +62,19 @@ fi # Ethernet 802.1Q VLAN support if [ -x /sbin/vconfig -a "${VLAN}" = "yes" -a "$ISALIAS" = "no" ]; then VID="" - if echo ${DEVICE} | LANG=C egrep -q '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?'; then - VID="`echo ${DEVICE} | \ - LANG=C egrep '(eth|bond)[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \ - LANG=C sed 's/^[a-z0-9]*\.//g;s/^0*//'`" - PHYSDEV="`echo ${DEVICE} | \ - LANG=C egrep '(eth|bond)[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \ - LANG=C sed 's/\.[a-z0-9]*$//g'`" - fi - if echo ${DEVICE} | LANG=C egrep -q 'vlan[0-9][0-9]?[0-9]?[0-9]?'; then - VID="`echo ${DEVICE} | LANG=C sed 's/^vlan//;s/^0*//'`" + if [[ "${DEVICE}" =~ '^(eth|bond)[0-9]+\.[0-9]{1,4}$' ]]; then + VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^[a-z0-9]*\.0*//') + PHYSDEV=${DEVICE%.*} + fi + if [[ "${DEVICE}" =~ '^vlan[0-9]{1,4}?' ]]; then + VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//') # PHYSDEV should be set in ifcfg-vlan* file if test -z "$PHYSDEV"; then echo $"PHYSDEV should be set for device ${DEVICE}" exit 1 fi - fi - if [ -n "$VID" ]; then + fi + if [ -n "$VID" ]; then if [ ! -d /proc/net/vlan ]; then if modprobe 8021q >/dev/null 2>&1 ; then test -z "$VLAN_NAME_TYPE" && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD |