From owner-freebsd-net@FreeBSD.ORG Fri Nov 29 17:59:59 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 490E799C for ; Fri, 29 Nov 2013 17:59:59 +0000 (UTC) Received: from mail-pb0-f47.google.com (mail-pb0-f47.google.com [209.85.160.47]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 18DDD14CA for ; Fri, 29 Nov 2013 17:59:58 +0000 (UTC) Received: by mail-pb0-f47.google.com with SMTP id um1so14885786pbc.34 for ; Fri, 29 Nov 2013 09:59:52 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:content-type:mime-version:subject:from :in-reply-to:date:cc:content-transfer-encoding:message-id:references :to; bh=pKqVVysBn4l+j9NkqDgRFfJPrlhXdFJquzctqtecpDA=; b=aecvzXKghpTSYVopeGlqMY52rSNrR0mcp6l/1A7zJD3K50mlZ8k4O5SWlIgvPVIdLc k/gNWr8rUyLV3UUw5smCtsQa1xcFm662tdW+8YXNRHKfI6i5BZCpYaJe64We8bogA1Cv FSTHvZR6R+/THBLRBP6ZMcqhZYzkaKPr9FN+Plvlokr2g5WFdesezeFIC8H9JUrW7xHi aURUiSX8nGXZMiC9NFIgxnLl36ZKaQeFNTM4SWMRpL//CKfonvCDcVSWkXVD+iQsvhv1 p0oHSI3vQO2B64RUm1vG0mBNt4OceCgoWx11stccva4ezOzqrNnXHqSfhf/xz4T6eY6h SOzA== X-Gm-Message-State: ALoCoQmotFV4aP6uxdKVybUTWnuTaxEYXXErag+H+3x3m+0VQgT29MMqChhOl6BxXJUCu91SMct0 X-Received: by 10.68.191.3 with SMTP id gu3mr17101147pbc.142.1385747992101; Fri, 29 Nov 2013 09:59:52 -0800 (PST) Received: from [192.168.2.123] (99-74-169-43.lightspeed.sntcca.sbcglobal.net. [99.74.169.43]) by mx.google.com with ESMTPSA id pu5sm117393195pac.21.2013.11.29.09.59.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 29 Nov 2013 09:59:51 -0800 (PST) Sender: Tim Kientzle Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\)) Subject: Re: [PATCH] SO_REUSEADDR and SO_REUSEPORT behaviour From: Tim Kientzle In-Reply-To: Date: Fri, 29 Nov 2013 09:59:26 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <4053E074-EDC5-49AB-91A7-E50ABE36602E@freebsd.org> References: To: =?windows-1252?Q?Ermal_Lu=E7i?= X-Mailer: Apple Mail (2.1822) Cc: freebsd-net , "freebsd-current@freebsd.org" 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 17:59:59 -0000 On Nov 29, 2013, at 4:04 AM, Ermal Lu=E7i wrote: > Hello, >=20 > since SO_REUSEADDR and SO_REUSEPORT are supposed to allow two daemons = to > share the same port and possibly listening ip =85 These flags are used with TCP-based servers. 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 = closed. * 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 = in 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. 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. If you want a multicast socket, you should ask for one. Tim