Files
wlan-ap/feeds/ucentral/ratelimit/files/usr/libexec/ratelimit.sh
John Crispin 8c9cd8f9d2 ratelimit: fix syntax error during parsing of wlanX-Y
Fixes: WIFI-11965
Signed-off-by: John Crispin <john@phrozen.org>
2022-12-13 16:50:58 +01:00

18 lines
558 B
Bash
Executable File

#!/bin/sh
case $2 in
AP-STA-CONNECTED)
[ $4 = 0 -o $5 = 0 ] && {
ubus call ratelimit client_set '{"device": "'$1'", "address": "'$3'", "defaults": "'$(ubus call wifi iface | jsonfilter -e "@['$1'].ssid")'" }'
logger ratelimit addclient $1 $3 $ssid
return
}
ubus call ratelimit client_set '{"device": "'$1'", "address": "'$3'", "rate_ingress": "'$4'mbit", "rate_egress": "'$5'mbit" }'
logger ratelimit addclient $1 $3 $4 $5
;;
AP-STA-DISCONNECTED)
ubus call ratelimit client_delete '{ "address": "'$3'" }'
logger ratelimit delclient $3
;;
esac