From f2bffb1c686be2dddc670848f006d4a1280c6e9c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Fri, 31 Jul 2026 23:38:04 +0200 Subject: [PATCH] FIXUP --- hotspot-to-wpa-lease.capsman.rsc | 11 +++++------ hotspot-to-wpa-lease.template.rsc | 13 ++++++------- hotspot-to-wpa-lease.wifi.rsc | 11 +++++------ hotspot-to-wpa.capsman.rsc | 3 +++ hotspot-to-wpa.template.rsc | 3 +++ hotspot-to-wpa.wifi.rsc | 3 +++ 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/hotspot-to-wpa-lease.capsman.rsc b/hotspot-to-wpa-lease.capsman.rsc index 2533e12d..da86b9d5 100644 --- a/hotspot-to-wpa-lease.capsman.rsc +++ b/hotspot-to-wpa-lease.capsman.rsc @@ -37,6 +37,7 @@ :foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic disabled comment~"\\bhotspot-to-wpa\\b" ] do={ :local LeaseVal [ $ParseKeyValueStore [ /ip/dhcp-server/lease/get $Lease comment ] ]; + /ip/dhcp-server/lease/remove $Lease; :if (($LeaseVal->"hotspot-to-wpa") != true) do={ :continue; @@ -51,16 +52,14 @@ :set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ]; } :local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ]; - :local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ]; - /ip/dhcp-server/lease/remove $Lease; :if ([ :len [ /caps-man/access-list/find where \ - comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={ - /caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore; - $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'."); + comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ] ] = 0) do={ + /caps-man/access-list/add comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled=yes place-before=$PlaceBefore; + $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $LeaseVal->"hotspot" . "'."); } :local Template [ /caps-man/access-list/get ([ find where \ - comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ]; + comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ]->0) ]; $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \ " (user " . $UserName . ")."); diff --git a/hotspot-to-wpa-lease.template.rsc b/hotspot-to-wpa-lease.template.rsc index 348f3726..4f02a3db 100644 --- a/hotspot-to-wpa-lease.template.rsc +++ b/hotspot-to-wpa-lease.template.rsc @@ -41,6 +41,7 @@ :foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic disabled comment~"\\bhotspot-to-wpa\\b" ] do={ :local LeaseVal [ $ParseKeyValueStore [ /ip/dhcp-server/lease/get $Lease comment ] ]; + /ip/dhcp-server/lease/remove $Lease; :if (($LeaseVal->"hotspot-to-wpa") != true) do={ :continue; @@ -55,19 +56,17 @@ :set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ]; } :local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ]; - :local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ]; - /ip/dhcp-server/lease/remove $Lease; :if ([ :len [ /caps-man/access-list/find where \ :if ([ :len [ /interface/wifi/access-list/find where \ - comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={ - /caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore; - /interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore; - $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'."); + comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ] ] = 0) do={ + /caps-man/access-list/add comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled=yes place-before=$PlaceBefore; + /interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled=yes place-before=$PlaceBefore; + $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $LeaseVal->"hotspot" . "'."); } :local Template [ /caps-man/access-list/get ([ find where \ :local Template [ /interface/wifi/access-list/get ([ find where \ - comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ]; + comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ]->0) ]; $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \ " (user " . $UserName . ")."); diff --git a/hotspot-to-wpa-lease.wifi.rsc b/hotspot-to-wpa-lease.wifi.rsc index 2a90c06a..89a33836 100644 --- a/hotspot-to-wpa-lease.wifi.rsc +++ b/hotspot-to-wpa-lease.wifi.rsc @@ -37,6 +37,7 @@ :foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic disabled comment~"\\bhotspot-to-wpa\\b" ] do={ :local LeaseVal [ $ParseKeyValueStore [ /ip/dhcp-server/lease/get $Lease comment ] ]; + /ip/dhcp-server/lease/remove $Lease; :if (($LeaseVal->"hotspot-to-wpa") != true) do={ :continue; @@ -51,16 +52,14 @@ :set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ]; } :local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ]; - :local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ]; - /ip/dhcp-server/lease/remove $Lease; :if ([ :len [ /interface/wifi/access-list/find where \ - comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={ - /interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore; - $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $Hotspot . "'."); + comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ] ] = 0) do={ + /interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled=yes place-before=$PlaceBefore; + $LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $LeaseVal->"hotspot" . "'."); } :local Template [ /interface/wifi/access-list/get ([ find where \ - comment=("hotspot-to-wpa template " . $Hotspot) disabled ]->0) ]; + comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ]->0) ]; $LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \ " (user " . $UserName . ")."); diff --git a/hotspot-to-wpa.capsman.rsc b/hotspot-to-wpa.capsman.rsc index a97837ee..938d0042 100644 --- a/hotspot-to-wpa.capsman.rsc +++ b/hotspot-to-wpa.capsman.rsc @@ -37,9 +37,12 @@ :error false; } + :local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ]; + /ip/dhcp-server/lease/set \ comment=[ :serialize to=json ({ \ "hotspot-to-wpa"=true; \ + "hotspot"=$Hotspot; \ "address"=$Address; \ "interface"=$Interface; \ "mac-address"=$MacAddress; \ diff --git a/hotspot-to-wpa.template.rsc b/hotspot-to-wpa.template.rsc index d37c610f..84bb4181 100644 --- a/hotspot-to-wpa.template.rsc +++ b/hotspot-to-wpa.template.rsc @@ -39,9 +39,12 @@ :error false; } + :local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ]; + /ip/dhcp-server/lease/set \ comment=[ :serialize to=json ({ \ "hotspot-to-wpa"=true; \ + "hotspot"=$Hotspot; \ "address"=$Address; \ "interface"=$Interface; \ "mac-address"=$MacAddress; \ diff --git a/hotspot-to-wpa.wifi.rsc b/hotspot-to-wpa.wifi.rsc index cbd6798a..db6a44b2 100644 --- a/hotspot-to-wpa.wifi.rsc +++ b/hotspot-to-wpa.wifi.rsc @@ -37,9 +37,12 @@ :error false; } + :local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ]; + /ip/dhcp-server/lease/set \ comment=[ :serialize to=json ({ \ "hotspot-to-wpa"=true; \ + "hotspot"=$Hotspot; \ "address"=$Address; \ "interface"=$Interface; \ "mac-address"=$MacAddress; \