summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2008-07-30 05:22:02 +0000
committerFelix Fietkau <nbd@openwrt.org>2008-07-30 05:22:02 +0000
commite606b1603bd65ac4ecf4e60d4ca20d5296f0ecee (patch)
tree11a99ee826fe9fed43c23aa9b6aba1641b36b3d0 /package
parentdf292e17b1f7e0dadbc95e1ede62fd2daeeda1c5 (diff)
downloadmtk-20170518-e606b1603bd65ac4ecf4e60d4ca20d5296f0ecee.zip
mtk-20170518-e606b1603bd65ac4ecf4e60d4ca20d5296f0ecee.tar.gz
mtk-20170518-e606b1603bd65ac4ecf4e60d4ca20d5296f0ecee.tar.bz2
properly keep track of bridged interfaces in the network state
SVN-Revision: 12004
Diffstat (limited to 'package')
-rwxr-xr-xpackage/base-files/files/lib/network/config.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/package/base-files/files/lib/network/config.sh b/package/base-files/files/lib/network/config.sh
index 7fa1d37..3d58c63 100755
--- a/package/base-files/files/lib/network/config.sh
+++ b/package/base-files/files/lib/network/config.sh
@@ -64,6 +64,16 @@ add_vlan() {
}
}
+# sort the device list, drop duplicates
+sort_list() {
+ local arg="$*"
+ (
+ for item in $arg; do
+ echo "$item"
+ done
+ ) | sort -u
+}
+
# Create the interface, if necessary.
# Return status 0 indicates that the setup_interface() call should continue
# Return status 1 means that everything is set up already.
@@ -94,6 +104,13 @@ prepare_interface() {
bridge)
[ -x /usr/sbin/brctl ] && {
ifconfig "br-$config" 2>/dev/null >/dev/null && {
+ local newdevs=
+
+ config_get devices "$config" device
+ for dev in $(sort_list "$devices" "$iface"); do
+ append newdevs "$dev"
+ done
+ uci_set_state network "$config" device "$newdevs"
$DEBUG brctl addif "br-$config" "$iface"
# Bridge existed already. No further processing necesary
} || {