From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14751 invoked by alias); 13 Aug 2009 05:54:18 -0000 Received: (qmail 14696 invoked by uid 22791); 13 Aug 2009 05:54:15 -0000 X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail-pz0-f197.google.com (HELO mail-pz0-f197.google.com) (209.85.222.197) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 13 Aug 2009 05:54:07 +0000 Received: by pzk35 with SMTP id 35so434123pzk.24 for ; Wed, 12 Aug 2009 22:54:05 -0700 (PDT) MIME-Version: 1.0 Received: by 10.142.61.23 with SMTP id j23mr172130wfa.323.1250142845246; Wed, 12 Aug 2009 22:54:05 -0700 (PDT) In-Reply-To: References: <4A8172DA.4070001@meduna.org> Date: Thu, 13 Aug 2009 05:54:00 -0000 Message-ID: From: Mandeep Sandhu To: eCos Discussion Cc: Stanislav Meduna Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Re: How to send UDP broadcast to 255.255.255.255? X-SW-Source: 2009-08/txt/msg00034.txt.bz2 People! Any comments about the below mail? Thanks for your time. Regards, -mandeep On Wed, Aug 12, 2009 at 6:49 PM, Mandeep Sandhu 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 =A0: 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 t= o set > the IP_HDRINCL flag). > > This seems to be working. I've tested it on my Ubuntu machine with dhclie= nt. > > Do you think this is an acceptable workaround? > > Thanks, > -mandeep > > > On Wed, Aug 12, 2009 at 10:32 AM, Mandeep > Sandhu 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 >>> -- >>> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0Stano >>> >>> -- >>> 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