Hi I have a script that checks for entries with empty comment in the wifi registration table, and populates the access-list with the hostname from the dhcp lease. It used to work with [find where !comment] but recently it doesnt work, it returns all entries, even those with comments. How do I use find to find an empty or unset comment?
I also note I am unable to get the comment field from a reg table entry. [get $i mac-address] works fine. [get $i comment] results in an error "input does not match any value of value-name"
Possibly these two issues are related. Did they perhaps make the comment field in /int wifi reg table not a findable or gettable value at a certain ROS update recently?
Are you sure? im looking at it now, its populated by matches in the access-list. My script worked fine until recently, im guessing a ROS update broke it.
I beg to strongly differ, useful is in the eye of the beholder. For me, having the hostname show in the wireless registration table comment column is incredibly useful, in that I dont constantly have to go to the dhcp lease table look up which host this mac belongs to. So useful, im surprised it not default behavior in winbox/ROS. Its even strange that I had to code this with a custom script to provide such obviously useful functionality.
Here is my script, which was working perfectly fine until a recent ROS version update broke it. It could either be scheduled to run periodically to catch new additions, or just run manually whenever an empty comment was noticed.
/interface wifi registration-table
:foreach i in=[find where !comment] do={
:local maccaps ( [get $i mac-address] );
:log info "doing $maccaps";
/ip dhcp-server lease
:local leaseID [find where mac-address=$maccaps];
:local name;
:do { :set name [get $leaseID comment ]; } on-error={ :log info "no lease found";}
:if ($name = "") do={ :set name [get $leaseID host-name]; }
:local len [:len $name];
:if ( $name != "" && $len >0 ) do={
:log info "adding acl entry: $maccaps $name";
# :do { /interface wifi access-list add mac-address=$maccaps action=accept comment=$name; } on-error={ :log info "add failed"; }
}
}
Considering the extent to which other script punctuation minutiae issues have been debated on here in the past, im surprised no-one is as outraged by this change as I am.
Mikrotik guys, please bring back the ability to :find and :get the comment field of the wireless registration table.