From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15350 invoked by alias); 12 Aug 2009 13:19:47 -0000 Received: (qmail 15288 invoked by uid 22791); 12 Aug 2009 13:19:46 -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 wf-out-1314.google.com (HELO wf-out-1314.google.com) (209.85.200.170) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 12 Aug 2009 13:19:31 +0000 Received: by wf-out-1314.google.com with SMTP id 24so1561409wfg.20 for ; Wed, 12 Aug 2009 06:19:29 -0700 (PDT) MIME-Version: 1.0 Received: by 10.143.21.36 with SMTP id y36mr12673wfi.211.1250083169171; Wed, 12 Aug 2009 06:19:29 -0700 (PDT) In-Reply-To: References: <4A8172DA.4070001@meduna.org> Date: Wed, 12 Aug 2009 13:19:00 -0000 Message-ID: From: Mandeep Sandhu To: Stanislav Meduna Cc: eCos Discussion 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/msg00032.txt.bz2 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 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