This commit is contained in:
Christian Hesse 2026-07-31 23:38:04 +02:00
parent 8678792837
commit f2bffb1c68
6 changed files with 25 additions and 19 deletions

View file

@ -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 . ").");

View file

@ -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 . ").");

View file

@ -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 . ").");

View file

@ -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; \

View file

@ -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; \

View file

@ -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; \