This is the mail archive of the ecos-discuss@sourceware.org mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: limited broadcast IP


Andrew,
You've found about a quarter of a page more than me. I have a foot in both
the UNIX and Windows camps (and I'm not very comfortable with the Windows
side).  Our product incorporates systems running both Windows and eCos.
Right or wrong, the Windows part seems to send the type of packet that I'm
describing, by default.  I have an eCos thread that receives it and responds
directly to the sender.  So far so good.  Now, as part of this product, I
will have other eCos systems that also need to query info from this first
(eCos) system.  It however, does not appear to receive the subnet
broadcast(a request for its IP so that a TCP connection can be established).
Admittedly, I have not put much effort into going the other route of trying
to understand why the eCos thread won't receive the subnet broadcast. But,
since I've tried every conceivable combination of socket options, bind,
connect and raw packets, it's probably time that I did.  The DHCP discover
packet (without IP src) seems to be like this and I had hoped that there
might be and easy way...

thank you for your help (sorry about the deep dark corner)
Dan

-----Original Message-----
From: Andrew Lunn [mailto:andrew@lunn.ch]
Sent: Thursday, February 23, 2006 10:05 AM
To: paape@hi-techniques.com
Cc: ecos-discuss@sources.redhat.com
Subject: Re: [ECOS] limited broadcast IP


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]