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 if [[ "$device" = "$ifdev" ]]; then
29 local _data="$(ubus call "$1" "$2")"
30 [ $? -ne 0 ] && return "$?"
40 config_get type "$config" type
41 config_get ifname "$config" ifname
42 config_get device "$config" device "$ifname"
43 [ "bridge" = "$type" ] && ifname="br-$config"
44 config_set "$config" device "$ifname"
45 ubus_call "network.interface.$config" status
46 json_get_var l3dev l3_device
47 [ -n "$l3dev" ] && ifname="$l3dev"
49 config_set "$config" ifname "$ifname"
50 config_set "$config" device "$device"
55 config_foreach fixup_interface interface
58 prepare_interface_bridge() {
61 [ -n "$config" ] || return 0
62 ubus call network.interface."$config" prepare
69 [ -n "$config" ] || return 0
70 ubus call network.interface."$config" add_device "{ \"name\": \"$iface\" }"
75 sysctl -n -e -w "$1=$2" >/dev/null || \