Here is my try to extend ip(4) to also document struct ip_mreqn.
Not sure what is the best way to document the option to use either struct
ip_mreq or struct ip_mreqn with IP_ADD_MEMBERSHIP.

-- 
:wq Claudio

Index: ip.4
===================================================================
RCS file: /cvs/src/share/man/man4/ip.4,v
retrieving revision 1.41
diff -u -p -r1.41 ip.4
--- ip.4        18 Aug 2016 11:45:18 -0000      1.41
+++ ip.4        7 Jan 2021 14:58:54 -0000
@@ -411,13 +411,21 @@ setsockopt(s, IPPROTO_IP, IP_ADD_MEMBERS
 .Pp
 where
 .Fa mreq
-is the following structure:
+is either the following structure:
 .Bd -literal -offset indent
 struct ip_mreq {
     struct in_addr imr_multiaddr; /* multicast group to join */
     struct in_addr imr_interface; /* interface to join on */
 }
 .Ed
+or
+.Bd -literal -offset indent
+struct ip_mreqn {
+    struct in_addr imr_multiaddr; /* multicast group to join */
+    struct in_addr imr_address;   /* local IP address of interface */
+    int            imr_ifindex;   /* interface index to join*/
+};
+.Ed
 .Pp
 .Va imr_interface
 should
@@ -428,6 +436,12 @@ or the
 .Tn IP
 address of a particular multicast-capable interface if
 the host is multihomed.
+.Va imr_ifindex
+of
+.Va struct ip_mreqn
+can be set to the interface index instead of specifying the
+.Tn IP
+address of a  particular multicast-capable interface.
 Membership is associated with a single interface;
 programs running on multihomed hosts may need to
 join the same group on more than one interface.

Reply via email to