aboutsummaryrefslogtreecommitdiffstats
path: root/sysconfig/network-scripts
diff options
context:
space:
mode:
Diffstat (limited to 'sysconfig/network-scripts')
-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