summaryrefslogtreecommitdiff
path: root/debian/network/if-post-down.d/vlan
blob: 73e3dd9feaa03e688d3062642cf6287fc6040f4c (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
28
29
30
31
32
33
34
#!/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
  # Ignore any alias (#272891)
  *:*)
    exit 0
  ;;
  eth*.0*|bond*.0*|wlan*.0*)
    # Silently ignore interfaces which ifupdown handles on its own
    # If IF_BRIDGE_PORTS is set, probably we're called by bridge-utils
    [ -z "$IF_VLAN_RAW_DEVICE" -a -z "$IF_BRIDGE_PORTS" ] && exit 0
    IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/;s/\(bond[0-9][0-9]*\)\..*/\1/;s/\(wlan[0-9][0-9]*\)\..*/\1/"`
  ;;
  eth*.*|bond*.*|wlan*.*)
    # Silently ignore interfaces which ifupdown handles on its own
    # If IF_BRIDGE_PORTS is set, probably we're called by bridge-utils
    [ -z "$IF_VLAN_RAW_DEVICE" -a -z "$IF_BRIDGE_PORTS" ] && exit 0
    IF_VLAN_RAW_DEVICE=`echo $IFACE|sed "s/\(eth[0-9][0-9]*\)\..*/\1/;s/\(bond[0-9][0-9]*\)\..*/\1/;s/\(wlan[0-9][0-9]*\)\..*/\1/"`
  ;;
  # Test for vlan raw device (#196890, #292648)
  *)
    [ -z "$IF_VLAN_RAW_DEVICE" ] && exit 0
  ;;
esac

if [ ! -x /sbin/vconfig ]; then
    exit 0
fi

vconfig rem $IFACE