I try to create a script to limit the speed on my wireless client only if they download a lot and only for a period of time.
I am thinking of a script that will be execute at eatch 15 minute and if a mac-address on the wireless registration table have more that $allowedbytes more on the TXBytes or RxBytes, we put an access-list with " AP-TX-LIMIT " on this mac.
At eatch start of the script I could remove all access-list to put all user on their true speed and check again.
Here is a start … can somebody help me for the array thing to remember somewhere the last value to be abble to check if the client have download more that X bytes and apply or not the bandwith limit for the next 15 min.
# define an array to put the mac, TxBytes and RxBytes
# clear all the access list with that have the comment "AddedbyPURscript"
:foreach i in=[ /int wir reg find ap=no] do={
:local iBytes [:toarray [/interface wireless registration-table get $i bytes]]
:local TxBytes [:tonum [:pick $iBytes 0 1]]
:local RxBytes [:tonum [:pick $iBytes 1 2]]
:log info ( "TEST ==> " . [/system identity get name] . " -- " . $i . " -- " . [int wir reg get $i mac-address] . " -- TX : " . $TxBytes . " RX: " . $RxBytes )
#check if the RX or TX bytes is more that $allowedbytes of difference for eatch mac-address
# if the RX or TX bytes is more that $allowedbytes of difference limit the download speed
#interface wireless access-list add mac-address="" ap-tx-limit="512000" comment="AddedbyPURscript"
# Put the data in a global array for the next test
}