Multicast in Libbsd

Heinz Junkes junkes at fhi-berlin.mpg.de
Fri Jun 19 19:35:04 UTC 2020


I can agree with Cedric.

I use rtems5 with rtems-libbsd. I initialize the network interfaces of my target via dhcpcd 
and the interfaces are automatically multicast capable.

This works without creating a route:

 if (setsockopt(conf->udp, IPPROTO_IP, IP_ADD_MEMBERSHIP,
                        (char *) &mreq, sizeof(mreq))!=0) {
                        struct sockaddr_in temp;
                        char name[40];
...

Heinz


> On 19. Jun 2020, at 17:53, Cedric Berger <cedric at precidata.com> wrote:
> 
> On 18.06.20 22:47, Joel Sherrill wrote:
> 
>> Hi
>> 
>> I have an example FACE application I am trying to port to RTEMS.  This is a multi-question email:
>> 
>> First, it fails with EADDRNOTAVAIL on this call:
>> 
>>          // Subscribe to multicast group
>>           struct ip_mreq mreq;
>>           rc = inet_pton(AF_INET, multicastGroup_m, &mreq.imr_multiaddr.s_addr);
>>           mreq.imr_interface.s_addr = htonl(INADDR_ANY);
>>           rc = setsockopt(
>>             new_socket, 
>>             IPPROTO_IP, 
>>             IP_ADD_MEMBERSHIP, 
>>             &mreq, 
>>             sizeof(mreq)
>>           );
>> 
>> I assume that is because there is no multicast route. On Linux, you have to do an ifconfig and route to have a multicast route, but I haven't been able to find a multicast setup example for FreeBSD. The Linux commands are:
>> 
>>     ifconfig lo multicast
>>     route add -net 224.0.0.0 netmask 240.0.0.0 dev lo
> This:
> 
> https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6
> 
> Compiles and run without any special configuration on FreeBSD 12.1
> 
> The handbook claims that "Multicast applications do not require any special configuration in order to run on FreeBSD"
> 
> https://www.freebsd.org/doc/handbook/network-routing.html
> 
> Following is the routing table on a FreeBSD jail with no special 224 route needed.
> 
> Cédric
> 
> # netstat -nr
> Routing tables
> 
> Internet:
> Destination        Gateway            Flags     Netif Expire
> default            172.18.12.1        UGS    epair25b
> 127.0.0.1          link#1             UH          lo0
> 172.18.12.0/24     link#3             U      epair25b
> 172.18.12.25       link#3             UHS         lo0
> 
> Internet6:
> Destination                       Gateway                       Flags     Netif Expire
> ::/96                             ::1                           UGRS        lo0
> ::1                               link#1                        UH          lo0
> ::ffff:0.0.0.0/96                 ::1                           UGRS        lo0
> fe80::/10                         ::1                           UGRS        lo0
> fe80::%lo0/64                     link#1                        U           lo0
> fe80::1%lo0                       link#1                        UHS         lo0
> ff02::/16                         ::1                           UGRS        lo0
> 
> 
> 
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2542 bytes
Desc: not available
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200619/838a8c4e/attachment.bin>


More information about the devel mailing list