+
+ # parse dns info
+ local __field
+ for __field in "dns_server" "dns_search"; do
+ if json_get_type __tmp "$__field" && [ "$__tmp" = array ]; then
+
+ json_select "$__field"
+
+ local __idx=1
+ local __dns=""
+
+ while json_get_type __tmp "$__idx" && [ "$__tmp" = string ]; do
+
+ json_get_var __tmp "$((__idx++))"
+ __dns="${__dns:+$__dns }$__tmp"
+
+ done
+
+ json_select ".."
+
+ if [ -n "$__dns" ]; then
+ __network_set_cache "${__key}_${__field}" "" "$__dns"
+ fi
+ fi
+ done
+
+ # parse up state, device and physdev
+ for __field in "up" "l3_device" "device"; do
+ if json_get_type __tmp "$__field"; then
+ __network_set_cache "${__key}_${__field}" "$__field"
+ fi
+ done
+
+ # descend into inactive table
+ json_get_type __tmp "inactive" && [ "$__tmp" = object ] && json_select "inactive"
+
+ done
+
+ json_cleanup
+ json_set_namespace "$__old_ns"
+
+ return 0
+}
+
+
+__network_ipaddr()
+{
+ local __var="$1"
+ local __iface="$2"
+ local __family="$3"
+ local __prefix="$4"
+ local __tmp
+
+ __network_parse_ifstatus "$__iface" || return 1
+
+ if [ $__prefix -eq 1 ]; then
+ __network_export __tmp "${__iface}_mask${__family}" && \
+ __network_export "$__var" "${__iface}_address${__family}" "/$__tmp"
+ return $?