From c7498c6397b706d191741d0a6634d4adfbd4c0db Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Sun, 22 Jan 2023 12:16:06 +0100 Subject: daily-psk: fixes for CAPsMAN --- daily-psk.capsman | 7 ++++--- daily-psk.template | 8 +++++--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/daily-psk.capsman b/daily-psk.capsman index 46e4e1d..81cb5a2 100644 --- a/daily-psk.capsman +++ b/daily-psk.capsman @@ -60,8 +60,9 @@ $WaitFullyConnected; :local NewPsk [ $GeneratePSK $Date ]; :foreach AccList in=[ /caps-man/access-list/find where comment~$DailyPskMatchComment ] do={ - :local Ssid [ /caps-man/access-list/get $AccList ssid-regexp ]; - :local Configuration [ /caps-man/configuration/get ([ find where ssid=$Ssid ]->0) name ]; + :local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ]; + :local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0); + :local Ssid [ /caps-man/configuration/get $Configuration ssid ]; :local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ]; :local Skip 0; @@ -69,7 +70,7 @@ $WaitFullyConnected; $LogPrintExit2 info $0 ("Updating daily PSK for " . $Ssid . " to " . $NewPsk . " (was " . $OldPsk . ")") false; /caps-man/access-list/set $AccList private-passphrase=$NewPsk; - :if ([ :len [ /caps-man/interface/find where configuration=$Configuration ] ] > 0) do={ + :if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={ :foreach SeenSsid in=$Seen do={ :if ($SeenSsid = $Ssid) do={ $LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; diff --git a/daily-psk.template b/daily-psk.template index 373cc96..811f2f8 100644 --- a/daily-psk.template +++ b/daily-psk.template @@ -63,9 +63,11 @@ $WaitFullyConnected; :foreach AccList in=[ /%PATH%/access-list/find where comment~$DailyPskMatchComment ] do={ :local IntName [ /interface/wireless/access-list/get $AccList interface ]; :local Ssid [ /interface/wireless/get $IntName ssid ]; - :local Ssid [ /caps-man/access-list/get $AccList ssid-regexp ]; - :local Configuration [ /caps-man/configuration/get ([ find where ssid=$Ssid ]->0) name ]; :local OldPsk [ /interface/wireless/access-list/get $AccList private-pre-shared-key ]; + # /interface/wireless above - /caps-man below + :local SsidRegExp [ /caps-man/access-list/get $AccList ssid-regexp ]; + :local Configuration ([ /caps-man/configuration/find where ssid~$SsidRegExp ]->0); + :local Ssid [ /caps-man/configuration/get $Configuration ssid ]; :local OldPsk [ /caps-man/access-list/get $AccList private-passphrase ]; :local Skip 0; @@ -75,7 +77,7 @@ $WaitFullyConnected; /caps-man/access-list/set $AccList private-passphrase=$NewPsk; :if ([ :len [ /interface/wireless/find where name=$IntName !disabled ] ] = 1) do={ - :if ([ :len [ /caps-man/interface/find where configuration=$Configuration ] ] > 0) do={ + :if ([ :len [ /caps-man/actual-interface-configuration/find where configuration.ssid=$Ssid !disabled ] ] > 0) do={ :foreach SeenSsid in=$Seen do={ :if ($SeenSsid = $Ssid) do={ $LogPrintExit2 debug $0 ("Already sent a mail for SSID " . $Ssid . ", skipping.") false; -- cgit v1.2.3-70-g09d2