You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spamassassin.apache.org by jq...@apache.org on 2015/11/23 20:59:00 UTC

svn commit: r1715937 - /spamassassin/trunk/sa-update.raw

Author: jquinn
Date: Mon Nov 23 19:59:00 2015
New Revision: 1715937

URL: http://svn.apache.org/viewvc?rev=1715937&view=rev
Log:
sa-update tries both ipv6 and ipv4

Modified:
    spamassassin/trunk/sa-update.raw

Modified: spamassassin/trunk/sa-update.raw
URL: http://svn.apache.org/viewvc/spamassassin/trunk/sa-update.raw?rev=1715937&r1=1715936&r2=1715937&view=diff
==============================================================================
--- spamassassin/trunk/sa-update.raw (original)
+++ spamassassin/trunk/sa-update.raw Mon Nov 23 19:59:00 2015
@@ -740,6 +740,16 @@ foreach my $channel (@channels) {
       my $mirror_info = $mirrors{$mirror};
       delete $mirrors{$mirror};
 
+      if (!check_mirror_af($mirror)) {
+	  my @my_af;
+	  push(@my_af, "IPv4") if ($have_inet4);
+	  push(@my_af, "IPv6") if ($have_inet6);
+	  push(@my_af, "no IP service") if ($#my_af < 0) 
+	  dbg("reject mirror " . $mirror . ": no common address family"
+	      . " (" . join(" ", @af) . ")");
+	  next;
+      }
+
       dbg("channel: selected mirror $mirror");
 
       # Actual archive file
@@ -1593,6 +1603,17 @@ sub choose_mirror {
 }
 
 ##############################################################################
+
+sub check_mirror_af {
+    my ($mirror) = @_;
+    my($a_rr, $aaaa_rr);
+    $mirror =~ s/[a-z][a-z09]+:\/\///;  # strip http:// or https:// or other
+    return 1 if ($have_inet4 && do_dns_query($mirror, "A"));
+    return 1 if ($have_inet6 && do_dns_query($mirror, "AAAA"));
+    return 0;
+}
+
+##############################################################################
 
 sub print_version {
   printf("sa-update version %s\n  running on Perl version %s\n", $VERSION,