From 6d46cedaad0acbdb6dd650f7c7d19af4b19d3bff Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Tue, 4 Feb 2003 02:19:20 +0000 Subject: vlan fixes () --- rc.d/init.d/network | 2 +- sysconfig/network-scripts/ifdown | 3 +-- sysconfig/network-scripts/ifup | 25 ++++++++++++++----------- 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/rc.d/init.d/network b/rc.d/init.d/network index fc8237b8..8ead14f9 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -82,7 +82,7 @@ case "$1" in esac case "$VLAN" in - yes|true) + yes) if [ -d /proc/net/vlan ] || modprobe 8021q >/dev/null 2>&1 ; then action $"Setting 802.1Q VLAN parameters: " /sbin/vconfig set_name_type DEV_PLUS_VID_NO_PAD else diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 29fb9674..c16f251f 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -46,7 +46,7 @@ fi . /etc/sysconfig/network # Check to make sure the device is actually up -check_device_down ${DEVICE} && [ "$BOOTPROTO" != "dhcp" -a "$BOOTPROTO" != "bootp" ] && exit 0 +check_device_down ${DEVICE} && [ "$BOOTPROTO" != "dhcp" -a "$BOOTPROTO" != "bootp" ] && [ -n "$VLAN" -a "$VLAN" != "yes" ] && exit 0 if [ -n "${HWADDR}" ]; then FOUNDMACADDR=`LC_ALL= LANG= ip -o link show ${REALDEVICE} | \ @@ -127,7 +127,6 @@ if [ -n "$VLAN" -a -x /sbin/vconfig ]; then if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q 'eth[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' ; then [ -f /proc/net/vlan/${DEVICE} ] && { /sbin/vconfig rem ${DEVICE} - retcode=$? } fi fi diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index b54abe43..73e4e805 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -62,17 +62,19 @@ else ISALIAS=no fi +# Ethernet 802.1Q VLAN support if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then - # 802.1q VLAN if echo ${DEVICE} | LANG=C egrep -v '(:)' | LANG=C egrep -q 'eth[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' ; then - [ -d /proc/net/vlan ] || modprobe 8021q >/dev/null 2>&1 || { - echo $"No 802.1Q VLAN support available in kernel." - echo $"Error initializing device ${DEVICE}" - logger -p daemon.info -t ifup \ - $"No 802.1Q VLAN support available in kernel for device ${DEVICE}" - exit 1 - } - + 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 || { + echo $"Could not set 802.1Q VLAN parameters." + } + else + echo $"No 802.1Q VLAN support available in kernel for device ${DEVICE}" + exit 1 + fi + fi VID="`echo ${DEVICE} | \ LANG=C egrep 'eth[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \ LANG=C sed 's/^[a-z0-9]*\.//g;s/^0*//'`" @@ -90,8 +92,9 @@ if [ -x /sbin/vconfig -a "${VLAN}" = "yes" ]; then } # Link on Physical device needs to be up but no ip required - ip addr add 0.0.0.0/32 dev ${PHYSDEV} - ip -o link set dev ${PHYSDEV} up + check_device_down ${PHYSDEV} && { + ip -o link set dev ${PHYSDEV} up + } if [ ! -f /proc/net/vlan/${DEVICE} ]; then /sbin/vconfig add ${PHYSDEV} ${VID} || { -- cgit v1.2.1