From nobody Fri Nov 04 00:09:07 2022 X-Original-To: net@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4N3Lb06Tt8z4h7mH for ; Fri, 4 Nov 2022 00:09:16 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4N3LZz6yHvz3fVg; Fri, 4 Nov 2022 00:09:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 2A4097Eo004765 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Thu, 3 Nov 2022 17:09:07 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 2A4097j5004764; Thu, 3 Nov 2022 17:09:07 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Thu, 3 Nov 2022 17:09:07 -0700 From: Gleb Smirnoff To: Andriy Gapon Cc: Sean Bruno , "net@FreeBSD.org" Subject: Re: in_pcbbind_setup: wrong condition regarding INP_REUSEPORT ? Message-ID: References: <896ee089-27ad-c98f-6bf9-4b05caf778fd@freebsd.org> <9037ac3d-8d8e-2d7d-cbdb-996a53613aca@FreeBSD.org> List-Id: Networking and TCP/IP with FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-net List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-net@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9037ac3d-8d8e-2d7d-cbdb-996a53613aca@FreeBSD.org> X-Rspamd-Queue-Id: 4N3LZz6yHvz3fVg X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=softfail (mx1.freebsd.org: 162.251.186.162 is neither permitted nor denied by domain of glebius@freebsd.org) smtp.mailfrom=glebius@freebsd.org X-Spamd-Result: default: False [-2.10 / 15.00]; NEURAL_HAM_LONG(-1.00)[-1.000]; SUBJECT_ENDS_QUESTION(1.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; R_DKIM_NA(0.00)[]; MLMMJ_DEST(0.00)[net@freebsd.org]; ARC_NA(0.00)[]; DMARC_NA(0.00)[freebsd.org]; FROM_HAS_DN(0.00)[]; FREEFALL_USER(0.00)[glebius]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all:c]; RCPT_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_ALL(0.00)[]; TO_DN_SOME(0.00)[]; HAS_XAW(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-ThisMailContainsUnwantedMimeParts: N Andriy, On Tue, Oct 04, 2022 at 02:46:51PM +0300, Andriy Gapon wrote: A> Yes, that conditional. A> I pointed out the part of it that does not make sense to me. A> A> Also, in my tests SO_REUSEPORT does not actually allow to share a port. A> Test scenario: A> - create a UDP socket A> - setsockopt(SO_REUSEPORT) A> - bind the socket to a port and wild card address A> - success A> - now repeat the previous steps with the same port *under a different user id* A> - bind fails Sorry for late reply. The described behavior of SO_REUSEPORT is correct. This is what SO_REUSEPORT did back in the original BSD stack and this is what it does today in FreeBSD. 20+ years later Linux introduced a different kinds of functionality under the same socket option name, hence the confusion. I can't say much on the INP_REUSEPORT_LB check in the discussed code :( -- Gleb Smirnoff