From: Stanislav Meduna <stano@meduna.org>
To: eCos Discussion <ecos-discuss@ecos.sourceware.org>
Subject: Re: [ECOS] Re: How to send UDP broadcast to 255.255.255.255?
Date: Tue, 11 Aug 2009 13:32:00 -0000 [thread overview]
Message-ID: <4A8172DA.4070001@meduna.org> (raw)
Jay Foster wrote:
> You can try the following patch that someone added
> to my local source. It adds a CDL option
> (CYGOPT_NET_INET_FORCE_DIRECTED_BROADCAST
I also stumbled upon the problem mentioned in the
older post and I'd like to confirm that the
patch from
http://www.mail-archive.com/ecos-discuss@ecos.sourceware.org/msg09992.html
seems to really help. Using this and setting the default
route to my interface (code borrowed from the ppp)
static int setDefaultRoute(u_int32_t g, int cmd)
{
static int rtm_seq;
int routes;
struct {
struct rt_msghdr hdr;
struct sockaddr_in dst;
struct sockaddr_in gway;
struct sockaddr_in mask;
} rtmsg;
if ((routes = socket(PF_ROUTE, SOCK_RAW, AF_INET)) < 0) {
diag_printf("Couldn't %s default route: socket: %d\n",
cmd=='s'? "add": "delete",errno);
return 0;
}
memset(&rtmsg, 0, sizeof(rtmsg));
rtmsg.hdr.rtm_type = cmd == 's'? RTM_ADD: RTM_DELETE;
rtmsg.hdr.rtm_flags = RTF_UP | RTF_GATEWAY | RTF_STATIC;
rtmsg.hdr.rtm_version = RTM_VERSION;
rtmsg.hdr.rtm_seq = ++rtm_seq;
rtmsg.hdr.rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
rtmsg.dst.sin_len = sizeof(rtmsg.dst);
rtmsg.dst.sin_family = AF_INET;
rtmsg.gway.sin_len = sizeof(rtmsg.gway);
rtmsg.gway.sin_family = AF_INET;
rtmsg.gway.sin_addr.s_addr = g;
rtmsg.mask.sin_len = sizeof(rtmsg.dst);
rtmsg.mask.sin_family = AF_INET;
rtmsg.hdr.rtm_msglen = sizeof(rtmsg);
if (write(routes, &rtmsg, sizeof(rtmsg)) < 0) {
diag_printf("Couldn't %s default route: %d\n",
cmd=='s'? "add": "delete",errno);
close(routes);
return 0;
}
close(routes);
return 1;
}
I am able to send the broadcasts as I intended.
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
next reply other threads:[~2009-08-11 13:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-11 13:32 Stanislav Meduna [this message]
2009-08-12 5:02 ` Mandeep Sandhu
2009-08-12 13:19 ` Mandeep Sandhu
2009-08-13 5:54 ` Mandeep Sandhu
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=4A8172DA.4070001@meduna.org \
--to=stano@meduna.org \
--cc=ecos-discuss@ecos.sourceware.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).