http://bugzilla.spamassassin.org/show_bug.cgi?id=3997





------- Additional Comments From [EMAIL PROTECTED]  2005-04-12 15:42 -------
I think I now understand the problem and a simnple solution.

The problem is that there is nothing in the RFCs to prevent reuse of a UDP
source port once there is no active listener on that port. UDP connections are
not persistent, so there is nothing that IO::Socket can do to ensure that a
reply to a UDP port is not a response to some old packet that was sent from that
port.

This is a known problem in the DNS world, with a solution built in to the DNS
protocol. The DNS query packet has a header with an identifier field, which is
an arbitrary 16 bit number set by the sender. The nameserver copies it to the
identifier field of the header of the response packet. See
 
http://www.tcpipguide.com/free/t_DNSMessageHeaderandQuestionSectionFormat.htm#Table_169

This is above the IO::Socket layer, so the fix can't be there. Net::DNS can't
use the ID field to ensure that a bgread matches up with a bgsend unless it
cached every socket returned by bgsend in order to save the ID in a hash with
it. I don't think that is practical.

That leaves SpamAssassin as the right level for the fix.

I think all that would be necessary is for the call to bgsend to pass in a
Net::DNS::Packet object instead of a list of strings. Make the packet object
from the arguments that now are being passed to bgsend, use
$packet->header()->id($counter) to set the ID field to a unique 16 bit value
(incrementing a counter would be fine, no problem if it overflows), bgsend it,
and save the counter along with the socket in the list of pending queries. When
the reply arrives, confirm that the ID field of the header of the response
matches the one saved with the socket.

I'm not in a position to prepare and test a patch right now, but this looks like
something that would be simple to whip up.



------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

Reply via email to