1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 16:43:09 +02:00

[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
This commit is contained in:
jow 2012-05-28 03:24:56 +00:00
parent e1df4ecd68
commit 7de192f60d

View File

@ -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
}