diff options
Diffstat (limited to 'collect-wireless-mac.local')
-rw-r--r-- | collect-wireless-mac.local | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/collect-wireless-mac.local b/collect-wireless-mac.local index 0284acf..bb4cafe 100644 --- a/collect-wireless-mac.local +++ b/collect-wireless-mac.local @@ -31,9 +31,21 @@ $ScriptLock $0 false 10; :local PlaceBefore ([ / interface wireless access-list find where comment="--- collected above ---" disabled ]->0); :foreach RegTbl in=[ / interface wireless registration-table find ] do={ - :local Mac [ / interface wireless registration-table get $RegTbl mac-address ]; - :local AccessList ([ / interface wireless access-list find where mac-address=$Mac ]->0); - :if ([ :len $AccessList ] = 0) do={ + :local Mac; + :local AccessList; + :do { + :set Mac [ / interface wireless registration-table get $RegTbl mac-address ]; + :set AccessList ([ / interface wireless access-list find where mac-address=$Mac ]->0); + } on-error={ + $LogPrintExit2 debug $0 ("Device already gone... Ignoring.") false; + } + + :if ([ :len $AccessList ] > 0) do={ + $LogPrintExit2 debug $0 ("MAC address " . $Mac . " already known: " . \ + [ / interface wireless access-list get $AccessList comment ]) false; + } + + :if ([ :typeof $Mac ] = "str" && [ :len $AccessList ] = 0) do={ :local Address "no dhcp lease"; :local DnsName "no dhcp lease"; :local HostName "no dhcp lease"; @@ -70,8 +82,5 @@ $ScriptLock $0 false 10; "Address: " . $Address . "\n" . \ "DNS name: " . $DnsName . "\n" . \ "Date: " . $DateTime) }); - } else={ - $LogPrintExit2 debug $0 ("MAC address " . $Mac . " already known: " . \ - [ / interface wireless access-list get $AccessList comment ]) false; } } |