summaryrefslogtreecommitdiff
path: root/package/base-files/files/lib
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-05-29 00:20:16 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-05-29 00:20:16 +0000
commitbf52cbf108e67edb3b479e8c14414eeea6db9195 (patch)
treea9e4a8a15b44fa9ec22efcb1823e7383d1969392 /package/base-files/files/lib
parenta9cd8446f3ffefda0b2b802f7b43a3880a440347 (diff)
downloadmtk-20170518-bf52cbf108e67edb3b479e8c14414eeea6db9195.zip
mtk-20170518-bf52cbf108e67edb3b479e8c14414eeea6db9195.tar.gz
mtk-20170518-bf52cbf108e67edb3b479e8c14414eeea6db9195.tar.bz2
base-files: let network_get_device() return the l3 interface, introduce network_get_physdev() to obtain the underlying iface (if applicable)
SVN-Revision: 31960
Diffstat (limited to 'package/base-files/files/lib')
-rw-r--r--package/base-files/files/lib/functions/network.sh10
1 files changed, 6 insertions, 4 deletions
diff --git a/package/base-files/files/lib/functions/network.sh b/package/base-files/files/lib/functions/network.sh
index 159da09..e038c94 100644
--- a/package/base-files/files/lib/functions/network.sh
+++ b/package/base-files/files/lib/functions/network.sh
@@ -41,16 +41,18 @@ network_get_subnet() { __network_ipaddr "$1" "$2" 4 1; }
network_get_subnet6() { __network_ipaddr "$1" "$2" 6 1; }
-network_get_device()
+__network_device()
{
local __var="$1"
local __iface="$2"
+ local __field="$3"
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
+ json_get_var "$__var" "$__field"
}
+
+network_get_device() { __network_device "$1" "$2" l3_device; }
+network_get_physdev() { __network_device "$1" "$2" device; }