From owner-freebsd-net@FreeBSD.ORG Fri Nov 29 12:31:33 2013 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 68D14B04 for ; Fri, 29 Nov 2013 12:31:33 +0000 (UTC) Received: from mail.lhr1.as41113.net (mail.lhr1.as41113.net [91.208.177.22]) by mx1.freebsd.org (Postfix) with ESMTP id 2C6731398 for ; Fri, 29 Nov 2013 12:31:32 +0000 (UTC) Received: from [10.16.240.11] (unknown [212.9.98.193]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: lists@rewt.org.uk) by mail.lhr1.as41113.net (Postfix) with ESMTPSA id 3dWFLG62h3z7rH8 for ; Fri, 29 Nov 2013 12:25:42 +0000 (UTC) Message-ID: <529887EF.8090009@rewt.org.uk> Date: Fri, 29 Nov 2013 12:26:23 +0000 From: Joe Holden User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1 MIME-Version: 1.0 To: freebsd-net@freebsd.org Subject: Re: [PATCH] SO_REUSEADDR and SO_REUSEPORT behaviour References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Nov 2013 12:31:33 -0000 On 29/11/2013 12:04, Ermal Luçi wrote: > Hello, > > since SO_REUSEADDR and SO_REUSEPORT are supposed to allow two daemons to > share the same port and possibly listening ip, you would expect if you bind > two daemon with such options to same port to see the same traffic on both! > > This is not the case today. > Only multicast sockets seem to have the behaviour of broadcasting the data > to all sockets sharing the same properties through these options! > > The patch at [1] implements/corrects the behaviour for UDP sockets. > Is there anything to be corrected in that patch? > Why it has not been provided there before? > Can it be committed to the tree? > Any extra security checks for jails needed there? > > > [1] > https://github.com/pfsense/pfsense-tools/blob/master/patches/RELENG_10_0/udp_SO_REUSEADDR%2BPORT.diff > Have you added support for TCP as well? IMO the correct behaviour is the functioning of the Linux support added in 3.9 (https://lwn.net/Articles/542629/) - TCP would be much more useful than UDP (think high load web servers etc) I'm not sure what the correct handling would be for UDP though, is it not inefficient to send copies of the same data to all listeners? Would round-robin distribution be usable? TCP I guess doesn't matter as the listener can just accept().