summaryrefslogtreecommitdiff
path: root/debian/network/if-post-down.d/vlan
blob: 4d5afe754e3010d24d8d4fe03cacad2083b87096 (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
#!/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*|em*.0*|p[0-9]*.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/;s/\(em[0-9][0-9]*\)\..*/\1/;s/\(p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[0-9][0-9]*\)\?\)\..*/\1/"`
  ;;
  eth*.*|bond*.*|wlan*.*|em*.*|p[0-9]*.*)
    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/;s/\(em[0-9][0-9]*\)\..*/\1/;s/\(p[0-9][0-9]*\(p[0-9][0-9]*\)\?\(_[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