From 00e8766ce357126939d7441da8fba9c6ca25984b Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 16 Oct 2023 21:46:10 +0200 Subject: accesslist-duplicates: use another named array --- accesslist-duplicates.capsman.rsc | 21 +++++++++------------ accesslist-duplicates.local.rsc | 21 +++++++++------------ accesslist-duplicates.template.rsc | 29 +++++++++++++---------------- accesslist-duplicates.wifiwave2.rsc | 21 +++++++++------------ 4 files changed, 40 insertions(+), 52 deletions(-) diff --git a/accesslist-duplicates.capsman.rsc b/accesslist-duplicates.capsman.rsc index b5a7347..b09ef6a 100644 --- a/accesslist-duplicates.capsman.rsc +++ b/accesslist-duplicates.capsman.rsc @@ -19,18 +19,15 @@ :foreach AccList in=[ /caps-man/access-list/find where mac-address!="00:00:00:00:00:00" ] do={ :local Mac [ /caps-man/access-list/get $AccList mac-address ]; - :foreach SeenMac in=$Seen do={ - :if ($SeenMac = $Mac && $Shown->$Mac != 1) do={ - /caps-man/access-list/print where mac-address=$Mac; - - :put "\nNumeric id to remove, any key to skip!"; - :local Remove [ :tonum [ $Read ] ]; - :if ([ :typeof $Remove ] = "num") do={ - :put ("Removing numeric id " . $Remove . "...\n"); - /caps-man/access-list/remove $Remove; - } - :set ($Shown->$Mac) 1; + :if ($Seen->$Mac = 1 && $Shown->$Mac != 1) do={ + /caps-man/access-list/print where mac-address=$Mac; + :put "\nNumeric id to remove, any key to skip!"; + :local Remove [ :tonum [ $Read ] ]; + :if ([ :typeof $Remove ] = "num") do={ + :put ("Removing numeric id " . $Remove . "...\n"); + /caps-man/access-list/remove $Remove; } + :set ($Shown->$Mac) 1; } - :set Seen ($Seen, $Mac); + :set ($Seen->$Mac) 1; } diff --git a/accesslist-duplicates.local.rsc b/accesslist-duplicates.local.rsc index e90a002..bffee5a 100644 --- a/accesslist-duplicates.local.rsc +++ b/accesslist-duplicates.local.rsc @@ -19,18 +19,15 @@ :foreach AccList in=[ /interface/wireless/access-list/find where mac-address!="00:00:00:00:00:00" ] do={ :local Mac [ /interface/wireless/access-list/get $AccList mac-address ]; - :foreach SeenMac in=$Seen do={ - :if ($SeenMac = $Mac && $Shown->$Mac != 1) do={ - /interface/wireless/access-list/print where mac-address=$Mac; - - :put "\nNumeric id to remove, any key to skip!"; - :local Remove [ :tonum [ $Read ] ]; - :if ([ :typeof $Remove ] = "num") do={ - :put ("Removing numeric id " . $Remove . "...\n"); - /interface/wireless/access-list/remove $Remove; - } - :set ($Shown->$Mac) 1; + :if ($Seen->$Mac = 1 && $Shown->$Mac != 1) do={ + /interface/wireless/access-list/print where mac-address=$Mac; + :put "\nNumeric id to remove, any key to skip!"; + :local Remove [ :tonum [ $Read ] ]; + :if ([ :typeof $Remove ] = "num") do={ + :put ("Removing numeric id " . $Remove . "...\n"); + /interface/wireless/access-list/remove $Remove; } + :set ($Shown->$Mac) 1; } - :set Seen ($Seen, $Mac); + :set ($Seen->$Mac) 1; } diff --git a/accesslist-duplicates.template.rsc b/accesslist-duplicates.template.rsc index 0bacd0d..28c851c 100644 --- a/accesslist-duplicates.template.rsc +++ b/accesslist-duplicates.template.rsc @@ -24,22 +24,19 @@ :local Mac [ /caps-man/access-list/get $AccList mac-address ]; :local Mac [ /interface/wifiwave2/access-list/get $AccList mac-address ]; :local Mac [ /interface/wireless/access-list/get $AccList mac-address ]; - :foreach SeenMac in=$Seen do={ - :if ($SeenMac = $Mac && $Shown->$Mac != 1) do={ - /caps-man/access-list/print where mac-address=$Mac; - /interface/wifiwave2/access-list/print where mac-address=$Mac; - /interface/wireless/access-list/print where mac-address=$Mac; - - :put "\nNumeric id to remove, any key to skip!"; - :local Remove [ :tonum [ $Read ] ]; - :if ([ :typeof $Remove ] = "num") do={ - :put ("Removing numeric id " . $Remove . "...\n"); - /caps-man/access-list/remove $Remove; - /interface/wifiwave2/access-list/remove $Remove; - /interface/wireless/access-list/remove $Remove; - } - :set ($Shown->$Mac) 1; + :if ($Seen->$Mac = 1 && $Shown->$Mac != 1) do={ + /caps-man/access-list/print where mac-address=$Mac; + /interface/wifiwave2/access-list/print where mac-address=$Mac; + /interface/wireless/access-list/print where mac-address=$Mac; + :put "\nNumeric id to remove, any key to skip!"; + :local Remove [ :tonum [ $Read ] ]; + :if ([ :typeof $Remove ] = "num") do={ + :put ("Removing numeric id " . $Remove . "...\n"); + /caps-man/access-list/remove $Remove; + /interface/wifiwave2/access-list/remove $Remove; + /interface/wireless/access-list/remove $Remove; } + :set ($Shown->$Mac) 1; } - :set Seen ($Seen, $Mac); + :set ($Seen->$Mac) 1; } diff --git a/accesslist-duplicates.wifiwave2.rsc b/accesslist-duplicates.wifiwave2.rsc index 7d34b2a..6897a51 100644 --- a/accesslist-duplicates.wifiwave2.rsc +++ b/accesslist-duplicates.wifiwave2.rsc @@ -19,18 +19,15 @@ :foreach AccList in=[ /interface/wifiwave2/access-list/find where mac-address!="00:00:00:00:00:00" ] do={ :local Mac [ /interface/wifiwave2/access-list/get $AccList mac-address ]; - :foreach SeenMac in=$Seen do={ - :if ($SeenMac = $Mac && $Shown->$Mac != 1) do={ - /interface/wifiwave2/access-list/print where mac-address=$Mac; - - :put "\nNumeric id to remove, any key to skip!"; - :local Remove [ :tonum [ $Read ] ]; - :if ([ :typeof $Remove ] = "num") do={ - :put ("Removing numeric id " . $Remove . "...\n"); - /interface/wifiwave2/access-list/remove $Remove; - } - :set ($Shown->$Mac) 1; + :if ($Seen->$Mac = 1 && $Shown->$Mac != 1) do={ + /interface/wifiwave2/access-list/print where mac-address=$Mac; + :put "\nNumeric id to remove, any key to skip!"; + :local Remove [ :tonum [ $Read ] ]; + :if ([ :typeof $Remove ] = "num") do={ + :put ("Removing numeric id " . $Remove . "...\n"); + /interface/wifiwave2/access-list/remove $Remove; } + :set ($Shown->$Mac) 1; } - :set Seen ($Seen, $Mac); + :set ($Seen->$Mac) 1; } -- cgit v1.2.3-70-g09d2