diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-17 13:07:42 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-12-17 13:07:42 +0000 |
commit | 3339316fbe5f223522399a21ef8c655c77e27cf4 (patch) | |
tree | 860c5bb87344ce79b4fa7545e36752f3f4290480 /package/base-files/files/lib | |
parent | e0ad41ead8d5506159112d07c12a838d8f93174f (diff) | |
download | mtk-20170518-3339316fbe5f223522399a21ef8c655c77e27cf4.zip mtk-20170518-3339316fbe5f223522399a21ef8c655c77e27cf4.tar.gz mtk-20170518-3339316fbe5f223522399a21ef8c655c77e27cf4.tar.bz2 |
base-files: use json_is_a() in network.sh
SVN-Revision: 34733
Diffstat (limited to 'package/base-files/files/lib')
-rw-r--r-- | package/base-files/files/lib/functions/network.sh | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh index d242abb..424965a 100644 --- a/package/base-files/files/lib/functions/network.sh +++ b/package/base-files/files/lib/functions/network.sh @@ -39,11 +39,11 @@ __network_parse_ifstatus() # parse addresses local __family for __family in 4 6; do - if json_get_type __tmp "ipv${__family}_address" && [ "$__tmp" = array ]; then + if json_is_a "ipv${__family}_address" array; then json_select "ipv${__family}_address" - if json_get_type __tmp 1 && [ "$__tmp" = object ]; then + if json_is_a 1 object; then json_select 1 __network_set_cache "${__key}_address${__family}" address @@ -58,12 +58,12 @@ __network_parse_ifstatus() done # parse routes - if json_get_type __tmp route && [ "$__tmp" = array ]; then + if json_is_a route array; then json_select "route" local __idx=1 - while json_get_type __tmp "$__idx" && [ "$__tmp" = object ]; do + while json_is_a "$__idx" object; do json_select "$((__idx++))" json_get_var __tmp target @@ -88,14 +88,14 @@ __network_parse_ifstatus() # parse dns info local __field for __field in "dns_server" "dns_search"; do - if json_get_type __tmp "$__field" && [ "$__tmp" = array ]; then + if json_is_a "$__field" array; then json_select "$__field" local __idx=1 local __dns="" - while json_get_type __tmp "$__idx" && [ "$__tmp" = string ]; do + while json_is_a "$__idx" string; do json_get_var __tmp "$((__idx++))" __dns="${__dns:+$__dns }$__tmp" @@ -118,7 +118,7 @@ __network_parse_ifstatus() done # descend into inactive table - json_get_type __tmp "inactive" && [ "$__tmp" = object ] && json_select "inactive" + json_is_a "inactive" object && json_select "inactive" done |