Theo Van Dinter wrote:
> It looks like 4260 was
> committed as r161778, the nightly run was r164362.
Do people think we should reopen 4260?
This could happen if the random ID isn't random enough or 16 bits isn't
large enough to avoid collisions. I don't see how that would happen if
different processes choose different ports to listen on, as there should be
no way then for queries to collide across processes and with the ID being
incremented each time there should be no collision within the same process.
If somehow the IDs are colliding, the fix would be to include some
information from the question along with the 16 bit ID to prevent that. I
have a small patch that will do that, but I would like to see it used in a
test to find out if it has anything to do with the problem before proposing
to use it for real.
Theo, would you be willing to run a mass test with this to see if it helps?
$ svn diff lib/Mail/SpamAssassin/DnsResolver.pm
Index: lib/Mail/SpamAssassin/DnsResolver.pm
===================================================================
--- lib/Mail/SpamAssassin/DnsResolver.pm (revision 164463)
+++ lib/Mail/SpamAssassin/DnsResolver.pm (working copy)
@@ -45,7 +45,7 @@
use Mail::SpamAssassin::Logger;
use IO::Socket::INET;
-
+use Digest::SHA1 qw(sha1_base64);
our @ISA = qw();
# a counter value to use for DNS ID numbers in new_dns_packet().
@@ -243,8 +243,8 @@
return if $self->{no_resolver};
my $pkt = $self->new_dns_packet($host, $type, $class);
-
- my $id = $pkt->header->id;
+ $host =~ s/\.$//;
+ my $id = substr(sha1_base64($host . $pkt->header->id), -8);
my $data = $pkt->data;
my $dest = $self->{dest};
if (!$self->{sock}->send ($pkt->data, 0, $self->{dest})) {
@@ -291,8 +291,11 @@
defined $packet->answer)
{
my $header = $packet->header;
- my $id = $header->id;
-
+ my @questions = $packet->question;
+ my $ques = $questions[0];
+ my $host = $ques->qname;
+ my $nid = $header->id;
+ my $id = substr(sha1_base64($host . $nid), -8);
# dbg("dns: reply id=$id");
my $cb = delete $self->{id_to_callback}->{$id};