aboutsummaryrefslogtreecommitdiffstats
path: root/collect-wireless-mac.local
diff options
context:
space:
mode:
authorGravatar Daniel Ziegenberg <daniel@ziegenberg.at>2020-12-30 12:38:10 +0100
committerGravatar Christian Hesse <mail@eworm.de>2020-12-30 12:42:03 +0100
commitca6668950b045f1c3eb775a7203ea26ddba5e4d8 (patch)
tree2278bc1745b996c414d441dbd578e447e039032a /collect-wireless-mac.local
parent97ade535d9789b35652f294bff4f489d868a1130 (diff)
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 <mail@eworm.de>
Diffstat (limited to 'collect-wireless-mac.local')
-rw-r--r--collect-wireless-mac.local2
1 files changed, 1 insertions, 1 deletions
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 ];