aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig
diff options
context:
space:
mode:
authorBill Nottingham <notting@redhat.com>2003-01-31 21:28:49 +0000
committerBill Nottingham <notting@redhat.com>2003-01-31 21:28:49 +0000
commitff69fd0f08a9e0d9c28a3345076dd947e1de6bf2 (patch)
tree28aed9a16cd4d9890d268fa039bdf1e03796ef70 /sysconfig
parent8c3dbdebbec6c2eb636b8a5654a5adbb99592716 (diff)
downloadinitscripts-ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2.tar
initscripts-ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2.tar.gz
initscripts-ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2.tar.bz2
initscripts-ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2.tar.xz
initscripts-ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2.zip
802.1Q VLAN support (<tis@foobar.fi>, #82593)r7-05
Diffstat (limited to 'sysconfig')
-rwxr-xr-xsysconfig/network-scripts/ifdown10
-rwxr-xr-xsysconfig/network-scripts/ifup59
2 files changed, 69 insertions, 0 deletions
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