mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-02-22 16:19:36 +00:00
always select first lease from dhcp-server
collect-wireless-mac.capsman fails at setting the hostname when there are multiple leases for a mac address In line 36 and 37 the hostname gets set from the data the lease. When there is more than one lease for a specific mac address this fails with the message "invalid internal item number". More than one lease for a mac address is possible, if you have more than one SSID on a capsman and a single device can login into more than one SSID.
This commit is contained in:
parent
97ade535d9
commit
f8a448acd3
1 changed files with 2 additions and 2 deletions
|
|
@ -33,8 +33,8 @@ $ScriptLock "collect-wireless-mac.capsman";
|
||||||
:local HostName "no dhcp lease";
|
:local HostName "no dhcp lease";
|
||||||
:local Lease [ / ip dhcp-server lease find where mac-address=$Mac dynamic=yes status=bound ];
|
:local Lease [ / ip dhcp-server lease find where mac-address=$Mac dynamic=yes status=bound ];
|
||||||
:if ([ :len $Lease ] > 0) do={
|
:if ([ :len $Lease ] > 0) do={
|
||||||
:set Address [ / ip dhcp-server lease get $Lease address ];
|
:set Address [ / ip dhcp-server lease get [:pick $Lease 0 ] address ];
|
||||||
:set HostName [ / ip dhcp-server lease get $Lease host-name ];
|
:set HostName [ / ip dhcp-server lease get [:pick $Lease 0 ] host-name ];
|
||||||
:if ([ :len $HostName ] = 0) do={
|
:if ([ :len $HostName ] = 0) do={
|
||||||
:set HostName "no hostname";
|
:set HostName "no hostname";
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue