1 .\" Copyright (c) 2007-2009 Bruce Simpson.
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .Nd advanced multicast group membership API
35 .Fo getipv4sourcefilter
37 .Fa "struct in_addr interface"
38 .Fa "struct in_addr group"
40 .Fa "uint32_t *numsrc"
41 .Fa "struct in_addr *slist"
46 .Fa "uint32_t interface"
47 .Fa "struct sockaddr *group"
48 .Fa "socklen_t grouplen"
50 .Fa "uint32_t *numsrc"
51 .Fa "struct sockaddr_storage *slist"
54 .Fo setipv4sourcefilter
56 .Fa "struct in_addr interface"
57 .Fa "struct in_addr group"
60 .Fa "struct in_addr *slist"
65 .Fa "uint32_t interface"
66 .Fa "struct sockaddr *group"
67 .Fa "socklen_t grouplen"
70 .Fa "struct sockaddr_storage *slist"
75 functions implement the advanced, full-state multicast API
77 An application may use these functions to atomically set and
78 retrieve the multicast source address filters associated with a socket
84 .Fn getipv4sourcefilter
87 allow an application to discover the filter mode, and
88 source filter entries,
89 for an existing group membership.
91 The kernel will always return the number of source filter
92 entries on the socket for that group in
96 argument is non-zero, the kernel will attempt to return up to
98 filter entries in the array pointed to by
102 argument may be set to 0, in which case the
104 argument will be ignored.
107 .Fn setipv4sourcefilter
113 argument may be used to place the socket into inclusive or exclusive
114 group membership modes, by using the
118 constants respectively.
121 argument specifies the number of source entries in the
126 argument has a value of 0,
127 all source filters will be removed from the socket.
128 Removing all source filters from a membership which is in the
130 filter mode will cause the group to be left on that socket.
132 The protocol-independent function
134 allows an application to join a multicast group on an interface
135 which may not have an assigned protocol address,
136 by passing its index for the
140 Any changes made by these functions
141 will be communicated to IGMPv3 and/or MLDv2 routers
142 on the local network as appropriate.
143 If no IGMPv3 or MLDv2 routers are present, changes in the source filter
144 lists made by these functions will not cause
145 state changes to be transmitted, with the exception of any
146 change which causes a group to be joined or left.
147 The kernel will continue to maintain the source filter state
148 regardless of the IGMP or MLD version in use on the link.
149 .Sh IMPLEMENTATION NOTES
150 The IPv4 specific versions of these functions are implemented in terms
151 of the protocol-independent functions.
152 Application writers are encouraged to use the protocol-independent functions
153 for efficiency, and forwards compatibility with IPv6 networks.
155 For the protocol-independent functions
158 .Fn setsourcefilter ,
161 argument specifies the size of the structure pointed to by
163 This is required in order to differentiate between different
168 does not support source address selection for the IPv4
169 protocol family, therefore the use of multicast APIs with
170 an unnumbered IPv4 interface is
172 In all cases, the first assigned IPv4 address on the interface
173 will be used as the source address of IGMP control traffic.
174 If this address is removed or changed, the results are undefined.
176 .Rv -std getsourcefilter getipv4sourcefilter setsourcefilter setipv4sourcefilter
180 functions may fail because of:
182 .It Bq Er EADDRNOTAVAIL
183 The network interface which the
185 argument refers to was not configured in the system,
186 or the system is not a member of the
188 .It Bq Er EAFNOSUPPORT
191 and/or one or more of the
193 arguments were of an address family unsupported by the system,
194 or the address family of the
198 arguments were not identical.
202 argument does not contain a multicast address.
205 argument is invalid; it must be set to either
213 arguments do not specify a source list.
215 Insufficient memory was available to carry out the requested
227 .%T "Socket Interface Extensions for Multicast Source Filters"
234 functions first appeared in
237 .An Bruce M. Simpson Aq Mt bms@FreeBSD.org