mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-11-24 02:19:23 +02:00
[package] base-files: let network_get_device() return the l3 interface, introduce network_get_physdev() to obtain the underlying iface (if applicable)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@31960 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
8c1c75ba17
commit
29377555bf
@ -41,16 +41,18 @@ network_get_subnet() { __network_ipaddr "$1" "$2" 4 1; }
|
|||||||
network_get_subnet6() { __network_ipaddr "$1" "$2" 6 1; }
|
network_get_subnet6() { __network_ipaddr "$1" "$2" 6 1; }
|
||||||
|
|
||||||
|
|
||||||
network_get_device()
|
__network_device()
|
||||||
{
|
{
|
||||||
local __var="$1"
|
local __var="$1"
|
||||||
local __iface="$2"
|
local __iface="$2"
|
||||||
|
local __field="$3"
|
||||||
|
|
||||||
local __tmp="$(ubus call network.interface."$__iface" status 2>/dev/null)"
|
local __tmp="$(ubus call network.interface."$__iface" status 2>/dev/null)"
|
||||||
[ -n "$__tmp" ] || return 1
|
[ -n "$__tmp" ] || return 1
|
||||||
|
|
||||||
json_load "$__tmp"
|
json_load "$__tmp"
|
||||||
json_get_var "$__var" device
|
json_get_var "$__var" "$__field"
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
network_get_device() { __network_device "$1" "$2" l3_device; }
|
||||||
|
network_get_physdev() { __network_device "$1" "$2" device; }
|
||||||
|
Loading…
Reference in New Issue
Block a user