From owner-freebsd-hackers Fri Sep 7 3:44:25 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from burka.carrier.kiev.ua (burka.carrier.kiev.ua [193.193.193.107]) by hub.freebsd.org (Postfix) with ESMTP id 2315237B403; Fri, 7 Sep 2001 03:44:15 -0700 (PDT) Received: from vovik@localhost (vovik@localhost) by burka.carrier.kiev.ua id NQY70812; Fri, 7 Sep 2001 13:44:03 +0300 (EEST) (envelope-from vovik) Date: Fri, 7 Sep 2001 13:44:03 +0300 From: "Vladimir A. Jakovenko" To: Terry Lambert Cc: freebsd-net@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: SO_REUSEPORT on unicast UDP sockets Message-ID: <20010907134403.T2693@lucky.net> References: <20010902054617.A47742@lucky.net> <3B947922.F8B98DBD@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <3B947922.F8B98DBD@mindspring.com>; from tlambert2@mindspring.com on Mon, Sep 03, 2001 at 11:48:02PM -0700 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Sep 03, 2001 at 11:48:02PM -0700, Terry Lambert wrote: >"Vladimir A. Jakovenko" wrote: >> >> Hello! >> >> According to UNPv1 SO_REUSEPORT on UDP sockets can be used to bind more than >> one socket to the same port (even with same source ip address). But quick >> look on /sys/netinet/udp_usrreq.c function udp_input() shows that this will >> work as expected (data stream duplicate) only on multicast/broadcast local >> addresses. Please pay attention to the following code fragment comments: > >[ ... ] > >> Is there still any real need in such backward compatibility? Can such >> functionality be added (fixed) with possibility to switch it off using >> sysctl or kernel-build option? >> >> I find such possibility realy useful at least for NetFlow data >> processing and believe that it would be useful for many UDP-based >> protocols. > >Bound UDP sockets have always been problematic; there's a lot >of code out there that depnds on the historical behaviour for >unicast, unfortunately, including a number of commercial >applications that run on FreeBSD (e.g. Real Server). > >If you look at that code for any length of time, you will get >to see it as an armpit: it's not a good place to stick your >nose, and it tends to smell to high heaven. At my current >job, I'm up to my elbows in it... Terry, I clearly understand all your explanations. Yes, we are living in real life and there is a lot of programms with bad design. But all what I want is possibility to receive UDP packets with corresponding dst IP and port by more than one process on a single host. This already works for Broadcast and Multicast addresses. If I want to get same functionality for unicast (without any kernel changes) I have to use UDP-proxy, which redirects given datagrams to loopback broadcast address, where they can be received by more that one process. According to comment in udp_input() SO_REUSEPORT hack on unicast sockets could be used in single process, right? How possibility to get duplicate traffic on two UDP sockets, which was created in _different_ processes with the same local address and port values, would break existing applications? -- Regards, Vladimir. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message