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