aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files
diff options
context:
space:
mode:
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/lib/functions/network.sh14
1 files changed, 10 insertions, 4 deletions
diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh
index 08cce49df2..d7fd2dea57 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -6,10 +6,16 @@
__network_ifstatus() {
local __tmp
- [ -z "$__NETWORK_CACHE" ] && \
- export __NETWORK_CACHE="$(ubus call network.interface dump)"
-
- __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "$__NETWORK_CACHE" -e "$1=@.interface${2:+[@.interface='$2']}$3")"
+ [ -z "$__NETWORK_CACHE" ] && {
+ __tmp="$(ubus call network.interface dump 2>&1)"
+ case "$?" in
+ 4) : ;;
+ 0) export __NETWORK_CACHE="$__tmp" ;;
+ *) echo "$__tmp" >&2 ;;
+ esac
+ }
+
+ __tmp="$(jsonfilter ${4:+-F "$4"} ${5:+-l "$5"} -s "${__NETWORK_CACHE:-{}}" -e "$1=@.interface${2:+[@.interface='$2']}$3")"
[ -z "$__tmp" ] && \
unset "$1" && \