Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Sep 2016 05:42:33 -0700
From:      Maxim Sobolev <sobomax@freebsd.org>
To:        FreeBSD Net <freebsd-net@freebsd.org>, Gleb Smirnoff <glebius@freebsd.org>
Subject:   Which UDP sockets the incoming packet is delivered to when both wildcard and non-wildcard listeners are present
Message-ID:  <CAH7qZfvZ63rcNhrwzMzbTkB8S-F%2Bk1FF=0vXvgwd%2BqGPSyA%2BcQ@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
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@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAH7qZfvZ63rcNhrwzMzbTkB8S-F%2Bk1FF=0vXvgwd%2BqGPSyA%2BcQ>