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 config_get device
"$config" device
"$ifname"
45 [ "bridge" = "$type" ] && ifname
="br-$config"
46 config_set
"$config" device
"$ifname"
47 ubus_call
"network.interface.$config" status ||
return 0
48 json_get_var l3dev l3_device
49 [ -n "$l3dev" ] && ifname
="$l3dev"
51 config_set
"$config" ifname
"$ifname"
52 config_set
"$config" device
"$device"
57 config_foreach fixup_interface interface
60 prepare_interface_bridge
() {
63 [ -n "$config" ] ||
return 0
64 ubus call network.interface.
"$config" prepare
71 [ -n "$config" ] ||
return 0
72 ubus call network.interface.
"$config" add_device
"{ \"name\": \"$iface\" }"
77 sysctl
-n -e -w "$1=$2" >/dev
/null || \