Multicast in Libbsd

Cedric Berger cedric at precidata.com
Fri Jun 19 15:53:00 UTC 2020


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


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/devel/attachments/20200619/5c08bc6f/attachment.html>


More information about the devel mailing list