summaryrefslogtreecommitdiff
path: root/package/base-files/files
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-05-28 03:24:56 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-05-28 03:24:56 +0000
commit7de192f60d4d02f5921f7eb499be348dc3f15948 (patch)
tree3ee31bde6e283ca4ad8fafe402ce080f5f0607a3 /package/base-files/files
parente1df4ecd688e96c5e0d0f4a98aa500b50ca358f9 (diff)
[package] base-files: add network_get_device() to network.sh
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31937 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/base-files/files')
-rw-r--r--package/base-files/files/lib/functions/network.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh
index 1b42133ba2..159da09a0d 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -39,3 +39,18 @@ network_get_ipaddr6() { __network_ipaddr "$1" "$2" 6 0; }
network_get_subnet() { __network_ipaddr "$1" "$2" 4 1; }
network_get_subnet6() { __network_ipaddr "$1" "$2" 6 1; }
+
+
+network_get_device()
+{
+ local __var="$1"
+ local __iface="$2"
+
+ local __tmp="$(ubus call network.interface."$__iface" status 2>/dev/null)"
+ [ -n "$__tmp" ] || return 1
+
+ json_load "$__tmp"
+ json_get_var "$__var" device
+
+ return 0
+}