From owner-freebsd-net@freebsd.org Mon Sep 5 12:47:23 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 E910CA9D4D4 for ; Mon, 5 Sep 2016 12:47:23 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: from mail-it0-x22a.google.com (mail-it0-x22a.google.com [IPv6:2607:f8b0:4001:c0b::22a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7DD6FEB for ; Mon, 5 Sep 2016 12:47:23 +0000 (UTC) (envelope-from sobomax@sippysoft.com) Received: by mail-it0-x22a.google.com with SMTP id e124so144728979ith.0 for ; Mon, 05 Sep 2016 05:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sippysoft-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to; bh=q9LOcecAId2BjcJxQOr9nUPICxWNbs3g8Q7tLxp8A48=; b=xnZhayGe7ZBEbGtnX2FLkAlrOU7Z8X3BdWxvCGBGTzekKu0N0qnPE3aeVv/OKywDu+ q6IuH8d/NSxO5BZwbW0ZjZKwxhF5t3V1S6vP4W541LbIzTRZcNEo+lcPXNAXbRtDXi2f tvXxtB3++g+ceuDWjF+/XhAFtQH4Thn6H/wrY1iuL1aqexgEqM/Cg9DRZWWPKboCCCWu cHRqFnS7ABx49+HjJd08lCJ9YgfHOCTrXFvu0dSJsLQaKf0DRObWNY0Wqr8jrD9FOg58 poN7jdejyewJOCAeRD9i53DAXUI9MNETllDlPsW1mxSDEyCKh49xeCU7vwB5uojV/gpu S40Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to; bh=q9LOcecAId2BjcJxQOr9nUPICxWNbs3g8Q7tLxp8A48=; b=Yc+auy5z4WgU+s+dxT4OphvH9Uq7xv44z/S6tPQP5xWJ9Zh66HxVg5P8yb4XDaRiy6 XYRWAV0gu/7+Hr0oM3jUyjuET9NBMB/FeigahLbEsR2aAKL1kqBE32zMPKWSeGM0wNiP xBXaN8TZo6HXsZFt1P0fI3IpSWyo2Wz/DNzC2e8iFFau++OP00r9rcjEJSChXczb0q2x Vaow9jrQBy9urMyOXYm4amhn+vRe10bBgjz/I1AyS54Gatuc7IhKlC41lWNAFUr1Bf02 d18CsbqDrkso7hYc5ZEVzgqfXrF6/cPIyypueARFx9KuCbGVEMAAgy55QEv2WSF/3AhY BZEQ== X-Gm-Message-State: AE9vXwNTOoCkbMUWfb0/IZ3SvhX4nIkipfADKRux2tm21mPC7iXkT47pzh/YnIda5W/pmagYFVVzUXeRhVignuIp X-Received: by 10.36.209.130 with SMTP id w124mr25100933itg.2.1473079643098; Mon, 05 Sep 2016 05:47:23 -0700 (PDT) MIME-Version: 1.0 Sender: sobomax@sippysoft.com Received: by 10.36.149.196 with HTTP; Mon, 5 Sep 2016 05:47:22 -0700 (PDT) In-Reply-To: References: From: Maxim Sobolev Date: Mon, 5 Sep 2016 05:47:22 -0700 X-Google-Sender-Auth: 8GQI_9Ubr61_nWylh6WWs1tbYHs Message-ID: Subject: Re: Which UDP sockets the incoming packet is delivered to when both wildcard and non-wildcard listeners are present To: FreeBSD Net , Gleb Smirnoff Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 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 12:47:24 -0000 P.S. Destination UDP address of the message in question is obviously X.Y.Z.W:5071. On Mon, Sep 5, 2016 at 5:42 AM, Maxim Sobolev wrote: > 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 >