Has anyone tried IP multicast with RTEMS?
Joel Sherrill
joel.sherrill at OARcorp.com
Tue Oct 21 12:52:51 UTC 2003
Thomas,
Could you produce this information as a patch to some
section of the Networking Guide?
Also someone posted a snippet of code to get the
IP address of an interface. Could whoever did that
please turn it into a patch against the networking
guide?
It would be nice to get this type of information
into a manual so it isn't necessary to recreate it. :)
Thanks.
--joel
Thomas Rauscher wrote:
>
>>-----Original Message-----
>>From: Phil Torre [mailto:ptorre at zetron.com]
>>Sent: Monday, October 20, 2003 8:16 PM
>>To: RTEMS User List
>>Subject: Has anyone tried IP multicast with RTEMS?
>>
>>
>>Greetings All,
>>
>>Can anyone report success with RTEMS and multicast? From what I can
>>tell by looking through the source, it looks like the FreeBSD stack
>>is multicast-capable, but I may have some work to do in the Ethernet
>>device driver (for MPC860, as used in the eth_comm BSP).
>>
>>I haven't done any experiments yet, but we will want to be doing
>>multicast in future product development, so I'm just looking ahead.
>>
>>Thanks,
>>-Phil
>>
>
>
> Multicasting works. Basically, two things are important:
>
> 1) Ethernet layer:
> The driver must support ethernet multicasting. That is, it must
> configure its ethernet multicast list/hash table when
> a socket joins a multicast group.
>
> This is done in the driver's ioctl. Required commands
> are SIOCADDMULTI and SIOCDELMULTI
>
> There is a macro ETHER_MAP_IP_MULTICAST to map IP addresses
> and ethernet multicast addresses.
>
> 2) IP layer:
> Sending works immediately by just using an IP multicast address.
> Receiving requires to add the node to an IP multicast group
> (so that IP/Ethernet multicasting is configured properly).
> This is done like in the code snippet below.
>
> #include <sys/socket.h>
> #include <sys/sockio.h>
> #include <net/if.h>
> #include <netinet/in.h>
> #include <netinet/if_ether.h>
>
> struct ip_mreq mreq;
> int fd;
> mreq.imr_multiaddr.s_addr=inet_addr(HELLO_GROUP);
> mreq.imr_interface.s_addr=htonl(INADDR_ANY);
> if (setsockopt(fd,IPPROTO_IP,IP_ADD_MEMBERSHIP,&mreq,sizeof(mreq)) < 0) {
> perror("setsockopt");
> exit(1);
> }
>
> Best regards,
> Thomas
>
> --
> Dipl.-Ing. Thomas Rauscher Tel.: ++43 1 402 08 05 15
> Fax: ++43 1 402 08 05 99
> LOYTEC electronics GmbH E-mail: trauscher at loytec.com
> Stolzenthalergasse 24/3, A-1080 Wien Web: http://www.loytec.com
>
--
Joel Sherrill, Ph.D. Director of Research & Development
joel at OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985
More information about the users
mailing list