From 368d19d31a057bf4d82ba428629694618edce133 Mon Sep 17 00:00:00 2001 From: Lukas Nykryn Date: Thu, 5 Jun 2014 16:00:59 +0200 Subject: custom naming for VLAN devices --- sysconfig/network-scripts/ifup | 37 ++++++++++++++++++++++--------------- 1 file 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 -- cgit v1.2.1