public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Mandeep Sandhu <mandeepsandhu.chd@gmail.com>
To: eCos Discussion <ecos-discuss@ecos.sourceware.org>
Cc: Stanislav Meduna <stano@meduna.org>
Subject: Re: [ECOS] Re: How to send UDP broadcast to 255.255.255.255?
Date: Thu, 13 Aug 2009 05:54:00 -0000	[thread overview]
Message-ID: <b18c5f790908122254mfaadb7dt608ce579f12faf0b@mail.gmail.com> (raw)
In-Reply-To: <b18c5f790908120619s730e1c45p678f6e33a2a07c27@mail.gmail.com>

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

  reply	other threads:[~2009-08-13  5:54 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-11 13:32 Stanislav Meduna
2009-08-12  5:02 ` Mandeep Sandhu
2009-08-12 13:19   ` Mandeep Sandhu
2009-08-13  5:54     ` Mandeep Sandhu [this message]
2009-08-12 13:25   ` Stanislav Meduna
  -- strict thread matches above, loose matches on Subject: below --
2009-06-16 16:14 Jay Foster
2009-06-16 19:01 ` Grant Edwards
2009-06-16 19:56   ` Gary Thomas
2009-06-16 20:26     ` Grant Edwards
2009-06-15 17:42 [ECOS] " Grant Edwards
2009-06-15 20:36 ` Sergei Gavrikov
2009-06-15 22:14   ` [ECOS] " Grant Edwards
2009-06-16  6:44 ` [ECOS] " Andrew Lunn
2009-06-16 14:23   ` [ECOS] " Grant Edwards

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b18c5f790908122254mfaadb7dt608ce579f12faf0b@mail.gmail.com \
    --to=mandeepsandhu.chd@gmail.com \
    --cc=ecos-discuss@ecos.sourceware.org \
    --cc=stano@meduna.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).