netifd: implement find_config()
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 15 Mar 2012 09:49:26 +0000 (09:49 +0000)
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Thu, 15 Mar 2012 09:49:26 +0000 (09:49 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@30947 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/netifd/files/lib/network/config.sh

index 129cb66..8b91f96 100755 (executable)
@@ -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() {
This page took 0.026841 seconds and 4 git commands to generate.