[ECOS] limited broadcast IP

Andrew Lunn andrew@lunn.ch
Thu Feb 23 16:35:00 GMT 2006


On Thu, Feb 23, 2006 at 09:38:29AM -0600, paape@Hi-Techniques.com wrote:
> Hi Andrew,
> I would like to send a broadcast UDP packet (dest mac ff:ff:ff:ff:ff:ff)
> that also has a destination IP adress of 255.255.255.255 out an existing
> (configured)interface.  This seems like it should be simple but the best
> that I've been able to get is a packet with 10.255.255.255 in the dest IP
> field which I presume is a network broadcast.

That is the subnet directed broadcast. It is well understood and
supported in all TCP/IP stacks.

Using 255.255.255.255 is not something i've come across before. [Goes
away and reads Stevens. Finds 1/2 a page. Obviously a deep and dark
corner of IP that nobody ever goes near]. 

OK. Stupid question. Why do you want to do this. It seems like nobody
else does! What is wrong with subnet directed broadcast, which is what
you have sucessfully acheived.

> Most of the failed attempts
> produce the ENETUNREACH or EHOSTUNREACH errors when I set the s_addr field
> (sockaddr_in)to INADDR_BROADCAST.

O.K. Making random guesses from what i know about IP.

I expect you need to do the setsockopt SO_BROADCAST. Since you have
managed to send a subnet directed broadcast i expect you already have
this.

Now since limited broadcast does not indicate which interface the
packet is to go out of you somehow have to tell the stack which
interface you want it to send the packet from. So i guess you have to
bind the socket to the specific interface you want to send out of.

Then try a sendto() and see what happens. You might end up having to
single step through the code and see where it hits and error and
understand the code....

        Andrew

-- 
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list