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: Re: How to send UDP broadcast to 255.255.255.255?


People!

Any comments about the below mail?

Thanks for your time.

Regards,
-mandeep


On Wed, Aug 12, 2009 at 6:49 PM, Mandeep
Sandhu<mandeepsandhu.chd@gmail.com> wrote:
> Hi All,
>
> I've managed to get UDP broadcasts working w/o making any changes to
> the FreeBSD stack of ecos.
>
> Just wanted to detail out here the steps I've taken and get a feedback
> from you guys on whether it's
> proper or not...
>
> I'm writing a DHCP server with limited-capability (which serves only 1
> client). For this I need to send
> out all my responses on the broadcast address.
>
> * I've setup my servers eth0 statically as follows:
>
> IP: 10.1.1.1
> netmask: 255.255.255.0
> Broadcast addr: 10.1.1.255
> Gateway: 0
> Server: 0
>
> * After a call to init_all_network_interfaces() I setup a static "default" route
> as follows:
>
> route info:
> Dest IP: 0.0.0.0/0.0.0.0 (any IP)
> Gw ?: 10.1.1.1 (me)
> Dev : eth0
>
> Flags: RTF_UP <--- VERY IMPORTANT!
>
> I found that, previously I was setting the flags as "RTF_UP |
> RTF_GATEWAY". Now this causes
> the problem that in ip_output() function, the stack uses the
> "destination" address of the gateway
> (i.e 10.1.1.1) instead of the actual one (i.e the bcast IP
> 255.255.255.255) if RTF_GATEWAY flag
> is set. This causes the packet transmission to fail when trying to
> resolve the ARP. I don't know why
> the ARP should fail, since its only trying to resolve for itself!
>
> Anyways, I found this to be the cure for my problem, i.e setting the
> default route and NOT putting
> this flag.
>
> * For sending bcast packets, I use raw sockets (with the relevant ioctl to set
> the IP_HDRINCL flag).
>
> This seems to be working. I've tested it on my Ubuntu machine with dhclient.
>
> Do you think this is an acceptable workaround?
>
> Thanks,
> -mandeep
>
>
> On Wed, Aug 12, 2009 at 10:32 AM, Mandeep
> Sandhu<mandeepsandhu.chd@gmail.com> wrote:
>>>
>>> I am able to send the broadcasts as I intended.
>>
>> Are you using UDP or RAW sockets?
>>
>> I've also setup my default route to point to eth0.
>>
>> But when the UDP packet goes out, I see that it's corrupted.
>>
>> Still debugging as to where the screwup is happening?
>>
>> Thanks,
>> -mandeep
>>
>>>
>>> I'd vote for the inclusion of the option in the main tree.
>>>
>>> Thanks
>>> --
>>> ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Stano
>>>
>>> --
>>> Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
>>> and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss
>>>
>>>
>>
>

--
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]