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]

Problem with multicast using FreeBSD stack


Hello,

I have eCos configured with the FreeBSD stack. Everything is working except a portion where I have to SEND multicast UDP packets using sendto(). In these instances, sendto() returns -1, and errno == EHOSTUNREACH.

Just to let you know, I have "Multicast Routing Support" selected in the configtool. Though it is worth noting that after doing so, I had a few compiler errors in ip_mroute.c that were fixed by removing the following declaration and all references to it (which were not really used anyway):
static struct callout_handle expire_upcalls_ch;


Note that I do NOT need to receive multicast packets (which I understand is a bit more complicated), but merely send them.

I have tried a few different ways to initialize eth0 to achieve this effect, all failing.

For example:
s = socket(AF_INET, SOCK_DGRAM, 0);
<... working IP address initialization code ...>
setsockopt(s, IPPROTO_IP, IP_MULTICAST_IF, &interface_addr, sizeof(interface_addr)) ))
where interface_addr is the IP address of the interface I wish to route multicast packets through. However this did not work.



Another attempt:


memset(&addrp->sin_addr, 255, sizeof(addrp->sin_addr));
memset(&route, 0, sizeof(route));
memcpy(&route.rt_gateway, addrp, sizeof(*addrp));

addrp->sin_family = AF_INET;
addrp->sin_port = 0;
addrp->sin_addr.s_addr = INADDR_ANY;
memcpy(&route.rt_dst, addrp, sizeof(*addrp));
memcpy(&route.rt_genmask, addrp, sizeof(*addrp));

route.rt_dev = ifr.ifr_name;
route.rt_flags = RTF_UP|RTF_GATEWAY|RTF_MULTICAST;
route.rt_metric = 0;

if (ioctl(s, SIOCADDRT, &route)) {
   if (errno != EEXIST) {
       dbg_printf("Error setting multi route!!!!!!!!\n");
       perror("SIOCADDRT 4");
       goto out;
   }
}


In the above case, I do get the "Error setting multi route!!" message.


If anyone has an idea of what I am doing wrong, I am all ears.

Thank you,

Chad Handrich


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