broadcast udp packets ...

Wes Peters wes at softweyr.com
Fri Jul 11 14:07:06 PDT 2003


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 at softweyr.com




More information about the freebsd-net mailing list