aboutsummaryrefslogtreecommitdiffstats
path: root/main/vlan/vlan.post-down
blob: bf887ef149c7d6d62c521e864d0cb66be05cef9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/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