aports/main/vlan/vlan.post-down
2012-03-15 13:35:13 +00:00

28 lines
704 B
Bash

#!/bin/sh
# If IFACE is an automagic vlan interface (without the vlan-raw-device
# parameter) then let's try to discover the magic here.. Another way would be
# to just probe for the right device name in /proc/net/vlan
case "$IFACE" in
*#*) exit 0 ;;
*:*) exit 0 ;;
vlan*.*) exit 0 ;;
vlan*) VLAN_ID="${IFACE#vlan}" NAME1=VLAN;;
*.*) RAW_DEVICE="${IFACE%.*}"; VLAN_ID="${IFACE##*.}" NAME1=DEV;;
*) [ -n "${IF_VLAN_ID}" -o -n "${IF_VLAN_RAW_DEVICE}" ] || exit 0 ;;
esac
if [ -n "$IF_VLAN_RAW_DEVICE" ]; then
RAW_DEVICE="$IF_VLAN_RAW_DEVICE"
fi
if [ -n "$IF_VLAN_ID" ]; then
VLAN_ID="$IF_VLAN_ID"
fi
if [ -n "${RAW_DEVICE}" -o -n "${VLAN_ID}" ]
then
vconfig rem "${IFACE}"
fi