base-files: use json_is_a() in network.sh
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 17 Dec 2012 13:07:42 +0000 (13:07 +0000)
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Mon, 17 Dec 2012 13:07:42 +0000 (13:07 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34733 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/base-files/Makefile
package/base-files/files/lib/functions/network.sh

index 6452a3e..ec69e0c 100644 (file)
@@ -11,7 +11,7 @@ include $(INCLUDE_DIR)/kernel.mk
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
 include $(INCLUDE_DIR)/version.mk
 
 PKG_NAME:=base-files
-PKG_RELEASE:=121
+PKG_RELEASE:=122
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host
 
 PKG_FILE_DEPENDS:=$(PLATFORM_DIR)/ $(GENERIC_PLATFORM_DIR)/base-files/
 PKG_BUILD_DEPENDS:=opkg/host
index d242abb..424965a 100644 (file)
@@ -39,11 +39,11 @@ __network_parse_ifstatus()
                # parse addresses
                local __family
                for __family in 4 6; do
                # 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"
 
 
                                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
 
                                        json_select 1
                                        __network_set_cache "${__key}_address${__family}" address
@@ -58,12 +58,12 @@ __network_parse_ifstatus()
                done
 
                # parse routes
                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
 
                        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
 
                                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
                # 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=""
 
 
                                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"
 
                                        json_get_var __tmp "$((__idx++))"
                                        __dns="${__dns:+$__dns }$__tmp"
@@ -118,7 +118,7 @@ __network_parse_ifstatus()
                done
 
                # descend into inactive table
                done
 
                # descend into inactive table
-               json_get_type __tmp "inactive" && [ "$__tmp" = object ] && json_select "inactive"
+               json_is_a "inactive" object && json_select "inactive"
 
        done
 
 
        done