diff options
author | Bill Nottingham <notting@redhat.com> | 2003-01-31 21:28:49 +0000 |
---|---|---|
committer | Bill Nottingham <notting@redhat.com> | 2003-01-31 21:28:49 +0000 |
commit | ff69fd0f08a9e0d9c28a3345076dd947e1de6bf2 (patch) | |
tree | 28aed9a16cd4d9890d268fa039bdf1e03796ef70 /sysconfig/network-scripts/ifup | |
parent | 8c3dbdebbec6c2eb636b8a5654a5adbb99592716 (diff) | |
download | initscripts-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/network-scripts/ifup')
-rwxr-xr-x | sysconfig/network-scripts/ifup | 59 |
1 files changed, 59 insertions, 0 deletions
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 |