mirror of
https://github.com/eworm-de/routeros-scripts.git
synced 2025-12-07 10:29:29 +00:00
fw-addr-lists: do not use IPv6 net addresses smaller /64
This should reduce the number of addresses in list by aggregating them, and also fix addresses with host part set (like 2001:470:1:fb5::2a0/64, which should be 2001:470:1:fb5::/64 really). The latter caused new warnings with RouterOS 7.21beta2.
This commit is contained in:
parent
5ffa85f8bf
commit
9ceed0926a
1 changed files with 8 additions and 2 deletions
|
|
@ -25,6 +25,7 @@
|
|||
:global LogPrint;
|
||||
:global LogPrintOnce;
|
||||
:global LogPrintVerbose;
|
||||
:global MIN;
|
||||
:global ScriptLock;
|
||||
:global WaitFullyConnected;
|
||||
|
||||
|
|
@ -120,9 +121,14 @@
|
|||
:error true;
|
||||
}
|
||||
:if ($Address ~ "^[0-9a-zA-Z]*:[0-9a-zA-Z:\\.]+(/[0-9]{1,3})?\$") do={
|
||||
:if ([ :typeof [ :find $Address "/" ] ] = "nil") do={
|
||||
:set Address ($Address . "/128");
|
||||
:local Net $Address;
|
||||
:local Cidr 64;
|
||||
:local Slash [ :find $Address "/" ];
|
||||
:if ([ :typeof $Slash ] = "num") do={
|
||||
:set Net [ :toip6 [ :pick $Address 0 $Slash ] ]
|
||||
:set Cidr [ $MIN [ :pick $Address ($Slash + 1) [ :len $Address ] ] 64 ];
|
||||
}
|
||||
:set Address (([ :toip6 $Net ] & ffff:ffff:ffff:ffff::) . "/" . $Cidr);
|
||||
:set ($IPv6Addresses->$Branch->$Address) $TimeOut;
|
||||
:error true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue