From owner-freebsd-hackers Mon Sep 3 23:47:38 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.121.12]) by hub.freebsd.org (Postfix) with ESMTP id B3B0537B405; Mon, 3 Sep 2001 23:47:31 -0700 (PDT) Received: from mindspring.com (dialup-209.247.140.38.Dial1.SanJose1.Level3.net [209.247.140.38]) by harrier.mail.pas.earthlink.net (EL-8_9_3_3/8.9.3) with ESMTP id XAA20459; Mon, 3 Sep 2001 23:47:18 -0700 (PDT) Message-ID: <3B947922.F8B98DBD@mindspring.com> Date: Mon, 03 Sep 2001 23:48:02 -0700 From: Terry Lambert Reply-To: tlambert2@mindspring.com X-Mailer: Mozilla 4.7 [en]C-CCK-MCD {Sony} (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: "Vladimir A. Jakovenko" Cc: freebsd-net@freebsd.org, freebsd-hackers@freebsd.org Subject: Re: SO_REUSEPORT on unicast UDP sockets References: <20010902054617.A47742@lucky.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 "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... Similarly, there are a number of bugs in the TCP sockets as well; specifically, there's a problem with all sockets being treated as being in the same collision domain, when doing automatic port assignment. This limits you to 65535 oubound TCP connections, even though you have multiple IP aliases on an interface (theoretically, you should get 64k connections per IP address, if you bind _not_ to IN_ADDR_ANY, but instead use a specific port, but the hash is broken). There's also another problem with the cloned route, in the case you get a redirect, since the clone is not properly updated (e.g. do a ping, get a redirect, and notice that you keep getting the redirect until you stop and restart the ping, after which you get the correct route record: there was a recent thread on this in -current, where someone ICMP'ed themselves to death using multiple Gigabit interfaces as unbonded non-VLAN equivalence routes). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message