aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/sbin
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2007-07-22 18:32:47 +0000
committerFelix Fietkau <nbd@openwrt.org>2007-07-22 18:32:47 +0000
commitb13426e21b729e62de0f9c7cd8dd0e0c0bc900d6 (patch)
tree987b1cfbfebc72de4b9cc6d21ba65156cbe673ba /package/base-files/files/sbin
parentf2a32fff7d2089082e11f0e8ebfaef6159994338 (diff)
downloadupstream-b13426e21b729e62de0f9c7cd8dd0e0c0bc900d6.tar.gz
upstream-b13426e21b729e62de0f9c7cd8dd0e0c0bc900d6.tar.bz2
upstream-b13426e21b729e62de0f9c7cd8dd0e0c0bc900d6.zip
keep track of the wifi interface state in /var/state/wireless
SVN-Revision: 8108
Diffstat (limited to 'package/base-files/files/sbin')
-rwxr-xr-xpackage/base-files/files/sbin/wifi19
1 files changed, 19 insertions, 0 deletions
diff --git a/package/base-files/files/sbin/wifi b/package/base-files/files/sbin/wifi
index d653620ca2..0d26468ba2 100755
--- a/package/base-files/files/sbin/wifi
+++ b/package/base-files/files/sbin/wifi
@@ -72,6 +72,25 @@ start_net() {(
setup_interface "$1" "$2"
)}
+set_wifi_up() {
+ local cfg="$1"
+ local ifname="$2"
+ uci set "/var/state/wireless.${cfg}.up=1"
+ uci set "/var/state/wireless.${cfg}.ifname=$ifname"
+}
+
+set_wifi_down() {
+ local cfg="$1"
+ local vifs vif vifstr
+ config_get vifs "$cfg" vifs
+ for vif in $vifs; do
+ append vifstr "$vif" "|"
+ done
+ FILE="/var/state/wireless.$$"
+ grep -vE "^config_set '($vifstr)' " /var/state/wireless > "$FILE"
+ mv "$FILE" /var/state/wireless
+}
+
scan_wifi() {
local cfgfile="$1"
config_cb() {