Skip to contentSkip to conversation

asn: fix missing quiet checks in xt_asn_build

PATCH New Philip Prindeville 1 participant 1 message Jun 15, 2025 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 asn: fix missing quiet checks in xt_asn_build

From: Philip Prindeville <[email protected]>

Conceivably someone might want to run a refresh of the ASN database from within a script, particularly an unattended script such as a cron job. Do not generate output in that case.

Also, do not send normal (progress) output to STDERR.

---
 asn/xt_asn_build | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
asn/xt_asn_build +2 -1
index 63019ca689c56d5c9c686838fc4cc758047887e5..81c4965e572bbc7857a4832e0b80669104fe209f 100755
@@ -12,6 +12,7 @@ use Socket qw(AF_INET AF_INET6 inet_pton);
 use warnings;
 use Text::CSV_XS; # or trade for Text::CSV
 use strict;
+$| = 1;
 
 my $csv = Text::CSV_XS->new({
 	allow_whitespace => 1,
@@ -189,7 +190,7 @@ sub writeASN
 	printf "%5u IPv%s ranges for %s\n",
 		scalar(@ranges),
 		($family == AF_INET ? '4' : '6'),
-		$asn_number;
+		$asn_number unless ($quiet);
 
 	my $file = "$target_dir/".$asn_number.".iv".($family == AF_INET ? '4' : '6');
 	if (!open($fh, '>', $file)) {
Signature · 1 line
2.43.0