}
}
+# 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.
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
} || {
local ifname="$2"
config_get device "$1" device
- uci_set_state "network.$config.ifname=$ifname"
- uci_set_state "network.$config.device=$device"
+ uci_set_state network "$config" ifname "$ifname"
+ uci_set_state network "$config" device "$device"
}
setup_interface() {
[ -z "$ipaddr" ] || $DEBUG ifconfig "$iface" "$ipaddr" netmask "$netmask" broadcast "${bcast:-+}"
[ -z "$ip6addr" ] || $DEBUG ifconfig "$iface" add "$ip6addr"
- [ -z "$gateway" ] || $DEBUG route add default gw "$gateway"
- [ -z "$ip6gw" ] || $DEBUG route -A inet6 add default gw "$ip6gw"
+ [ -z "$gateway" ] || $DEBUG route add default gw "$gateway" dev "$iface"
+ [ -z "$ip6gw" ] || $DEBUG route -A inet6 add default gw "$ip6gw" dev "$iface"
[ -z "$dns" ] || {
for ns in $dns; do
grep "$ns" /tmp/resolv.conf.auto 2>/dev/null >/dev/null || {