From adff0183cad1a7d405bcf20c12d04efb6adf5c71 Mon Sep 17 00:00:00 2001 From: Felix Fietkau Date: Thu, 15 Mar 2012 09:49:26 +0000 Subject: [PATCH] netifd: implement find_config() SVN-Revision: 30947 --- package/netifd/files/lib/network/config.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/package/netifd/files/lib/network/config.sh b/package/netifd/files/lib/network/config.sh index 129cb66622..8b91f96a6e 100755 --- a/package/netifd/files/lib/network/config.sh +++ b/package/netifd/files/lib/network/config.sh @@ -4,7 +4,20 @@ . /usr/share/libubox/jshn.sh find_config() { - return + local device="$1" + for ifobj in `ubus list network.interface.\*`; do + interface="${ifobj##network.interface.}" + ( + json_load "$(ifstatus $interface)" + json_get_var ifdev device + if [[ "$device" = "$ifdev" ]]; then + echo "$interface" + exit 0 + else + exit 1 + fi + ) && return + done } unbridge() { -- 2.30.2