From owner-freebsd-net@freebsd.org Mon Sep 5 13:48:21 2016 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 487C4B964AD for ; Mon, 5 Sep 2016 13:48:21 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward4j.cmail.yandex.net (forward4j.cmail.yandex.net [IPv6:2a02:6b8:0:1630::17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C262CF9B; Mon, 5 Sep 2016 13:48:20 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from smtp1p.mail.yandex.net (smtp1p.mail.yandex.net [IPv6:2a02:6b8:0:1472:2741:0:8b6:6]) by forward4j.cmail.yandex.net (Yandex) with ESMTP id DFE2320DF2; Mon, 5 Sep 2016 16:48:17 +0300 (MSK) Received: from smtp1p.mail.yandex.net (localhost.localdomain [127.0.0.1]) by smtp1p.mail.yandex.net (Yandex) with ESMTP id C4A691780986; Mon, 5 Sep 2016 16:48:16 +0300 (MSK) Received: by smtp1p.mail.yandex.net (nwsmtp/Yandex) with ESMTPSA id 41exwgjcnA-mFwq3nCq; Mon, 05 Sep 2016 16:48:15 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1473083295; bh=rByx1X6jwtLzrQW1NAD3XYNhp1oOXbggGlZXX6YNl58=; h=Subject:To:References:From:Message-ID:Date:In-Reply-To; b=qcnO1uldSqtahySOyWiUrpxW3E7/drI1PfeUWBXeucEosnh9AI13Hw7gt0wvLkr18 OD6ArT6uG/LfkLhGPDZgVXy7T9lrKhnB9CPj2olSAo2p6um0D/+edVDfngNGhGOvUe Kt9Utz2RSlSJqu5dvb1hNK2jSO337sSc0VIuXia8= Authentication-Results: smtp1p.mail.yandex.net; dkim=pass header.i=@yandex.ru X-Yandex-Suid-Status: 1 0,1 0,1 0 Subject: Re: Which UDP sockets the incoming packet is delivered to when both wildcard and non-wildcard listeners are present To: Maxim Sobolev , FreeBSD Net , Gleb Smirnoff References: From: "Andrey V. Elsukov" Message-ID: Date: Mon, 5 Sep 2016 16:46:17 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5VbiFm0ebbL8ttbXHxreUOtTE0A4A0FRI" X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Sep 2016 13:48:21 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --5VbiFm0ebbL8ttbXHxreUOtTE0A4A0FRI Content-Type: multipart/mixed; boundary="vxhEb7ONWc6MIuvqeOsEVuQstACl9ujL9" From: "Andrey V. Elsukov" To: Maxim Sobolev , FreeBSD Net , Gleb Smirnoff Message-ID: Subject: Re: Which UDP sockets the incoming packet is delivered to when both wildcard and non-wildcard listeners are present References: In-Reply-To: --vxhEb7ONWc6MIuvqeOsEVuQstACl9ujL9 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable On 05.09.16 15:42, Maxim Sobolev wrote: > 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 incomi= ng > message arrives to that port is there any guarantee as to which of thos= e > 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 specifi= c IP > gets them, but occasionally we see INADDR_ANY-bound thread receiving fe= w > packets as well. So that behavior seems to be "almost deterministic" an= d we > are wondering where that "almost" part is expected or some kind of sock= et > matching bug? Are your sockets connected? I.e. did you use connect+send? And do you receive unicast datagrams or some broadcast/multicast can appear? --=20 WBR, Andrey V. Elsukov --vxhEb7ONWc6MIuvqeOsEVuQstACl9ujL9-- --5VbiFm0ebbL8ttbXHxreUOtTE0A4A0FRI Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEvBAEBCAAZBQJXzXctEhxidTdjaGVyQHlhbmRleC5ydQAKCRABxeoEEMihetDJ B/wNrwZlItx9l6jG6CbCsrSXor4TjNgf+WCAAb8tBSHvL38mWEUKuQCJ3pHBMbRT PEe+iNa3rrBc0DO/Q4DfLG333iBmMeNbwXZUMPQ6Bx4BWJh929c7uAPdWcRxR4IP 1dgpqck6YJ+N2z/yQLatNb3it2kOgKkjX9qrncSeCBakeWTm7wdOP5ViVBPPG0XG emVxd6oED3parfyPm8QMqdJ+RSW0TojKc7A3HV/wNuYIRmJtjRJyFf4yFiZBufgJ /C762EnYk6PcaLN83h8Ok+QDSUeRd7k1c33TMB75bjAA3iusII3qJla3e1bd/lMj Uzc8vhG8SUkx0asQFaK6hQAt =gq2O -----END PGP SIGNATURE----- --5VbiFm0ebbL8ttbXHxreUOtTE0A4A0FRI--