2 # Copyright (C) 2011 OpenWrt.org
4 . /usr/share/libubox/jshn.sh
8 for ifobj in `ubus list network.interface.\*`; do
9 interface="${ifobj##network.interface.}"
11 json_load "$(ifstatus $interface)"
12 json_get_var ifdev device
13 json_get_var ifl3dev l3_device
14 if [[ "$device" = "$ifdev" ]] || [[ "$device" = "$ifl3dev" ]]; then
30 local _data="$(ubus call "$1" "$2")"
31 [ $? -ne 0 ] && return "$?"
41 config_get type "$config" type
42 config_get ifname "$config" ifname
43 config_get device "$config" device "$ifname"
44 [ "bridge" = "$type" ] && ifname="br-$config"
45 config_set "$config" device "$ifname"
46 ubus_call "network.interface.$config" status
47 json_get_var l3dev l3_device
48 [ -n "$l3dev" ] && ifname="$l3dev"
50 config_set "$config" ifname "$ifname"
51 config_set "$config" device "$device"
56 config_foreach fixup_interface interface
59 prepare_interface_bridge() {
62 [ -n "$config" ] || return 0
63 ubus call network.interface."$config" prepare
70 [ -n "$config" ] || return 0
71 ubus call network.interface."$config" add_device "{ \"name\": \"$iface\" }"
76 sysctl -n -e -w "$1=$2" >/dev/null || \