From 0b32aa5b7c6968b12113a82093430b933215b2a6 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Wed, 30 Mar 2005 16:48:29 +0000 Subject: handle alternate VLAN naming schemes (#115001) --- sysconfig/network-scripts/ifup | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'sysconfig/network-scripts/ifup') diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index fc4d9a32..53e519b0 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -59,10 +59,28 @@ fi # Ethernet 802.1Q VLAN support if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then - if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' ; then + VID="" + if echo ${DEVICE} | LANG=C egrep -v '(:)' | 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*//'`" + # 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 if [ ! -d /proc/net/vlan ]; then if modprobe 8021q >/dev/null 2>&1 ; then - /sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD >/dev/null 2>&1 || { + test -z "$VLAN_NAME_TYPE" && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD + /sbin/vconfig set_name_type "$VLAN_NAME_TYPE" >/dev/null 2>&1 || { echo $"Could not set 802.1Q VLAN parameters." } else @@ -70,12 +88,6 @@ if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then exit 1 fi fi - 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'`" is_available ${PHYSDEV} || { if [ "$?" = "1" ] ; then -- cgit v1.2.1