From a8b4a9d667c0b07eea7cecddd87dabe35cc2dc74 Mon Sep 17 00:00:00 2001 From: Petr Lautrbach Date: Wed, 12 May 2010 14:00:11 +0200 Subject: use ip command for vlan instead of vconfig --- rc.d/init.d/network | 8 +------- sysconfig.txt | 3 +-- sysconfig/network-scripts/ifdown-eth | 4 ++-- sysconfig/network-scripts/ifup | 28 ++++++---------------------- 4 files changed, 10 insertions(+), 33 deletions(-) diff --git a/rc.d/init.d/network b/rc.d/init.d/network index cc218541..c64c7021 100755 --- a/rc.d/init.d/network +++ b/rc.d/init.d/network @@ -37,9 +37,6 @@ fi # Even if IPX is configured, without the utilities we can't do much [ ! -x /sbin/ipx_internal_net ] || [ ! -x /sbin/ipx_configure ] && IPX= -# Even if VLAN is configured, without the utility we can't do much -[ ! -x /sbin/vconfig ] && VLAN= - CWD=$(pwd) cd /etc/sysconfig/network-scripts @@ -82,10 +79,7 @@ case "$1" in case "$VLAN" in yes) - if [ -d /proc/net/vlan ] || modprobe 8021q >/dev/null 2>&1 ; then - test -z "$VLAN_NAME_TYPE" && VLAN_NAME_TYPE=DEV_PLUS_VID_NO_PAD - action $"Setting 802.1Q VLAN parameters: " /sbin/vconfig set_name_type "$VLAN_NAME_TYPE" - else + if [ ! -d /proc/net/vlan ] && ! modprobe 8021q >/dev/null 2>&1 ; then echo $"No 802.1Q VLAN support available in kernel." fi ;; diff --git a/sysconfig.txt b/sysconfig.txt index 875b84f0..6f64be63 100644 --- a/sysconfig.txt +++ b/sysconfig.txt @@ -714,8 +714,7 @@ Files in /etc/sysconfig/network-scripts/ Ethernet 802.1q VLAN items: DEVICE=eth0.42 - Initscripts use DEV_PLUS_VID_NO_PAD naming mode for VLAN - devices. + Initscripts use DEVICE for VLAN devices. Example: eth0.42 for vlan 42 on device eth0. Valid VLAN ID range is 0-4095. Most ethernet switches reserve VLAN ID 1 to be used as management VLAN; starting from VLAN diff --git a/sysconfig/network-scripts/ifdown-eth b/sysconfig/network-scripts/ifdown-eth index 3399ee3c..19fc1f12 100755 --- a/sysconfig/network-scripts/ifdown-eth +++ b/sysconfig/network-scripts/ifdown-eth @@ -138,12 +138,12 @@ if [ "$retcode" = 0 ] ; then # the interface went down. fi -if [ -n "$VLAN" ] && [ -x /sbin/vconfig ]; then +if [ -n "$VLAN" ]; then # 802.1q VLAN if echo ${DEVICE} | LANG=C grep -Ev '(:)' | LANG=C grep -Eq '(eth|bond)[0-9][0-9]*\.[0-9][0-9]?[0-9]?[0-9]?' \ || echo ${DEVICE} | LANG=C grep -Eq 'vlan[0-9][0-9]?[0-9]?[0-9]?' ; then [ -f /proc/net/vlan/${DEVICE} ] && { - /sbin/vconfig rem ${DEVICE} + ip link delete ${DEVICE} type vlan } fi fi diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index cc5efc97..c15d1d2a 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -71,7 +71,7 @@ if [ "$USE_NM" = "true" -a -n "$UUID" ]; then fi # Ethernet 802.1Q VLAN support -if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -x /sbin/vconfig ]; then +if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ]; then VID="" MATCH='^(eth|hsi|bond)[0-9]+\.[0-9]{1,4}$' if [[ "${DEVICE}" =~ $MATCH ]]; then @@ -96,9 +96,6 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -x /sbin/vconfig ]; then fi 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." - } is_available ${PHYSDEV} || { if [ "$?" = "1" ] ; then @@ -115,30 +112,17 @@ if [ "${VLAN}" = "yes" ] && [ "$ISALIAS" = "no" ] && [ -x /sbin/vconfig ]; then } if [ ! -f /proc/net/vlan/${DEVICE} ]; then - /sbin/vconfig add ${PHYSDEV} ${VID} || { + if [ "${REORDER_HDR}" = "no" -o "${REORDER_HDR}" = "0" ]; then + FLAG_REORDER_HDR="reorder_hdr off" + fi + + ip link add dev ${DEVICE} link ${PHYSDEV} type vlan id ${VID} ${FLAG_REORDER_HDR} || { (/usr/bin/logger -p daemon.info -t ifup \ $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" &)& echo $"ERROR: could not add vlan ${VID} as ${DEVICE} on dev ${PHYSDEV}" exit 1 } fi - - if [ -f /proc/net/vlan/${DEVICE} ]; then - case "$REORDER_HDR" in - yes|1) - /sbin/vconfig set_flag ${DEVICE} 1 1 || { - (/usr/bin/logger -p daemon.info -t ifup \ - "WARNING: vconfig not able to enable REORDER_HDR on ${DEVICE}" &)& - } - ;; - no|0) - /sbin/vconfig set_flag ${DEVICE} 1 0 || { - (/usr/bin/logger -p daemon.info -t ifup \ - $"WARNING: vconfig not able to disable REORDER_HDR on ${DEVICE}" &)& - } - ;; - esac - fi fi fi -- cgit v1.2.1