fw-addr-lists: warn on possible truncation

... as fetch truncates data at about 64kB, reported in SUP-132297.
This commit is contained in:
Christian Hesse 2023-12-13 15:57:28 +01:00
parent db5ff00b5a
commit f9528f0ac5

View file

@ -16,6 +16,7 @@
:global CertificateAvailable; :global CertificateAvailable;
:global EitherOr; :global EitherOr;
:global LogPrintExit2; :global LogPrintExit2;
:global LogPrintOnce;
:global ScriptLock; :global ScriptLock;
:global WaitFullyConnected; :global WaitFullyConnected;
@ -72,6 +73,10 @@ $WaitFullyConnected;
$LogPrintExit2 warning $0 ("Failed downloading list from: " . $List->"url") false; $LogPrintExit2 warning $0 ("Failed downloading list from: " . $List->"url") false;
} }
:if ([ :len $Data ] > 63000) do={
$LogPrintOnce warning $0 ("The list is huge and may be truncated: " . $List->"url");
}
:while ([ :len $Data ] != 0) do={ :while ([ :len $Data ] != 0) do={
:local Line [ :pick $Data 0 [ :find $Data "\n" ] ]; :local Line [ :pick $Data 0 [ :find $Data "\n" ] ];
:local Address ([ :pick $Line 0 [ $FindDelim $Line ] ] . ($List->"cidr")); :local Address ([ :pick $Line 0 [ $FindDelim $Line ] ] . ($List->"cidr"));