diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-07-30 05:22:02 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-07-30 05:22:02 +0000 |
commit | cb1328bacfe419b5e60a94004e1cb558d404a440 (patch) | |
tree | b823950ab119e11d8eba7950e520da61ffeac3ab /package/base-files | |
parent | 765f1fa69073d6fb9ebb9a0ee1516aa840dadba2 (diff) | |
download | upstream-cb1328bacfe419b5e60a94004e1cb558d404a440.tar.gz upstream-cb1328bacfe419b5e60a94004e1cb558d404a440.tar.bz2 upstream-cb1328bacfe419b5e60a94004e1cb558d404a440.zip |
properly keep track of bridged interfaces in the network state
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@12004 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files')
-rwxr-xr-x | package/base-files/files/lib/network/config.sh | 17 |
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 7fa1d37e49..3d58c63f78 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 } || { |