-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Theo Van Dinter writes:
> On Tue, Apr 26, 2005 at 12:34:20PM -0700, Justin Mason wrote:
> > I have a hard time figuring out how Net::DNS could be using the same
> > counter value, since it just uses rand() to seed it and counts
> > consecutively from there by default -- plus there's very few places
> > we still use Net::DNS::Resolver::search() or bgsend().
> 
> Unless I missed something, no it doesn't.  It sets the initial counter
> based on pid (no rand), then increments each time.

no, Net::DNS uses rand() -- as you can see ;), *we* don't.

> $DNS_ID_COUNTER = (($$ >> 10) ^ (($$ << 6) & 0xffff));
> 
> My only theory right now is that there are problems once the counter wraps
> around the full 16-bits.  The current code may work fine in spamd, whose
> children don't tend to have a huge lifespan.  However, in mass-check,
> the children (unless --restart is used) live for the entirety of the
> run so looping is much more likely.

> I'm trying a small patch which basically calls the reinit function when
> the counter wraps to 0, as well as using rand when initializing.  This way
> it'll get a new random starting point and a new socket occasionally.

deffo worth a try.  I'm also doing a run here, logging all query IDs
and responses using warn(), and logging IDs for uridnsbl collisions:

Index: lib/Mail/SpamAssassin/DnsResolver.pm
===================================================================
- --- lib/Mail/SpamAssassin/DnsResolver.pm      (revision 164864)
+++ lib/Mail/SpamAssassin/DnsResolver.pm        (working copy)
@@ -206,7 +206,7 @@
     $packet->header()->id($DNS_ID_COUNTER);
 
     # a bit noisy, so commented by default...
- -    # dbg("dns: new DNS packet h=$host t=$type id=$DNS_ID_COUNTER");
+    warn("dns: new DNS packet h=$host t=$type id=$DNS_ID_COUNTER");
   };
 
   if ($@) {
@@ -297,7 +297,7 @@
 
     my $cb = delete $self->{id_to_callback}->{$id};
     if (!$cb) {
- -      dbg("dns: no callback for id number: $id, ignored; packet: ".
+      warn("dns: no callback for id=$id, ignored; packet: ".
                                 $packet->string);
       return 0;
     }
Index: lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm
===================================================================
- --- lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm  (revision 164864)
+++ lib/Mail/SpamAssassin/Plugin/URIDNSBL.pm    (working copy)
@@ -620,7 +620,8 @@
       # this zone is a simple rule, not a set of subrules
       # skip any A record that isn't on 127/8
       if ($rr->type eq 'A' && $rr->rdatastr !~ /^127\./) {
- -     warn("uridnsbl: bogus rr for domain=$dom, rule=$rulename, rr=" . 
$rr->string);
+       warn("uridnsbl: bogus rr for domain=$dom, rule=$rulename, id=" .
+            $packet->header->id." rr=".$rr->string);
        next;
       }
       $self->got_dnsbl_hit($scanstate, $ent, $rdatastr, $dom, $rulename);
@@ -631,7 +632,8 @@
       if ($rr->type eq 'A' && $rr->rdatastr !~ /^127\./ &&
          !($uridnsbl_subs_bits & 0xff000000))
       {
- -     warn("uridnsbl: bogus rr: domain=$dom, zone=$ent->{zone}, rr=" . 
$rr->string);
+       warn("uridnsbl: bogus rr: domain=$dom, zone=$ent->{zone}, id=" .
+            $packet->header->id." rr=".$rr->string);
        next;
       }
       foreach my $subtest (keys (%{$uridnsbl_subs}))
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.5 (GNU/Linux)
Comment: Exmh CVS

iD8DBQFCbqM1MJF5cimLx9ARAmixAKCKlpam9q1V5vhi01Nv2n0+8+UkwACfUrAI
Ink3yZy7ycNFvDZkTOMh8OM=
=ZK2r
-----END PGP SIGNATURE-----

Reply via email to