From ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2 Mon Sep 17 00:00:00 2001 From: Bill Nottingham Date: Fri, 31 Jan 2003 21:28:49 +0000 Subject: 802.1Q VLAN support (, #82593) --- sysconfig/network-scripts/ifdown | 10 +++++++ sysconfig/network-scripts/ifup | 59 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+) (limited to 'sysconfig') diff --git a/sysconfig/network-scripts/ifdown b/sysconfig/network-scripts/ifdown index 992fd5ae..29fb9674 100755 --- a/sysconfig/network-scripts/ifdown +++ b/sysconfig/network-scripts/ifdown @@ -122,4 +122,14 @@ if [ "$retcode" = 0 ] ; then # the interface went down. fi +if [ -n "$VLAN" -a -x /sbin/vconfig ]; 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 + [ -f /proc/net/vlan/${DEVICE} ] && { + /sbin/vconfig rem ${DEVICE} + retcode=$? + } + fi +fi + exit $retcode diff --git a/sysconfig/network-scripts/ifup b/sysconfig/network-scripts/ifup index 4f870d16..b54abe43 100755 --- a/sysconfig/network-scripts/ifup +++ b/sysconfig/network-scripts/ifup @@ -62,6 +62,65 @@ else ISALIAS=no fi +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 + } + + 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*//'`" + PHYSDEV="`echo ${DEVICE} | \ + LANG=C egrep 'eth[0-9]+\.[0-9][0-9]?[0-9]?[0-9]?$' | \ + LANG=C sed 's/\.[a-z0-9]*$//g'`" + + is_available ${PHYSDEV} || { + if [ "$?" = "1" ] ; then + echo $"$alias device ${DEVICE} does not seem to be present, delaying initialization." + exit 1 + else + exit 0 + fi + } + + # 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 + + if [ ! -f /proc/net/vlan/${DEVICE} ]; then + /sbin/vconfig add ${PHYSDEV} ${VID} || { + (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 || { + (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 || { + (logger -p daemon.info -t ifup \ + $"WARNING: vconfig not able to disable REORDER_HDR on ${DEVICE}" &)& + } + ;; + esac + fi + fi +fi + # Old BOOTP variable if [ "${BOOTP}" = "yes" ]; then BOOTPROTO=bootp -- cgit v1.2.1