diff options
author | Lukas Nykryn <lnykryn@redhat.com> | 2014-06-05 16:00:59 +0200 |
---|---|---|
committer | Lukas Nykryn <lnykryn@redhat.com> | 2014-09-09 13:57:08 +0200 |
commit | 368d19d31a057bf4d82ba428629694618edce133 (patch) | |
tree | 8b2cbe24dcf46ee2f5abd8c16713f9dc072cadcd | |
parent | bc4029e7e289cfe1c8b3deb2c1a68253635aa9ae (diff) | |
download | initscripts-368d19d31a057bf4d82ba428629694618edce133.tar initscripts-368d19d31a057bf4d82ba428629694618edce133.tar.gz initscripts-368d19d31a057bf4d82ba428629694618edce133.tar.bz2 initscripts-368d19d31a057bf4d82ba428629694618edce133.tar.xz initscripts-368d19d31a057bf4d82ba428629694618edce133.zip |
custom naming for VLAN devices
-rwxr-xr-x | sysconfig/network-scripts/ifup | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 278fde39..072b03f6 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -75,21 +75,28 @@ if [ "$_use_nm" = "true" -a -n "$UUID" ]; then fi # Ethernet 802.1Q VLAN support -if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then - VID="" - MATCH='^.+\.[0-9]{1,4}$' - if [[ "${DEVICE}" =~ $MATCH ]]; then - VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^.*\.\([0-9]\+\)/\1/') - PHYSDEV=${DEVICE%.*} - fi - MATCH='^vlan[0-9]{1,4}?' - if [[ "${DEVICE}" =~ $MATCH ]]; then - VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//') - # PHYSDEV should be set in ifcfg-vlan* file - if test -z "$PHYSDEV"; then - net_log $"PHYSDEV should be set for device ${DEVICE}" - exit 1 - fi +if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -n $DEVICE ]; then + if [ -n ${VID} ]; then + if test -z "$PHYSDEV"; then + net_log $"PHYSDEV should be set for device ${DEVICE}" + exit 1 + fi + else + VID="" + MATCH='^.+\.[0-9]{1,4}$' + if [[ "${DEVICE}" =~ $MATCH ]]; then + VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^.*\.\([0-9]\+\)/\1/') + PHYSDEV=${DEVICE%.*} + fi + MATCH='^vlan[0-9]{1,4}?' + if [[ "${DEVICE}" =~ $MATCH ]]; then + VID=$(echo "${DEVICE}" | LC_ALL=C sed 's/^vlan0*//'): + # PHYSDEV should be set in ifcfg-vlan* file + if test -z "$PHYSDEV"; then + net_log $"PHYSDEV should be set for device ${DEVICE}" + exit 1 + fi + fi fi if [ -n "$VID" ]; then if [ ! -d /proc/net/vlan ]; then |