From owner-freebsd-net@FreeBSD.ORG Fri Jul 11 14:07:06 2003 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6DB8337B401 for ; Fri, 11 Jul 2003 14:07:06 -0700 (PDT) Received: from smtp.omnis.com (smtp.omnis.com [216.239.128.26]) by mx1.FreeBSD.org (Postfix) with ESMTP id 0050943FA3 for ; Fri, 11 Jul 2003 14:07:06 -0700 (PDT) (envelope-from wes@softweyr.com) Received: from salty.rapid.stbernard.com (corp-2.ipinc.com [199.245.188.2]) by smtp-relay.omnis.com (Postfix) with ESMTP id B54129BE61; Fri, 11 Jul 2003 14:07:04 -0700 (PDT) From: Wes Peters Organization: Softweyr.com To: Chuck Swiger , Matthew Grooms Date: Fri, 11 Jul 2003 14:07:04 -0700 User-Agent: KMail/1.5.2 References: <200307011800.h61I0MOW001329@hole.shrew.net> <3F01DA79.4080709@mac.com> In-Reply-To: <3F01DA79.4080709@mac.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200307111407.04591.wes@softweyr.com> cc: "freebsd-net@freebsd.org" Subject: Re: broadcast udp packets ... X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.1 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, 11 Jul 2003 21:07:06 -0000 On Tuesday 01 July 2003 12:01, Chuck Swiger wrote: > Matthew Grooms wrote: > > Is there any way to generate a udp broadcast ( all routes > > 255.255.255.255 ) packet using a standard sendto() without it being > > translated into a local network broadcast? Is this just not > > "allowed"? > > Are you trying to use 255.255.255.255 to reach something not on a > local subnet? > > If you have multiple interfaces, a broadcast to 255.255.255.255 > should go out on all of them. That being said, the all-ones > broadcast address means "all local networks", and most routers will > block such traffic from passing on in any event. I was looking at this yesterday (on a 4.4 embedded system) and it turns out this code is broken and pretty much always has been. A short IRC conversation basically resulted in "it's never really worked, and apparently nobody else really does it correctly either." What we observed on our embedded system is the packet gets sent on all attached interfaces, with dest IP 255.255.255.255, and a src IP of the local address that has the default route. If there isn't a default route, sending to 255.255.255.255 fails with "no route to host." This is bogus, so I propose to change it to a special case, where packets sent to 255.255.255.255 will be sent on each attached interface, with src IP of the interface "primary" address. Does this sound reasonable? Should it work without a default route? (I think it should, the special case of the all-call broadcast shouldn't even go into rtalloc.) I hope to have a working prototype done, on either -STABLE or -CURRENT, this weekend. If testers like the behavior, I'll commit to CURRENT and MFC on a normal timeline; we'll want this fixed here before 5.2. Sorry to take so long to reply to this. ;^) -- "Where am I, and what am I doing in this handbasket?" Wes Peters wes@softweyr.com