summaryrefslogtreecommitdiff
path: root/share/man/man4/pim.4
blob: 17423134203546f3938c299691a524fe8082dfb6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
.\" Copyright (c) 2001-2003 International Computer Science Institute
.\"
.\" Permission is hereby granted, free of charge, to any person obtaining a
.\" copy of this software and associated documentation files (the "Software"),
.\" to deal in the Software without restriction, including without limitation
.\" the rights to use, copy, modify, merge, publish, distribute, sublicense,
.\" and/or sell copies of the Software, and to permit persons to whom the
.\" Software is furnished to do so, subject to the following conditions:
.\"
.\" The above copyright notice and this permission notice shall be included in
.\" all copies or substantial portions of the Software.
.\"
.\" The names and trademarks of copyright holders may not be used in
.\" advertising or publicity pertaining to the software without specific
.\" prior permission. Title to copyright in this software and any associated
.\" documentation will at all times remain with the copyright holders.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
.\" DEALINGS IN THE SOFTWARE.
.\"
.\" $FreeBSD: src/share/man/man4/pim.4,v 1.2 2004/07/09 09:22:36 ru Exp $
.\" $OpenBSD: pim.4,v 1.1 2005/01/14 14:53:54 mcbride Exp $
.\" $NetBSD: pim.4,v 1.2 2004/09/12 13:06:14 wiz Exp $
.\"
.Dd September 4, 2003
.Dt PIM 4
.Os
.\"
.Sh NAME
.Nm pim
.Nd Protocol Independent Multicast
.\"
.Sh SYNOPSIS
.Cd "options MROUTING"
.Cd "options PIM"
.Pp
.In sys/types.h
.In sys/socket.h
.In netinet/in.h
.In netinet/ip_mroute.h
.In netinet/pim.h
.Ft int
.Fn getsockopt "int s" IPPROTO_IP MRT_PIM "void *optval" "socklen_t *optlen"
.Ft int
.Fn setsockopt "int s" IPPROTO_IP MRT_PIM "const void *optval" "socklen_t optlen"
.Ft int
.Fn getsockopt "int s" IPPROTO_IPV6 MRT6_PIM "void *optval" "socklen_t *optlen"
.Ft int
.Fn setsockopt "int s" IPPROTO_IPV6 MRT6_PIM "const void *optval" "socklen_t optlen"
.Sh DESCRIPTION
.Tn PIM
is the common name for two multicast routing protocols:
Protocol Independent Multicast - Sparse Mode (PIM-SM) and
Protocol Independent Multicast - Dense Mode (PIM-DM).
.Pp
PIM-SM is a multicast routing protocol that can use the underlying
unicast routing information base or a separate multicast-capable
routing information base.
It builds unidirectional shared trees rooted at a Rendezvous
Point (RP) per group,
and optionally creates shortest-path trees per source.
.Pp
PIM-DM is a multicast routing protocol that uses the underlying
unicast routing information base to flood multicast datagrams
to all multicast routers.
Prune messages are used to prevent future datagrams from propagating
to routers with no group membership information.
.Pp
Both PIM-SM and PIM-DM are fairly complex protocols,
though PIM-SM is much more complex.
To enable PIM-SM or PIM-DM multicast routing in a router,
the user must enable multicast routing and PIM processing in the kernel
(see
.Sx SYNOPSIS
about the kernel configuration options),
and must run a PIM-SM or PIM-DM capable user-level process.
From developer's point of view,
the programming guide described in the
.Sx "Programming Guide"
section should be used to control the PIM processing in the kernel.
.\"
.Ss Programming Guide
After a multicast routing socket is open and multicast forwarding
is enabled in the kernel
(see
.Xr multicast 4 ) ,
one of the following socket options should be used to enable or disable
PIM processing in the kernel.
Note that those options require certain privilege
(i.e., root privilege):
.Bd -literal
/* IPv4 */
int v = 1;        /* 1 to enable, or 0 to disable */
setsockopt(mrouter_s4, IPPROTO_IP, MRT_PIM, (void *)\*[Am]v, sizeof(v));
.Ed
.Bd -literal
/* IPv6 */
int v = 1;        /* 1 to enable, or 0 to disable */
setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_PIM, (void *)\*[Am]v, sizeof(v));
.Ed
.Pp
After PIM processing is enabled, the multicast-capable interfaces
should be added
(see
.Xr multicast 4 ) .
In case of PIM-SM, the PIM-Register virtual interface must be added
as well.
This can be accomplished by using the following options:
.Bd -literal
/* IPv4 */
struct vifctl vc;
memset(\*[Am]vc, 0, sizeof(vc));
/* Assign all vifctl fields as appropriate */
\&...
if (is_pim_register_vif)
    vc.vifc_flags |= VIFF_REGISTER;
setsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_VIF, (void *)\*[Am]vc,
           sizeof(vc));
.Ed
.Bd -literal
/* IPv6 */
struct mif6ctl mc;
memset(\*[Am]mc, 0, sizeof(mc));
/* Assign all mif6ctl fields as appropriate */
\&...
if (is_pim_register_vif)
    mc.mif6c_flags |= MIFF_REGISTER;
setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_ADD_MIF, (void *)\*[Am]mc,
           sizeof(mc));
.Ed
.Pp
Sending or receiving of PIM packets can be accomplished by
opening first a
.Dq raw socket
(see
.Xr socket 2 ) ,
with protocol value of
.Dv IPPROTO_PIM :
.Bd -literal
/* IPv4 */
int pim_s4;
pim_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM);
.Ed
.Bd -literal
/* IPv6 */
int pim_s6;
pim_s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM);
.Ed
.Pp
Then, the following system calls can be used to send or receive PIM
packets:
.Xr sendto 2 ,
.Xr sendmsg 2 ,
.Xr recvfrom 2 ,
.Xr recvmsg 2 .
.\"
.Sh SEE ALSO
.Xr getsockopt 2 ,
.Xr recvfrom 2 ,
.Xr recvmsg 2 ,
.Xr sendmsg 2 ,
.Xr sendto 2 ,
.Xr setsockopt 2 ,
.Xr socket 2 ,
.Xr inet 4 ,
.Xr intro 4 ,
.Xr ip 4 ,
.Xr multicast 4
.\"
.Sh STANDARDS
.\" XXX the PIM-SM number must be updated after RFC 2362 is
.\" replaced by a new RFC by the end of year 2003 or so.
The PIM-SM protocol is specified in RFC 2362 (to be replaced by
.%T draft-ietf-pim-sm-v2-new-* ) .
The PIM-DM protocol is specified in
.%T draft-ietf-pim-dm-new-v2-* ) .
.\"
.Sh AUTHORS
.An -nosplit
The original IPv4 PIM kernel support for IRIX and SunOS-4.x was
implemented by
.An Ahmed Helmy
(USC and SGI).
Later the code was ported to various
.Bx
flavors and modified by
.An George Edmond Eddy
(Rusty) (ISI),
.An Hitoshi Asaeda
(WIDE Project), and
.An Pavlin Radoslavov
(USC/ISI and ICSI).
The IPv6 PIM kernel support was implemented by the KAME project
.Pq Pa http://www.kame.net ,
and was based on the IPv4 PIM kernel support.
.Pp
This manual page was written by
.An Pavlin Radoslavov
(ICSI).