From owner-freebsd-current@FreeBSD.ORG Fri Nov 29 18:46:01 2013 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 6536CBF0; Fri, 29 Nov 2013 18:46:01 +0000 (UTC) Received: from mail-pd0-x22d.google.com (mail-pd0-x22d.google.com [IPv6:2607:f8b0:400e:c02::22d]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2CFF218B3; Fri, 29 Nov 2013 18:46:01 +0000 (UTC) Received: by mail-pd0-f173.google.com with SMTP id p10so14223167pdj.4 for ; Fri, 29 Nov 2013 10:46:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=x3/7S+1KdZ4OGCpWIWM1/e7YTV63go6/l/1MGZ+63sk=; b=B/B2pq9DaUPU5dshnxkFLxYgRVlUJ+JXxd+JSLfwjy2hO48Dn/Fyhln5u3std+6kzT LcWzqmpzuoLVtoW6rMqfyrXugu0GdIlsfraZGXqeSKsKll3mGvIUW2Q9eMftcNwpWf1P GNUgXDOKEyvTBoXPvqov2v15rAxgKj8E0aDXGMnDJBsBj4v0HH0YLvy5APILCu9gldAF /D5hEYU5G4uvQinJoryJmH/AW+tTZNpgU3JlLFKDhsNzLV/LuXn0szb8Ty5wleABCjP3 bMPg8O8DFITeN809ZGz+UCirlSkugEJZ7jDIfVPJgfvXnHEfx8xCBeb8Ge0nGAuqroCD c0tQ== MIME-Version: 1.0 X-Received: by 10.66.149.135 with SMTP id ua7mr34022802pab.124.1385750760544; Fri, 29 Nov 2013 10:46:00 -0800 (PST) Sender: ermal.luci@gmail.com Received: by 10.70.4.163 with HTTP; Fri, 29 Nov 2013 10:46:00 -0800 (PST) In-Reply-To: <4053E074-EDC5-49AB-91A7-E50ABE36602E@freebsd.org> References: <4053E074-EDC5-49AB-91A7-E50ABE36602E@freebsd.org> Date: Fri, 29 Nov 2013 19:46:00 +0100 X-Google-Sender-Auth: siq9dmpzJT8OkeHeH0-FBkIlW1w Message-ID: Subject: Re: [PATCH] SO_REUSEADDR and SO_REUSEPORT behaviour From: =?ISO-8859-1?Q?Ermal_Lu=E7i?= To: Tim Kientzle Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Cc: freebsd-net , "freebsd-current@freebsd.org" X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Nov 2013 18:46:01 -0000 On Fri, Nov 29, 2013 at 6:59 PM, Tim Kientzle wrote: > > On Nov 29, 2013, at 4:04 AM, Ermal Lu=E7i wrote: > > > Hello, > > > > since SO_REUSEADDR and SO_REUSEPORT are supposed to allow two daemons t= o > > share the same port and possibly listening ip =85 > > These flags are used with TCP-based servers. > Every one has its own use-case! > > I=92ve used them to make software upgrades go more smoothly. > Without them, the following often happens: > > * Old server stops. In the process, all of its TCP connections are close= d. > > * Connections to old server remain in the TCP connection table until the > remote end can acknowledge. > > * New server starts. > > * New server tries to open port but fails because that port is =93still i= n > use=94 by connections in the TCP connection table. > > With these flags, the new server can open the port even though > it is =93still in use=94 by existing connections. > > > > 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! > > That is what multicast is for. > > Multicast has its defined scope and its applications though i think its interpreting the same socket options and respecting the options for what they should do and how they should behave. > If you want the same data sent to all listeners, then > that is multicast behavior and you should be using > a multicast socket. > > > The patch at [1] implements/corrects the behaviour for UDP sockets. > > You=92re trying to turn all UDP sockets with those options > into multicast sockets. > Not really the idea is how you do support the use case of having two daemons using the same port numbers but speaking different protocols. The best would be to merge these daemons but in the case you cannot there should be some support on it. At the very end there are only 65k ports :). Probably a sysctl for the feature might be a further compromise on it? > > If you want a multicast socket, you should ask for one. > > Tim > > --=20 Ermal