aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2020-11-30 13:15:49 -0800
committerGitHub <noreply@github.com>2020-11-30 13:15:49 -0800
commitcc88432847dae01ea5248ee98e96e6b228379f8b (patch)
tree237916726d709b8051e1839e8dbd7304a17eba53 /net
parent5f0918281b7799412892941ae0475a84d8245c91 (diff)
parent36ce3ffbf110ea6ab15f8c45e7646914d2478272 (diff)
Merge pull request #14057 from newkit/master
wifischedule: Merged ignore_stations patch from user bedaes https://g…
Diffstat (limited to 'net')
-rw-r--r--net/wifischedule/Makefile2
-rw-r--r--net/wifischedule/README.md5
-rw-r--r--net/wifischedule/net/etc/config/wifi_schedule1
-rwxr-xr-xnet/wifischedule/net/usr/bin/wifi_schedule.sh15
4 files changed, 15 insertions, 8 deletions
diff --git a/net/wifischedule/Makefile b/net/wifischedule/Makefile
index 45dd50538..8c26f7051 100644
--- a/net/wifischedule/Makefile
+++ b/net/wifischedule/Makefile
@@ -16,7 +16,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=wifischedule
PKG_VERSION:=1
-PKG_RELEASE:=2
+PKG_RELEASE:=3
PKG_LICENSE:=PRPL
PKG_MAINTAINER:=Nils Koenig <openwrt@newk.it>
diff --git a/net/wifischedule/README.md b/net/wifischedule/README.md
index 591abb104..6d53da5f5 100644
--- a/net/wifischedule/README.md
+++ b/net/wifischedule/README.md
@@ -34,9 +34,9 @@ The button "Determine Modules Automatically" tries to make a best guess determin
When un-/loading the modules, there is a certain number of retries (`module_load`) performed.
The option "Force disabling wifi even if stations associated" does what it says - when activated it simply shuts down WiFi.
-When unchecked, its checked every `recheck_interval` minutes if there are still stations associated. Once the stations disconnect, WiFi is disabled.
+When unchecked, its checked every `recheck_interval` minutes if there are still stations associated. Once the stations disconnect, WiFi is disabled. To ignore associated stations add their MAC to `ignore_stations`.
-Please note, that the parameters `module_load` and `recheck_interval` are only accessible through uci.
+Please note, that the parameters `module_load`, `recheck_interval` and `ignore_stations` are only accessible through uci.
## UCI Configuration `wifi_schedule`
UCI configuration file: `/etc/config/wifi_schedule`:
@@ -47,6 +47,7 @@ config global
option enabled '0'
option recheck_interval '10'
option modules_retries '10'
+# option ignore_stations 'AA:AA:AA:AA:AA:AA BB:BB:BB:BB:BB:BB'
config entry 'Businesshours'
option enabled '0'
diff --git a/net/wifischedule/net/etc/config/wifi_schedule b/net/wifischedule/net/etc/config/wifi_schedule
index 946a1fff4..96943fb17 100644
--- a/net/wifischedule/net/etc/config/wifi_schedule
+++ b/net/wifischedule/net/etc/config/wifi_schedule
@@ -3,6 +3,7 @@ config global
option enabled '0'
option recheck_interval '10'
option modules_retries '10'
+# option ignore_stations 'AA:AA:AA:AA:AA:AA BB:BB:BB:BB:BB:BB'
config entry 'Businesshours'
option enabled '0'
diff --git a/net/wifischedule/net/usr/bin/wifi_schedule.sh b/net/wifischedule/net/usr/bin/wifi_schedule.sh
index 363f95dd6..be483d0bc 100755
--- a/net/wifischedule/net/usr/bin/wifi_schedule.sh
+++ b/net/wifischedule/net/usr/bin/wifi_schedule.sh
@@ -248,16 +248,21 @@ soft_disable_wifi()
return 1
fi
+ local ignore_stations=$(_get_uci_value_raw ${GLOBAL}.ignore_stations)
+ [ -n "${ignore_stations}" ] && _log "Ignoring station(s) ${ignore_stations}"
+
# check if no stations are associated
local _if
for _if in $(_get_wireless_interfaces)
do
- output=$(${iwinfo} ${_if} assoclist)
- if [[ "$output" != "No station connected" ]]
- then
+ local stations=$(${iwinfo} ${_if} assoclist | grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}')
+ if [ -n "${ignore_stations}" ]; then
+ stations=$(echo "${stations}" | grep -vwi -E "${ignore_stations// /|}")
+ fi
+
+ if [ -n "${stations}" ]; then
_disable_wifi=0
- local stations=$(echo ${output}| grep -o -E '([[:xdigit:]]{1,2}:){5}[[:xdigit:]]{1,2}' | tr '\n' ' ')
- _log "Station(s) ${stations}associated on ${_if}"
+ _log "Station(s) $(echo ${stations}) associated on ${_if}"
fi
done