diff options
author | Daniel Ziegenberg <daniel@ziegenberg.at> | 2020-12-30 12:38:10 +0100 |
---|---|---|
committer | Christian Hesse <mail@eworm.de> | 2020-12-30 12:42:03 +0100 |
commit | ca6668950b045f1c3eb775a7203ea26ddba5e4d8 (patch) | |
tree | 2278bc1745b996c414d441dbd578e447e039032a | |
parent | 97ade535d9789b35652f294bff4f489d868a1130 (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>
-rw-r--r-- | collect-wireless-mac.capsman | 2 | ||||
-rw-r--r-- | collect-wireless-mac.local | 2 | ||||
-rw-r--r-- | collect-wireless-mac.template | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/collect-wireless-mac.capsman b/collect-wireless-mac.capsman index 7abae6a..3ed67fc 100644 --- a/collect-wireless-mac.capsman +++ b/collect-wireless-mac.capsman @@ -31,7 +31,7 @@ $ScriptLock "collect-wireless-mac.capsman"; :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 ]; 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 ]; 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 ]; |