mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2026-08-01 06:01:35 +00:00
FIXUP
This commit is contained in:
parent
8678792837
commit
f2bffb1c68
6 changed files with 25 additions and 19 deletions
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic disabled comment~"\\bhotspot-to-wpa\\b" ] do={
|
: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 ] ];
|
:local LeaseVal [ $ParseKeyValueStore [ /ip/dhcp-server/lease/get $Lease comment ] ];
|
||||||
|
/ip/dhcp-server/lease/remove $Lease;
|
||||||
|
|
||||||
:if (($LeaseVal->"hotspot-to-wpa") != true) do={
|
:if (($LeaseVal->"hotspot-to-wpa") != true) do={
|
||||||
:continue;
|
:continue;
|
||||||
|
|
@ -51,16 +52,14 @@
|
||||||
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
|
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
|
||||||
}
|
}
|
||||||
:local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ];
|
: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 [ /caps-man/access-list/find where \
|
||||||
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
|
comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ] ] = 0) do={
|
||||||
/caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
|
/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 '" . $Hotspot . "'.");
|
$LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $LeaseVal->"hotspot" . "'.");
|
||||||
}
|
}
|
||||||
:local Template [ /caps-man/access-list/get ([ find where \
|
: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 . \
|
$LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
|
||||||
" (user " . $UserName . ").");
|
" (user " . $UserName . ").");
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,7 @@
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic disabled comment~"\\bhotspot-to-wpa\\b" ] do={
|
: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 ] ];
|
:local LeaseVal [ $ParseKeyValueStore [ /ip/dhcp-server/lease/get $Lease comment ] ];
|
||||||
|
/ip/dhcp-server/lease/remove $Lease;
|
||||||
|
|
||||||
:if (($LeaseVal->"hotspot-to-wpa") != true) do={
|
:if (($LeaseVal->"hotspot-to-wpa") != true) do={
|
||||||
:continue;
|
:continue;
|
||||||
|
|
@ -55,19 +56,17 @@
|
||||||
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
|
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
|
||||||
}
|
}
|
||||||
:local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ];
|
: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 [ /caps-man/access-list/find where \
|
||||||
:if ([ :len [ /interface/wifi/access-list/find where \
|
:if ([ :len [ /interface/wifi/access-list/find where \
|
||||||
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
|
comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ] ] = 0) do={
|
||||||
/caps-man/access-list/add comment=("hotspot-to-wpa template " . $Hotspot) disabled=yes place-before=$PlaceBefore;
|
/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 " . $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 '" . $Hotspot . "'.");
|
$LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $LeaseVal->"hotspot" . "'.");
|
||||||
}
|
}
|
||||||
:local Template [ /caps-man/access-list/get ([ find where \
|
:local Template [ /caps-man/access-list/get ([ find where \
|
||||||
:local Template [ /interface/wifi/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 . \
|
$LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
|
||||||
" (user " . $UserName . ").");
|
" (user " . $UserName . ").");
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
:foreach Lease in=[ /ip/dhcp-server/lease/find where !dynamic disabled comment~"\\bhotspot-to-wpa\\b" ] do={
|
: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 ] ];
|
:local LeaseVal [ $ParseKeyValueStore [ /ip/dhcp-server/lease/get $Lease comment ] ];
|
||||||
|
/ip/dhcp-server/lease/remove $Lease;
|
||||||
|
|
||||||
:if (($LeaseVal->"hotspot-to-wpa") != true) do={
|
:if (($LeaseVal->"hotspot-to-wpa") != true) do={
|
||||||
:continue;
|
:continue;
|
||||||
|
|
@ -51,16 +52,14 @@
|
||||||
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
|
:set UserVal [ /ip/hotspot/user/get [ find where name=$UserName ] ];
|
||||||
}
|
}
|
||||||
:local UserInfo [ $ParseKeyValueStore ($UserVal->"comment") ];
|
: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 \
|
:if ([ :len [ /interface/wifi/access-list/find where \
|
||||||
comment=("hotspot-to-wpa template " . $Hotspot) disabled ] ] = 0) do={
|
comment=("hotspot-to-wpa template " . $LeaseVal->"hotspot") disabled ] ] = 0) do={
|
||||||
/interface/wifi/access-list/add comment=("hotspot-to-wpa template " . $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 '" . $Hotspot . "'.");
|
$LogPrint warning $ScriptName ("Added template in access-list for hotspot '" . $LeaseVal->"hotspot" . "'.");
|
||||||
}
|
}
|
||||||
:local Template [ /interface/wifi/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 . \
|
$LogPrint info $ScriptName ("Adding/updating access-list entry for mac address " . $MacAddress . \
|
||||||
" (user " . $UserName . ").");
|
" (user " . $UserName . ").");
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,12 @@
|
||||||
:error false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ];
|
||||||
|
|
||||||
/ip/dhcp-server/lease/set \
|
/ip/dhcp-server/lease/set \
|
||||||
comment=[ :serialize to=json ({ \
|
comment=[ :serialize to=json ({ \
|
||||||
"hotspot-to-wpa"=true; \
|
"hotspot-to-wpa"=true; \
|
||||||
|
"hotspot"=$Hotspot; \
|
||||||
"address"=$Address; \
|
"address"=$Address; \
|
||||||
"interface"=$Interface; \
|
"interface"=$Interface; \
|
||||||
"mac-address"=$MacAddress; \
|
"mac-address"=$MacAddress; \
|
||||||
|
|
|
||||||
|
|
@ -39,9 +39,12 @@
|
||||||
:error false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ];
|
||||||
|
|
||||||
/ip/dhcp-server/lease/set \
|
/ip/dhcp-server/lease/set \
|
||||||
comment=[ :serialize to=json ({ \
|
comment=[ :serialize to=json ({ \
|
||||||
"hotspot-to-wpa"=true; \
|
"hotspot-to-wpa"=true; \
|
||||||
|
"hotspot"=$Hotspot; \
|
||||||
"address"=$Address; \
|
"address"=$Address; \
|
||||||
"interface"=$Interface; \
|
"interface"=$Interface; \
|
||||||
"mac-address"=$MacAddress; \
|
"mac-address"=$MacAddress; \
|
||||||
|
|
|
||||||
|
|
@ -37,9 +37,12 @@
|
||||||
:error false;
|
:error false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:local Hotspot [ /ip/hotspot/host/get [ find where mac-address=$MacAddress authorized ] server ];
|
||||||
|
|
||||||
/ip/dhcp-server/lease/set \
|
/ip/dhcp-server/lease/set \
|
||||||
comment=[ :serialize to=json ({ \
|
comment=[ :serialize to=json ({ \
|
||||||
"hotspot-to-wpa"=true; \
|
"hotspot-to-wpa"=true; \
|
||||||
|
"hotspot"=$Hotspot; \
|
||||||
"address"=$Address; \
|
"address"=$Address; \
|
||||||
"interface"=$Interface; \
|
"interface"=$Interface; \
|
||||||
"mac-address"=$MacAddress; \
|
"mac-address"=$MacAddress; \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue