1b42133ba2379b5eca81e6b9615ed3a01df200b8
1 .
/usr
/share
/libubox
/jshn.sh
8 local __prefix
="${4:-0}"
10 local __tmp
="$(ubus call network.interface."$__iface" status 2>/dev/null)"
12 json_load
"${__tmp:-{}}"
13 json_get_type __tmp
"ipv${__family}_address"
15 if [ "$__tmp" = array
]; then
17 json_select
"ipv${__family}_address"
20 if [ "$__tmp" = object
]; then
23 json_get_var
$__var address
25 [ $__prefix -gt 0 ] && {
26 json_get_var __tmp mask
27 eval "export -- \"$__var=\${$__var}/$__tmp\""
37 network_get_ipaddr
() { __network_ipaddr
"$1" "$2" 4 0; }
38 network_get_ipaddr6
() { __network_ipaddr
"$1" "$2" 6 0; }
40 network_get_subnet
() { __network_ipaddr
"$1" "$2" 4 1; }
41 network_get_subnet6
() { __network_ipaddr
"$1" "$2" 6 1; }