summaryrefslogtreecommitdiff
path: root/package/base-files/src/etc/network/if-post-down.d/01-bridge
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/src/etc/network/if-post-down.d/01-bridge')
-rwxr-xr-xpackage/base-files/src/etc/network/if-post-down.d/01-bridge26
1 files changed, 26 insertions, 0 deletions
diff --git a/package/base-files/src/etc/network/if-post-down.d/01-bridge b/package/base-files/src/etc/network/if-post-down.d/01-bridge
new file mode 100755
index 000000000..47f3c976b
--- /dev/null
+++ b/package/base-files/src/etc/network/if-post-down.d/01-bridge
@@ -0,0 +1,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