1 .\" Copyright (c) 2001-2003 International Computer Science Institute
3 .\" Permission is hereby granted, free of charge, to any person obtaining a
4 .\" copy of this software and associated documentation files (the "Software"),
5 .\" to deal in the Software without restriction, including without limitation
6 .\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
7 .\" and/or sell copies of the Software, and to permit persons to whom the
8 .\" Software is furnished to do so, subject to the following conditions:
10 .\" The above copyright notice and this permission notice shall be included in
11 .\" all copies or substantial portions of the Software.
13 .\" The names and trademarks of copyright holders may not be used in
14 .\" advertising or publicity pertaining to the software without specific
15 .\" prior permission. Title to copyright in this software and any associated
16 .\" documentation will at all times remain with the copyright holders.
18 .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 .\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 .\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 .\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 .\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 .\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
24 .\" DEALINGS IN THE SOFTWARE.
26 .\" $FreeBSD: src/share/man/man4/pim.4,v 1.2 2004/07/09 09:22:36 ru Exp $
27 .\" $DragonFly: src/share/man/man4/pim.4,v 1.5 2008/04/15 23:51:00 swildner Exp $
35 .Nd Protocol Independent Multicast
38 .Cd "options MROUTING"
44 .In net/ip_mroute/ip_mroute.h
47 .Fn getsockopt "int s" IPPROTO_IP MRT_PIM "void *optval" "socklen_t *optlen"
49 .Fn setsockopt "int s" IPPROTO_IP MRT_PIM "const void *optval" "socklen_t optlen"
51 .Fn getsockopt "int s" IPPROTO_IPV6 MRT6_PIM "void *optval" "socklen_t *optlen"
53 .Fn setsockopt "int s" IPPROTO_IPV6 MRT6_PIM "const void *optval" "socklen_t optlen"
56 is the common name for two multicast routing protocols:
57 Protocol Independent Multicast - Sparse Mode (PIM-SM) and
58 Protocol Independent Multicast - Dense Mode (PIM-DM).
60 PIM-SM is a multicast routing protocol that can use the underlying
61 unicast routing information base or a separate multicast-capable
62 routing information base.
63 It builds unidirectional shared trees rooted at a Rendezvous
65 and optionally creates shortest-path trees per source.
67 PIM-DM is a multicast routing protocol that uses the underlying
68 unicast routing information base to flood multicast datagrams
69 to all multicast routers.
70 Prune messages are used to prevent future datagrams from propagating
71 to routers with no group membership information.
73 Both PIM-SM and PIM-DM are fairly complex protocols,
74 though PIM-SM is much more complex.
75 To enable PIM-SM or PIM-DM multicast routing in a router,
76 the user must enable multicast routing and PIM processing in the kernel
79 about the kernel configuration options),
80 and must run a PIM-SM or PIM-DM capable user-level process.
81 From developer's point of view,
82 the programming guide described in the
83 .Sx "Programming Guide"
84 section should be used to control the PIM processing in the kernel.
87 After a multicast routing socket is open and multicast forwarding
88 is enabled in the kernel
91 one of the following socket options should be used to enable or disable
92 PIM processing in the kernel.
93 Note that those options require certain privilege
94 (i.e., root privilege):
97 int v = 1; /* 1 to enable, or 0 to disable */
98 setsockopt(mrouter_s4, IPPROTO_IP, MRT_PIM, (void *)&v, sizeof(v));
102 int v = 1; /* 1 to enable, or 0 to disable */
103 setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_PIM, (void *)&v, sizeof(v));
106 After PIM processing is enabled, the multicast-capable interfaces
110 In case of PIM-SM, the PIM-Register virtual interface must be added
112 This can be accomplished by using the following options:
116 memset(&vc, 0, sizeof(vc));
117 /* Assign all vifctl fields as appropriate */
119 if (is_pim_register_vif)
120 vc.vifc_flags |= VIFF_REGISTER;
121 setsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_VIF, (void *)&vc,
127 memset(&mc, 0, sizeof(mc));
128 /* Assign all mif6ctl fields as appropriate */
130 if (is_pim_register_vif)
131 mc.mif6c_flags |= MIFF_REGISTER;
132 setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_ADD_MIF, (void *)&mc,
136 Sending or receiving of PIM packets can be accomplished by
141 with protocol value of
146 pim_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM);
151 pim_s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM);
154 Then, the following system calls can be used to send or receive PIM
175 The PIM-SM protocol is specified in RFC 4601.
176 The PIM-DM protocol is specified in RFC 3973.
180 The original IPv4 PIM kernel support for IRIX and SunOS-4.x was
184 Later the code was ported to various
186 flavors and modified by
187 .An George Edmond Eddy
191 .An Pavlin Radoslavov
193 The IPv6 PIM kernel support was implemented by the KAME project
194 .Pa ( http://www.kame.net ) ,
195 and was based on the IPv4 PIM kernel support.
197 This manual page was written by
198 .An Pavlin Radoslavov