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
25 .\" $FreeBSD: src/lib/libc/net/sourcefilter.3,v 1.2 2009/03/04 01:59:14 bms Exp $
32 .Nd advanced multicast group membership API
37 .Fo getipv4sourcefilter
39 .Fa "struct in_addr interface"
40 .Fa "struct in_addr group"
42 .Fa "uint32_t *numsrc"
43 .Fa "struct in_addr *slist"
48 .Fa "uint32_t interface"
49 .Fa "struct sockaddr *group"
50 .Fa "socklen_t grouplen"
52 .Fa "uint32_t *numsrc"
53 .Fa "struct sockaddr_storage *slist"
56 .Fo setipv4sourcefilter
58 .Fa "struct in_addr interface"
59 .Fa "struct in_addr group"
62 .Fa "struct in_addr *slist"
67 .Fa "uint32_t interface"
68 .Fa "struct sockaddr *group"
69 .Fa "socklen_t grouplen"
72 .Fa "struct sockaddr_storage *slist"
77 functions implement the advanced, full-state multicast API
79 An application may use these functions to atomically set and
80 retrieve the multicast source address filters associated with a socket
86 .Fn getipv4sourcefilter
89 allow an application to discover the filter mode, and
90 source filter entries,
91 for an existing group membership.
93 The kernel will always return the number of source filter
94 entries on the socket for that group in
98 argument is non-zero, the kernel will attempt to return up to
100 filter entries in the array pointed to by
104 argument may be set to 0, in which case the
106 argument will be ignored.
109 .Fn setipv4sourcefilter
115 argument may be used to place the socket into inclusive or exclusive
116 group membership modes, by using the
120 constants respectively.
123 argument specifies the number of source entries in the
128 argument has a value of 0,
129 all source filters will be removed from the socket.
130 Removing all source filters from a membership which is in the
132 filter mode will cause the group to be left on that socket.
134 The protocol-independent function
136 allows an application to join a multicast group on an interface
137 which may not have an assigned protocol address,
138 by passing its index for the
142 Any changes made by these functions
143 will be communicated to IGMPv3 and/or MLDv2 routers
144 on the local network as appropriate.
145 If no IGMPv3 or MLDv2 routers are present, changes in the source filter
146 lists made by these functions will not cause
147 state changes to be transmitted, with the exception of any
148 change which causes a group to be joined or left.
149 The kernel will continue to maintain the source filter state
150 regardless of the IGMP or MLD version in use on the link.
151 .Sh IMPLEMENTATION NOTES
152 The IPv4 specific versions of these functions are implemented in terms
153 of the protocol-independent functions.
154 Application writers are encouraged to use the protocol-independent functions
155 for efficiency, and forwards compatibility with IPv6 networks.
157 For the protocol-independent functions
160 .Fn setsourcefilter ,
163 argument specifies the size of the structure pointed to by
165 This is required in order to differentiate between different
170 does not support source address selection for the IPv4
171 protocol family, therefore the use of multicast APIs with
172 an unnumbered IPv4 interface is
174 In all cases, the first assigned IPv4 address on the interface
175 will be used as the source address of IGMP control traffic.
176 If this address is removed or changed, the results are undefined.
178 .Rv -std getsourcefilter getipv4sourcefilter setsourcefilter setipv4sourcefilter
182 functions may fail because of:
184 .It Bq Er EADDRNOTAVAIL
185 The network interface which the
187 argument refers to was not configured in the system,
188 or the system is not a member of the
190 .It Bq Er EAFNOSUPPORT
193 and/or one or more of the
195 arguments were of an address family unsupported by the system,
196 or the address family of the
200 arguments were not identical.
204 argument does not contain a multicast address.
207 argument is invalid; it must be set to either
215 arguments do not specify a source list.
217 Insufficient memory was available to carry out the requested
227 .%T "Socket Interface Extensions for Multicast Source Filters"
234 functions first appeared in