:put (1.1.1.1 in 1.0.0.0/8)
#true
:put (1.1.1.1 in 8.0.0.0/8)
#false
@msatter is right, ask everyone, this is not my personal forum...Ok.
{
/ip firewall address-list
:local pool [find where (address in 1.2.3.0/24) or (address in 4.5.6.0/24) or (address in 7.8.9.0/24)]
}
for example: 192.168.88.3, 192.168.88.67; 192.168.88.12; 192.168.0.11; 192.168.67.5; 192.168.88.34
{
:local listname octettest3
/ip/firewall/address-list
:foreach i in={192.168.88.3;192.168.88.67;192.168.88.12;192.168.0.11;192.168.67.5;192.168.88.34} do={add list=$listname address=$i}
:foreach a in=[find (address in 192.168.88.0/24) and (list=$listname)] do={:put [get $a address]}
remove [find list=$listname]
}
I guess I'm not understanding. If there is no address nor subnet... What are you trying to match? I just populated a new list to verify/show.Dear Amm0. If it were that easy, I wouldn't be asking. Addresses and subnets are not known in advance. Dear Amm0. If it were that easy, I wouldn't be asking. Addresses and subnets are not known in advance. This address list was given as an example
/ip firewall address-list { :local ip2net do={:return [[:parse ":return $($1 & 255.255.255.0)/$2"]]} :local addr 0.0.0.0 :local net 0.0.0.0 :foreach item in=[find where ([:typeof [:toip $address]]="ip")] do={ :set addr [get $item address] :set net [$ip2net $addr 24] :if ([:len [find where $address in $net]] > 1) do={ :put "\r\nSearch results for $net"; print where $address in $net } } }
192.168.88.0 192.168.88.1 192.168.88.2 192.168.88.3 192.168.88.4 192.168.88.5 192.168.88.6 192.168.88.7 192.168.88.8 192.168.88.9 192.168.88.10 192.168.88.11 192.168.88.12 192.168.88.13 192.168.88.14 192.168.88.15 192.168.88.16 192.168.88.17 192.168.88.18 192.168.88.19 192.168.88.20 192.168.88.21 192.168.88.22 192.168.88.23 192.168.88.24 192.168.88.25 192.168.88.26 192.168.88.27 192.168.88.28 192.168.88.29 192.168.88.30 192.168.88.31To this:
192.168.88.0/27Using only RouterOS functions.
192.168.88.0 192.168.88.1 192.168.88.2 192.168.88.3 192.168.88.5 192.168.88.6 192.168.88.7 192.168.88.8 192.168.88.9 192.168.88.10 192.168.88.11 192.168.88.12 192.168.88.13 192.168.88.14 192.168.88.15 192.168.88.16 192.168.88.17 192.168.88.19 192.168.88.20 192.168.88.21 192.168.88.26 192.168.88.27 192.168.88.28 192.168.88.29 192.168.88.30 192.168.88.31To this:
192.168.88.0/30 (4 IPs) 192.168.88.5/32 (single IP, not aggregable) 192.168.88.6/31 (2 IPs) 192.168.88.8/29 (8 IPs) 192.168.88.16/31 (2 IPs) 192.168.88.19/32 (single IP, not aggregable) 192.168.88.20/31 (2 IPs) 192.168.88.26/31 (2 IPs) 192.168.88.28/30 (4 IPs)
192.168.88.0 192.168.88.1 192.168.88.2 192.168.88.3 192.168.88.5 192.168.88.6 192.168.88.7 192.168.88.8 192.168.88.9 192.168.88.10 192.168.88.11 192.168.88.12 192.168.88.13 192.168.88.14 192.168.88.15 192.168.88.16 192.168.88.17 192.168.88.19 192.168.88.20 192.168.88.21 192.168.88.26 192.168.88.27 192.168.88.28 192.168.88.29 192.168.88.30 192.168.88.31
192.168.88.0/31 192.168.88.2/31 192.168.88.5/32 192.168.88.6/31 192.168.88.8/31 192.168.88.10/31 192.168.88.12/31 192.168.88.14/31 192.168.88.16/31 192.168.88.19/32 192.168.88.20/31 192.168.88.26/31 192.168.88.28/31 192.168.88.30/31
192.168.88.0/30 192.168.88.5/32 192.168.88.6/31 192.168.88.8/30 192.168.88.12/30 192.168.88.16/31 192.168.88.19/32 192.168.88.20/31 192.168.88.26/31 192.168.88.28/30
192.168.88.0/30 192.168.88.5/32 192.168.88.6/31 192.168.88.8/29 192.168.88.16/31 192.168.88.19/32 192.168.88.20/31 192.168.88.26/31 192.168.88.28/30And on this case, a /29 is the last step, because /28 and /27 do not produce any results.
192.168.88.0/30 192.168.88.4/32 (just added) 192.168.88.5/32 192.168.88.6/31 192.168.88.8/29 192.168.88.16/31 192.168.88.19/32 192.168.88.20/31 192.168.88.26/31 192.168.88.28/30to
192.168.88.0/28 192.168.88.16/31 192.168.88.19/32 192.168.88.20/31 192.168.88.26/31 192.168.88.28/30because
/* now hunt for adjacent entries that can be combined */
I'm not even sure that's the best C example, I just know the answer involved converting to big endian. My thought is most algorithms in C (but NOT the code) can be model in RouterOS script so that's were I start when looking for an algorithm (not code)... e.g. some rextended script function that does some as c-runtime's ntohl(), and any C struct can be modeled as array mapsI need help writing an efficient algorithm to convert (for example) this:
I suspect starting a container to run some aggregation command would likely be much fast
* For the generic problem of aggregating prefixes...and your list large (thousands)... I'd bet on container**Uhm........I suspect starting a container to run some aggregation command would likely be much fast
/ip firewall address-list add address=192.168.88.0 list=test_Start add address=192.168.88.1 list=test_Start add address=192.168.88.2 list=test_Start add address=192.168.88.3 list=test_Start add address=192.168.88.5 list=test_Start add address=192.168.88.6 list=test_Start add address=192.168.88.7 list=test_Start add address=192.168.88.8 list=test_Start add address=192.168.88.9 list=test_Start add address=192.168.88.10 list=test_Start add address=192.168.88.11 list=test_Start add address=192.168.88.12/31 list=test_Start add address=192.168.88.14 list=test_Start add address=192.168.88.15 list=test_Start add address=192.168.88.16 list=test_Start add address=192.168.88.18 list=test_Start add address=192.168.88.19 list=test_Start add address=192.168.88.20 list=test_Start add address=192.168.88.21 list=test_Start add address=192.168.88.26 list=test_Start add address=192.168.88.27 list=test_Start add address=192.168.88.28 list=test_Start add address=192.168.88.29 list=test_Start add address=192.168.88.30 list=test_Start add address=192.168.88.31 list=test_Start
/ip firewall address-list { :local toipprefix do={:return [[:parse ":return $1"]]} :local IPmustMask "^((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\/(3[0-2]|[0-2]\?[0-9])\$" :local IPoptiMask "^((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])(\\/(3[0-2]|[0-2]\?[0-9])){0,1}\$" :local IPwoutMask "^((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\$" :local field 0.0.0.0/0 :local sub 0.0.0.0/0 :local sub1 0.0.0.0/0 :local sub2 0.0.0.0/0 :local temp 0.0.0.0 # from 32 to 31 :local addrarray [:toarray ""] :local newarray [:toarray ""] :foreach item in=[print as-value where address~$IPoptiMask and list="test_Start"] do={ :set addrarray ($addrarray , ($item->"address")) } :foreach item in=$addrarray do={ :set field $item :if ($field~$IPwoutMask) do={:set field [:toip $field]} ; :if ($field~$IPmustMask) do={:set field [$toipprefix $field]} :if ([:typeof $field] = "ip-prefix") do={ :if ($field~"/31\$") do={ :if ([:find $newarray $field] = [:nothing]) do={ :set newarray ($newarray , $field) } } } :if ([:typeof $field] = "ip") do={ :set temp $field :set sub [$toipprefix ("$($temp & 255.255.255.254)/31")] :set sub1 ($temp & 255.255.255.254) :set sub2 (($temp & 255.255.255.254) + 1) :if (([:find $newarray $sub] = [:nothing]) and ([:find $newarray $field] = [:nothing])) do={ :if (([:find $addrarray $sub1] = [:nothing]) or ([:find $addrarray $sub2] = [:nothing])) do={ :set newarray ($newarray , $field) } else={ :set newarray ($newarray , $sub) } } } } # useless, just for debug :foreach item in=$newarray do={ add list="test_Inter31" address=$item } # from 31 to 30 :local addrarray $newarray :local newarray [:toarray ""] :foreach item in=$addrarray do={ :set field $item :if ($field~$IPwoutMask) do={:set field [:toip $field]} ; :if ($field~$IPmustMask) do={:set field [$toipprefix $field]} :if ([:typeof $field] = "ip") do={ :if ([:find $newarray $field] = [:nothing]) do={ :set newarray ($newarray , $field) } } :if ([:typeof $field] = "ip-prefix") do={ :if ($field~"/30\$") do={ :if ([:find $newarray $field] = [:nothing]) do={ :set newarray ($newarray , $field) } } :if ($field~"/31\$") do={ :set temp [:toip [:pick $field 0 [:find $field "/" -1]]] :set sub [$toipprefix ("$($temp & 255.255.255.252)/30")] :set sub1 [$toipprefix ("$($temp & 255.255.255.252)/31")] :set sub2 [$toipprefix ("$(($temp & 255.255.255.252) + 2)/31")] :if (([:find $newarray $sub] = [:nothing]) and ([:find $newarray $field] = [:nothing])) do={ :if (([:find $addrarray $sub1] = [:nothing]) or ([:find $addrarray $sub2] = [:nothing])) do={ :set newarray ($newarray , $field) } else={ :set newarray ($newarray , $sub) } } } } } # useless, just for debug :foreach item in=$newarray do={ add list="test_Inter30" address=$item } # from 30 to 29 :local addrarray $newarray :local newarray [:toarray ""] :foreach item in=$addrarray do={ :set field $item :if ($field~$IPwoutMask) do={:set field [:toip $field]} ; :if ($field~$IPmustMask) do={:set field [$toipprefix $field]} :if ([:typeof $field] = "ip") do={ :if ([:find $newarray $field] = [:nothing]) do={ :set newarray ($newarray , $field) } } :if ([:typeof $field] = "ip-prefix") do={ :if ($field~"/(29|31)\$") do={ :if ([:find $newarray $field] = [:nothing]) do={ :set newarray ($newarray , $field) } } :if ($field~"/30\$") do={ :set temp [:toip [:pick $field 0 [:find $field "/" -1]]] :set sub [$toipprefix ("$($temp & 255.255.255.248)/29")] :set sub1 [$toipprefix ("$($temp & 255.255.255.248)/30")] :set sub2 [$toipprefix ("$(($temp & 255.255.255.248) + 4)/30")] :if (([:find $newarray $sub] = [:nothing]) and ([:find $newarray $field] = [:nothing])) do={ :if (([:find $addrarray $sub1] = [:nothing]) or ([:find $addrarray $sub2] = [:nothing])) do={ :set newarray ($newarray , $field) } else={ :set newarray ($newarray , $sub) } } } } } :foreach item in=$newarray do={ add list="test_End" address=$item } }
add address=192.168.88.0/31 list=test_Interm31 add address=192.168.88.2/31 list=test_Interm31 add address=192.168.88.5 list=test_Interm31 add address=192.168.88.6/31 list=test_Interm31 add address=192.168.88.8/31 list=test_Interm31 add address=192.168.88.10/31 list=test_Interm31 add address=192.168.88.12/31 list=test_Interm31 add address=192.168.88.14/31 list=test_Interm31 add address=192.168.88.16 list=test_Interm31 add address=192.168.88.18/31 list=test_Interm31 add address=192.168.88.20/31 list=test_Interm31 add address=192.168.88.26/31 list=test_Interm31 add address=192.168.88.28/31 list=test_Interm31 add address=192.168.88.30/31 list=test_Interm31 add address=192.168.88.0/30 list=test_Interm30 add address=192.168.88.5 list=test_Interm30 add address=192.168.88.6/31 list=test_Interm30 add address=192.168.88.8/30 list=test_Interm30 add address=192.168.88.12/30 list=test_Interm30 add address=192.168.88.16 list=test_Interm30 add address=192.168.88.18/31 list=test_Interm30 add address=192.168.88.20/31 list=test_Interm30 add address=192.168.88.26/31 list=test_Interm30 add address=192.168.88.28/30 list=test_Interm30 add address=192.168.88.0/30 list=test_End add address=192.168.88.5 list=test_End add address=192.168.88.6/31 list=test_End add address=192.168.88.8/29 list=test_End add address=192.168.88.16 list=test_End add address=192.168.88.18/31 list=test_End add address=192.168.88.20/31 list=test_End add address=192.168.88.26/31 list=test_End add address=192.168.88.28/30 list=test_EndCreating different lists for debugging is wanted, of course...
Nono, what follow is the next step, I have already wrote something easy:Oh, friends, you've written something complicated here... say 5...
Rex TendedApparently Rex wants to do something universal, as always!
For what? The OP requestI already posted here the script for that, years ago.
Well, since your over-engineering @Sertik's problem (e.g. solving the more generic "prefix aggregation in address-list" problem)...For what?
$fantasylist help
Usage:
$fantasylist [spread=4] [density=50] [list=$fantasylist] [replace=yes] [ip=169.254.0.0] [fidelity=10]
spread= num of /24's to distribute random entires over (e.g. how many / 254)
density= percentage (as int) of used address over the total range (i.e. 50 = 50% of possible IP)
list= default is $fantasylist but can be any /ip/firewall/address-list
ip= the first possible IP address to use (e.g. 169.254.0.0 )
fidelity= during IP randomization, dups can happen...
but on-error is slow, so use lower fidelity=1 to speed creation
(at expense of accuracy to number of IPs requested by density=)
replace= any previous list created by $fantasylist is removed,
use 'replace=no' to keep an old entires in list
# create 25 IPs (density=10 is 10%) in an address-list over 169.254.0.0/24 (spread=1 is 254 IPs)
$fantasylist spread=1 density=10
remove previous list: $fantasylist
adding 169.254.0.100 in $fantasylist (25 / 25)
done! requested 25 and added 25 random IPs (off by 0) to $fantasylist (len=25) after 00:00:02.517758220
# create 645 IPs (density=1 is 1%) in an address-list over 169.254.0.0/16 (so spread=254 is /16)
$fantasylist spread=254 density=1
remove previous list: $fantasylist
adding 169.254.134.194 in $fantasylist (645 / 645)
done! requested 645 and added 645 random IPs (off by 0) to $fantasylist (len=645) after 00:00:03.615506500
:global fantasylist do={
:local tstart [:timestamp]
:local listname [:pick $0 1 255]
:if ([:typeof $list] = "str") do={
:set listname $list
}
:local lspread 4
:if ([:typeof [:tonum $spread]] = "num") do={
:set lspread [:tonum $spread]
}
:local ldensity 50
:if ([:typeof [:tonum $density]] = "num") do={
:set ldensity [:tonum $density]
}
:local start 169.254.0.0
:if ([:typeof [:toip $ip]] = "ip") do={
:set start [:toip $ip]
}
:local retries 10
:if ([:typeof [:tonum $fidelity]] = "num") do={
:set retries [:tonum $fidelity]
}
:local clean true
:if ($replace = "no") do={
:set clean false
}
:if ($1 = "help") do={
:put "Usage:\r\n$0 [spread=$lspread] [density=$ldensity] [list=$0] [replace=yes] [ip=$start] [fidelity=$retries]"
:put "\tspread=\t\tnum of /24's to distribute random entires over (e.g. how many / 254)"
:put "\tdensity=\tpercentage (as int) of used address over the total range (i.e. 50 = 50% of possible IP)"
:put "\tlist=\t\tdefault is $0 but can be any /ip/firewall/address-list"
:put "\tip=\t\tthe first possible IP address to use (e.g. $[:tostr $start] )"
:put "\tfidelity=\tduring IP randomization, dups can happen...\r\n\t\tso fidelity=$retries means try a new random IP $retries times\t\r\t\tbut on-error is slow, so use lower fidelity=1 to speed creation\r\n\t\t(at expense of accuracy to number of IPs requested by density=)"
:put "\treplace=\tany previous list created by $0 is removed,\r\n\t\tuse 'replace=no' to keep an old entires in list"
:return
}
:local possible (254*$lspread)
:local howmany ($possible*$ldensity/100)
/ip/firewall/address-list {
:if ($clean) do={
remove [find list=$listname]
:put "remove\tprevious list: $listname"
}
:put ""
:local numadded 0
:for listitem from=0 to=($howmany-1) do={
:retry max=$retries {
:local rndip ($start + [:rndnum from=0 to=$possible])
add address=$rndip list=$listname
/terminal/cuu
:put "adding\t$rndip\tin $listname\t($($listitem+1) / $howmany)"
:set numadded ($numadded+1)
} on-error={
:put "skipping number $listitem - no unique random ip after $retries tries (perhaps use fidelity=$($retries*2))\r\n"
}
}
:put "done! requested $howmany and added $numadded random IPs (off by $($howmany-$numadded)) to $listname (len=$[:len [find list=$listname]]) after $([:timestamp]-$tstart)"
}
}
# show help
$fantasylist help
# create 25 IPs (density=10 is 10%) in an address-list over 169.254.0.0/24 (spread=1 is 254 IPs)
$fantasylist spread=1 density=10
# create 645 IPs (density=1 is 1%) in an address-list over 169.254.0.0/16 (so spread=254 is /16)
$fantasylist spread=254 density=1
# to see how slow on-error= is, use higher density=
# which means a greater chance that random IP is already present...
# code will re-try another random IP, but as more IP...
# but harder to find unique one randomly
$fantasylist spread=1 density=75 fidelity=2
remove previous list: $fantasylist
adding 169.254.0.176 in $fantasylist (29 / 190)
skipping number 29 - no unique random ip after 2 tries (perhaps use fidelity=4)
adding 169.254.0.201 in $fantasylist (44 / 190)
skipping number 44 - no unique random ip after 2 tries (perhaps use fidelity=4)
adding 169.254.0.112 in $fantasylist (55 / 190)
[...]
done! requested 190 and added 161 random IPs (off by 29) to $fantasylist (len=161) after 00:01:06.894532020
$fantasylist spread=1 density=75 fidelity=10
remove previous list: $fantasylist
adding 169.254.0.146 in $fantasylist (190 / 190)
done! requested 190 and added 190 random IPs (off by 0) to $fantasylist (len=190) after 00:02:43.722691640
{ $fantasylist list=test_Start spread=16 density=75 fidelity=10; $ippa}
#and 42 minutes later...
On a Mac using homebrew's aggregate commands and SSH to Mikrotik to get same address-list... it finds one less...done! requested 3048 and added 3034 random IPs (off by 14) to test_Start (len=3034) after 00:42:59.374805740
# @rextended prefix aggregator then runs...in 1 minute 16 seconds...
before @rextended aggregation there are 3034 IPs
@rextended completed in 00:01:16.116526360
after @rextended aggregation there are 1532 IPs
time ssh admin@router '/ip/firewall/address-list/print proplist=address where list=test_Start' | awk '{ print $2"/32" }' | aggregate | wc -l
BUT it's off by one ONLY because the Mac CLI command finds a /28 somewhere in the same set — @rextended stops at /29.... But the Mac completes the aggregation of an address-list in about 1-2 seconds as see by `time`...aggregate: maximum prefix length permitted will be 32
1531
ssh admin@router 0.02s user 0.01s system 3% cpu 0.848 total
awk '{ print $2"/32" }' 0.01s user 0.00s system 2% cpu 0.846 total
aggregate 0.04s user 0.00s system 4% cpu 0.871 total
wc -l 0.00s user 0.00s system 0% cpu 0.870 total
:local list "inlist"
:local listblock "dahgers-list"
:local count 4
/ip firewall address-list {
:local ip2net do={:return [[:parse ":return $($1 & 255.255.255.0)/$2"]]}
:local addr 0.0.0.0
:local net 0.0.0.0
:foreach item in=[find where ([:typeof [:toip $address]]="ip") and (list=$list)] do={
:set addr [get $item address]
:set net [$ip2net $addr 24]
add address=$addr list=$listblock timeout=24h
:if ([:len [find where $address in $net]] > $count) do={
:log info "\r\nSearch results for $net"; print where $address in $net
}
}
}
# /ip firewall filter add action=drop chain=input comment="Dropping dangerous adresses" src-address-list=$list
:local Inlist "inlist"
:local listblock "dahgers-list"
:local count 4
/ip firewall address-list {
:local ip2net do={:return [[:parse ":return $($1 & 255.255.255.0)/$2"]]}
:local addr 0.0.0.0
:local net 0.0.0.0
:foreach item in=[find where ([:typeof [:toip $address]]="ip") and (list=$Inlist)] do={
:set addr [get $item address]
:set net [$ip2net $addr 24]
add address=$addr list=$listblock timeout=24h
:if ([:len [find where $address in $net]] > $count) do={
:log info "\r\nSearch results for $net"; print where $address in $net
}
}
}
# /ip firewall filter add action=drop chain=input comment="Dropping dangerous adresses" src-address-list=$Iistblock
The condition is extremely slow...Code: Select all[…] :local count 4 […] :if ([:len [find where $address in $net]] > $count) do={ […]
[…] :local pat [:pick $sub 0 ([:len $sub] - 4)] :local count 0 :foreach obj in=$addrarray do={ :if ($obj~$pat) do={:set count ($count + 1)} } :if ($count > 4) do={ […] } […]
# If the Start and End lists are the same, # at the end of the script the Start list will be deleted and recreated with the content of the processing. :local startList "inlist" :local endList "dahgers-list" ; # warning: at the end the whole End list is deleted and replaced :local count 4 /ip firewall address-list { :local toipprefix do={:return [[:parse ":return $1"]]} :local IPmustMask "^((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\/(3[0-2]|[0-2]\?[0-9])\$" :local IPoptiMask "^((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])(\\/(3[0-2]|[0-2]\?[0-9])){0,1}\$" :local IPwoutMask "^((25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\\.){3}(25[0-5]|(2[0-4]|[01]\?[0-9]\?)[0-9])\$" :local field 0.0.0.0/0 :local sub 0.0.0.0/0 :local sub1 0.0.0.0/0 :local sub2 0.0.0.0/0 :local temp 0.0.0.0 # from 32 and /24 to Fake24 :local addrarray [:toarray ""] :local newarray [:toarray ""] :foreach item in=[print as-value where address~$IPoptiMask and list=$startList] do={ :set addrarray ($addrarray , ($item->"address")) } :foreach item in=$addrarray do={ :set field $item :if ($field~$IPwoutMask) do={:set field [:toip $field]} ; :if ($field~$IPmustMask) do={:set field [$toipprefix $field]} :if ([:typeof $field] = "ip-prefix") do={ :if ($field~"/24\$") do={ :set field [:tostr $field] :if ([:typeof ($newarray->$field)] = "nil") do={:set ($newarray->$field) 0} :set ($newarray->$field) (($newarray->$field) + 1) } } :if ([:typeof $field] = "ip") do={ :set temp $field :set sub [:tostr [$toipprefix ("$($temp & 255.255.255.0)/24")]] :if ([:typeof ($newarray->$sub)] = "nil") do={:set ($newarray->$sub) 0} :set ($newarray->$sub) (($newarray->$sub) + 1) } } remove [find where list=$endList] :foreach x,y in=$newarray do={ :if ($y > $count) do={ add list=$endList address=$x comment=$y timeout=1d } } }
This script, what does it really do?I solved the speed problem...
Fake24 aggregator, now is really fast...
It cover only the OP request: If 5 or more IPs from same /24 try to attack, put all /24 on blacklist.This script, what does it really do?I solved the speed problem...
Fake24 aggregator, now is really fast...
can you give an example to understand it? thanks.
The QA department awaits the TRUE aggregator.The unfinished TRUE aggregator, now only to /29 max, instead it actually works as an aggregator, because aggregate only if the IPs are really present.
A separate topic, and link on my snippets, for that is created when is done.
The technique used for speed the program is avoid like the pest any "print" or "find" over the first needed for read the list....BTW, in my fantasy list creator $fantasylist found the same issue with [find] being slow...
:if ([:typeof ($newarray->$sub)] = "nil") do={:set ($newarray->$sub) 0} :set ($newarray->$sub) (($newarray->$sub) + 1)is the more elegant way I find for avoid "find if exist more than 4", instead, I add to the address-list, at the end, only the entry that have counter > 4
:if ([:typeof ($newarray->$sub)] = "nil") do={:set ($newarray->$sub) 1} else={:set ($newarray->$sub) (($newarray->$sub) + 1)}and also on other points, but require time...
@rextended, I wrote new version my random address-list generator and put in separate topic here: viewtopic.php?t=198298[...] avoid like the pest any "print" or "find" over the first needed for read the list....BTW, in my fantasy list creator $fantasylist found the same issue with [find] being slow...
> $FAKEAL list=test_Start spread=16 density=75; $Pippa
using address-list test_Start
remove test_Start done
adding 100% 169.254.15.223 (added 2050 at 4063 of 4064)
runtime 00:00:01
done! wanted 3048 got 2050 (off by 998) in test_Start (length 2050)
before @rextended aggregation there are 2050 IPs
completed in 00:00:53.501365120
after @rextended aggregation there are 1502 IP