From ca6668950b045f1c3eb775a7203ea26ddba5e4d8 Mon Sep 17 00:00:00 2001 From: Daniel Ziegenberg Date: Wed, 30 Dec 2020 12:38:10 +0100 Subject: collect-wireless-mac: always select first lease from dhcp-server The script 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. Fixes #10 Signed-off-by: Christian Hesse --- collect-wireless-mac.local | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'collect-wireless-mac.local') diff --git a/collect-wireless-mac.local b/collect-wireless-mac.local index 080d036..fc36e59 100644 --- a/collect-wireless-mac.local +++ b/collect-wireless-mac.local @@ -31,7 +31,7 @@ $ScriptLock "collect-wireless-mac.local"; :local Address "no dhcp lease"; :local DnsName "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 ]->0); :if ([ :len $Lease ] > 0) do={ :set Address [ / ip dhcp-server lease get $Lease address ]; :set HostName [ / ip dhcp-server lease get $Lease host-name ]; -- cgit v1.2.3-54-g00ecf