summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/network/if-post-down.d/01-bridge
blob: 47f3c976be824b8ce5352dd938f0dbe255809496 (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
#!/bin/sh
  
if [ ! -x /usr/sbin/brctl ]
then
  exit 0
fi

case "$IF_BRIDGE_PORTS" in
    "")
        exit 0
        ;;
    none)
        INTERFACES=""
        ;;
    *)
        INTERFACES="$IF_BRIDGE_PORTS"
        ;;
esac
  
for IF in $INTERFACES; do
  ip link set down dev $IF && brctl delif $IFACE $IF
done

ip link set down dev $IFACE || exit 1
brctl delbr $IFACE
exit 0