aboutsummaryrefslogtreecommitdiffstats
path: root/collect-wireless-mac.template
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.template
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.template')
-rw-r--r--collect-wireless-mac.template2
1 files changed, 1 insertions, 1 deletions
diff --git a/collect-wireless-mac.template b/collect-wireless-mac.template
index a7e2b4a..9b06dc3 100644
--- a/collect-wireless-mac.template
+++ b/collect-wireless-mac.template
@@ -32,7 +32,7 @@ $ScriptLock "collect-wireless-mac%TEMPL%";
: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 ];