2 # Copyright (C) 2011 OpenWrt.org
4 .
/usr
/share
/libubox
/jshn.sh
8 local ifdev ifl3dev ifobj
9 for ifobj
in `ubus list network.interface.\*`; do
10 interface
="${ifobj##network.interface.}"
12 json_load
"$(ifstatus $interface)"
13 json_get_var ifdev device
14 json_get_var ifl3dev l3_device
15 if [[ "$device" = "$ifdev" ]] ||
[[ "$device" = "$ifl3dev" ]]; then
31 local _data
="$(ubus -S call "$1" "$2")"
32 [ -z "$_data" ] && return 1
40 local ifname
type device l3dev
42 config_get
type "$config" type
43 config_get ifname
"$config" ifname
44 [ "bridge" = "$type" ] && ifname
="br-$config"
45 ubus_call
"network.interface.$config" status ||
return 0
46 json_get_var l3dev l3_device
47 [ -n "$l3dev" ] && ifname
="$l3dev"
49 config_set
"$config" ifname
"$ifname"
54 config_foreach fixup_interface interface
57 prepare_interface_bridge
() {
60 [ -n "$config" ] ||
return 0
61 ubus call network.interface.
"$config" prepare
68 [ -n "$config" ] ||
return 0
69 ubus call network.interface.
"$config" add_device
"{ \"name\": \"$iface\" }"
74 sysctl
-n -e -w "$1=$2" >/dev
/null || \