1 Index: lib/Mail/SpamAssassin.pm
2 ===================================================================
3 --- lib/Mail/SpamAssassin.pm (revision 322461)
4 +++ lib/Mail/SpamAssassin.pm (working copy)
6 override the settings for C<rules_filename>, C<site_rules_filename>,
7 and C<userprefs_filename>.
11 +If set to 1, DNS tests will not attempt to use IPv6. Use if the existing tests
12 +for IPv6 availablity produce incorrect results or crashes.
14 =item languages_filename
16 If you want to be able to use the language-guessing rule
17 Index: lib/Mail/SpamAssassin/DnsResolver.pm
18 ===================================================================
19 --- lib/Mail/SpamAssassin/DnsResolver.pm (revision 322461)
20 +++ lib/Mail/SpamAssassin/DnsResolver.pm (working copy)
23 use Errno qw(EINVAL EADDRINUSE);
25 -use constant HAS_SOCKET_INET6 => eval { require IO::Socket::INET6 };
26 +use constant HAS_SOCKET_INET6 => eval { require IO::Socket::INET6; defined AF_INET6 };
32 if (defined $self->{res}) { return 1; }
33 $self->{no_resolver} = 1;
35 + # force only ipv4 if no IO::Socket::INET6 or ipv6 doesn't work
36 + my $force_ipv4 = (!HAS_SOCKET_INET6) || $self->{main}->{force_ipv4} ||
38 + my $sock6 = IO::Socket::INET6->new(
50 $self->{res} = Net::DNS::Resolver->new;
51 if (defined $self->{res}) {
52 $self->{no_resolver} = 0;
53 - $self->{retry} = 1; # retries for non-nackgrounded query
54 + $self->{force_ipv4} = $force_ipv4;
55 + $self->{retry} = 1; # retries for non-backgrounded query
56 $self->{retrans} = 3; # initial timeout for "non-backgrounded" query run in background
57 $self->{res}->retry(1); # If it fails, it fails
58 $self->{res}->retrans(0); # If it fails, it fails
60 $self->{res}->udp_timeout(3); # timeout of 3 seconds only
61 $self->{res}->persistent_tcp(0); # bug 3997
62 $self->{res}->persistent_udp(0); # bug 3997
63 + $self->{res}->force_v4($force_ipv4);
66 }; # or warn "dns: eval failed: $@ $!\n";
68 + dbg("dns: no ipv6") if $force_ipv4;
69 dbg("dns: is Net::DNS::Resolver available? " .
70 ($self->{no_resolver} ? "no" : "yes"));
71 if (!$self->{no_resolver} && defined $Net::DNS::VERSION) {
74 =item $res->nameservers()
76 -Wrapper for Net::DNS::Reslolver->nameservers to get or set list of nameservers
77 +Wrapper for Net::DNS::Resolver->nameservers to get or set list of nameservers
82 my $ip64 = IP_ADDRESS;
83 my $ip4 = IPV4_ADDRESS;
84 my $ns = $self->{res}->{nameservers}[0];
86 + my $ipv6 = 0; # this will be set if we have an ipv6 nameserver
87 + my $ipv6opt = !($self->{force_ipv4});
89 # now, attempt to set the family to AF_INET6 if we can. Some
90 # platforms don't have it (bug 4412 comment 29)...
91 # also, only set $ipv6 to true if that succeeds.
93 - if (HAS_SOCKET_INET6 && $ns=~/^${ip64}$/o && $ns!~/^${ip4}$/o) {
94 + if ($ipv6opt && $ns=~/^${ip64}$/o && $ns!~/^${ip4}$/o) {
95 eval '$family = AF_INET6; $ipv6 = 1;';
97 if (!defined $family) {
102 - if (HAS_SOCKET_INET6) {
104 $sock = IO::Socket::INET6->new(%args);
106 $sock = IO::Socket::INET->new(%args);
107 Index: lib/spamassassin-run.pod
108 ===================================================================
109 --- lib/spamassassin-run.pod (revision 322461)
110 +++ lib/spamassassin-run.pod (working copy)
112 --add-addr-to-whitelist=addr Add addr to persistent address whitelist
113 --add-addr-to-blacklist=addr Add addr to persistent address blacklist
114 --remove-addr-from-whitelist=addr Remove addr from persistent address list
115 + --ipv4only, --ipv4-only, --ipv4 Disable attempted use of ipv6 for DNS
116 --progress Print progress bar
117 -D, --debug [area=n,...] Print debugging messages
118 -V, --version Print version
120 you must be running C<spamassassin> or C<spamd> with a persistent address
121 list plugin enabled for this to work.
123 +=item B< --ipv4only>, B<--ipv4-only>, B<--ipv4>
125 +Do not use IPv6 for DNS tests. Normally, SpamAssassin will try to detect if
126 +IPv6 is available, using only IPv4 if it is not. Use if the existing tests
127 +for IPv6 availablity produce incorrect results or crashes.
129 =item B<-L>, B<--local>
131 Do only the ''local'' tests, ones that do not require an internet connection to
132 Index: spamassassin.raw
133 ===================================================================
134 --- spamassassin.raw (revision 322461)
135 +++ spamassassin.raw (working copy)
137 'debug|D:s' => \$opt{'debug'},
138 'error-code|exit-code|e:i' => \$opt{'error-code'},
139 'help|h|?' => \$opt{'help'},
140 + 'ipv4only|ipv4-only|ipv4' => \$opt{'force_ipv4'},
141 'lint' => \$opt{'lint'},
142 'local-only|local|L' => \$opt{'local'},
143 'mbox' => sub { $opt{'format'} = 'mbox'; },
145 rules_filename => $opt{'configpath'},
146 site_rules_filename => $opt{'siteconfigpath'},
147 userprefs_filename => $opt{'prefspath'},
148 + force_ipv4 => $opt{'force_ipv4'},
149 local_tests_only => $opt{'local'},
150 debug => $opt{'debug'},
151 dont_copy_prefs => ( $opt{'create-prefs'} ? 0 : 1 ),
152 Index: spamd/spamd.raw
153 ===================================================================
154 --- spamd/spamd.raw (revision 322461)
155 +++ spamd/spamd.raw (working copy)
157 'helper-home-dir|H:s' => \$opt{'home_dir_for_helpers'},
158 'help|h' => \$opt{'help'},
159 'ident-timeout=f' => \$opt{'ident-timeout'},
160 + 'ipv4only|ipv4-only|ipv4' => \$opt{'force_ipv4'},
161 'ldap-config!' => \$opt{'ldap-config'},
162 'listen-ip|ip-address|i:s' => \$opt{'listen-ip'},
163 'local!' => \$opt{'local'},
165 dont_copy_prefs => $dontcopy,
166 rules_filename => ( $opt{'configpath'} || 0 ),
167 site_rules_filename => ( $opt{'siteconfigpath'} || 0 ),
168 + force_ipv4 => ( $opt{'force_ipv4'} || 0 ),
169 local_tests_only => ( $opt{'local'} || 0 ),
170 debug => ( $opt{'debug'} || 0 ),
171 paranoid => ( $opt{'paranoid'} || 0 ),
172 @@ -2181,6 +2183,7 @@
173 -d, --daemonize Daemonize
174 -h, --help Print usage message.
175 -i [ipaddr], --listen-ip=ipaddr Listen on the IP ipaddr
176 + --ipv4only, --ipv4-only, --ipv4 Disable attempted use of ipv6 for DNS
177 -p port, --port=port Listen on specified port
178 -m num, --max-children=num Allow maximum num children
179 --min-children=num Allow minimum num children
180 @@ -2499,6 +2502,11 @@
181 Higher priority informational messages that are suitable for logging in normal
182 circumstances are available with an area of "info".
184 +=item B< --ipv4only>, B<--ipv4-only>, B<--ipv4>
186 +Do not use IPv6 for DNS tests. Use if the existing tests
187 +for IPv6 availablity produce incorrect results or crashes.
189 =item B<-L>, B<--local>
191 Perform only local tests on all mail. In other words, skip DNS and other