More of the fix for bug #7118 - nmbd problems with socket address.
commit85ec12a06d5834fa7b9b8269bbe47387def9928e
authorJeremy Allison <jra@samba.org>
Wed, 10 Feb 2010 20:32:05 +0000 (10 12:32 -0800)
committerKarolin Seeger <kseeger@samba.org>
Mon, 15 Feb 2010 09:26:04 +0000 (15 10:26 +0100)
tree6dd4905b039927217217042b0fc1e75cb3dce293
parent8925ef04a1967f96857f5c2445927c7a263b9178
More of the fix for bug #7118 - nmbd problems with socket address.

Add a simple "processed packet queue" cache to stop nmbd responding to
packets received on the broadcast and non-broadcast socket (which
it has opened when "nmbd bind explicit broadcast = yes").

This is a very simple packet queue - it only keeps the packets
processed during a single call to listen_for_packets() (i.e. one
select call). This means that if the delivery notification for a
packet received on both broadcast and non-broadcast addresses
is done in two different select calls, the packet will still be
processed twice. This is a very rare occurrance and we can just
live with it when it does as the protocol is stateless. If this
is ever flagged as a repeatable problem then we can add a longer
lived cache, using timeout processing to clear etc. etc. But without
storing all packets processed we can never be *sure* we've eliminated
the race condition so I'm going to go with this simple solution until
someone proves a more complex one is needed :-).

Jeremy.
(cherry picked from commit 6fe7ee1d216fcf722b3efa23fd80782ce0dd0e9f)
source3/nmbd/nmbd_packets.c