Which UDP sockets the incoming packet is delivered to when both wildcard and non-wildcard listeners are present

Maxim Sobolev sobomax at freebsd.org
Mon Sep 5 12:42:34 UTC 2016


Hi Netters,

Suppose we have two threads in the system both bound to a same specific UDP
port, one using INADDR_ANY and another one using actual IP. When incoming
message arrives to that port is there any guarantee as to which of those
two threads going to see the message? The question has arisen from the
observation that most of the time the thread that is bound to a specific IP
gets them, but occasionally we see INADDR_ANY-bound thread receiving few
packets as well. So that behavior seems to be "almost deterministic" and we
are wondering where that "almost" part is expected or some kind of socket
matching bug?

OS in question is 10.3-RELEASE-p5

[ssp-root at dal23 ~]$ sockstat | grep 24421 | grep udp4 | grep -w 5071
b2bua    python2.7  24421 7  udp4   *:5071                *:*
b2bua    python2.7  24421 58 udp4   X.Y.Z.W:5071     *:*

I apologize if this is answered somewhere already, any pointers would be
appreciated. Thanks!

-Max


More information about the freebsd-net mailing list