186d7f5d3SJohn Marino.\" Copyright (c) 2001-2003 International Computer Science Institute 286d7f5d3SJohn Marino.\" 386d7f5d3SJohn Marino.\" Permission is hereby granted, free of charge, to any person obtaining a 486d7f5d3SJohn Marino.\" copy of this software and associated documentation files (the "Software"), 586d7f5d3SJohn Marino.\" to deal in the Software without restriction, including without limitation 686d7f5d3SJohn Marino.\" the rights to use, copy, modify, merge, publish, distribute, sublicense, 786d7f5d3SJohn Marino.\" and/or sell copies of the Software, and to permit persons to whom the 886d7f5d3SJohn Marino.\" Software is furnished to do so, subject to the following conditions: 986d7f5d3SJohn Marino.\" 1086d7f5d3SJohn Marino.\" The above copyright notice and this permission notice shall be included in 1186d7f5d3SJohn Marino.\" all copies or substantial portions of the Software. 1286d7f5d3SJohn Marino.\" 1386d7f5d3SJohn Marino.\" The names and trademarks of copyright holders may not be used in 1486d7f5d3SJohn Marino.\" advertising or publicity pertaining to the software without specific 1586d7f5d3SJohn Marino.\" prior permission. Title to copyright in this software and any associated 1686d7f5d3SJohn Marino.\" documentation will at all times remain with the copyright holders. 1786d7f5d3SJohn Marino.\" 1886d7f5d3SJohn Marino.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 1986d7f5d3SJohn Marino.\" IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 2086d7f5d3SJohn Marino.\" FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 2186d7f5d3SJohn Marino.\" AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 2286d7f5d3SJohn Marino.\" LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 2386d7f5d3SJohn Marino.\" FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 2486d7f5d3SJohn Marino.\" DEALINGS IN THE SOFTWARE. 2586d7f5d3SJohn Marino.\" 2686d7f5d3SJohn Marino.\" $FreeBSD: src/share/man/man4/pim.4,v 1.2 2004/07/09 09:22:36 ru Exp $ 2786d7f5d3SJohn Marino.\" $DragonFly: src/share/man/man4/pim.4,v 1.5 2008/04/15 23:51:00 swildner Exp $ 2886d7f5d3SJohn Marino.\" 2986d7f5d3SJohn Marino.Dd April 16, 2008 3086d7f5d3SJohn Marino.Dt PIM 4 3186d7f5d3SJohn Marino.Os 3286d7f5d3SJohn Marino.\" 3386d7f5d3SJohn Marino.Sh NAME 3486d7f5d3SJohn Marino.Nm pim 3586d7f5d3SJohn Marino.Nd Protocol Independent Multicast 3686d7f5d3SJohn Marino.\" 3786d7f5d3SJohn Marino.Sh SYNOPSIS 3886d7f5d3SJohn Marino.Cd "options MROUTING" 3986d7f5d3SJohn Marino.Cd "options PIM" 4086d7f5d3SJohn Marino.Pp 4186d7f5d3SJohn Marino.In sys/types.h 4286d7f5d3SJohn Marino.In sys/socket.h 4386d7f5d3SJohn Marino.In netinet/in.h 4486d7f5d3SJohn Marino.In net/ip_mroute/ip_mroute.h 4586d7f5d3SJohn Marino.In netinet/pim.h 4686d7f5d3SJohn Marino.Ft int 4786d7f5d3SJohn Marino.Fn getsockopt "int s" IPPROTO_IP MRT_PIM "void *optval" "socklen_t *optlen" 4886d7f5d3SJohn Marino.Ft int 4986d7f5d3SJohn Marino.Fn setsockopt "int s" IPPROTO_IP MRT_PIM "const void *optval" "socklen_t optlen" 5086d7f5d3SJohn Marino.Ft int 5186d7f5d3SJohn Marino.Fn getsockopt "int s" IPPROTO_IPV6 MRT6_PIM "void *optval" "socklen_t *optlen" 5286d7f5d3SJohn Marino.Ft int 5386d7f5d3SJohn Marino.Fn setsockopt "int s" IPPROTO_IPV6 MRT6_PIM "const void *optval" "socklen_t optlen" 5486d7f5d3SJohn Marino.Sh DESCRIPTION 5586d7f5d3SJohn Marino.Tn PIM 5686d7f5d3SJohn Marinois the common name for two multicast routing protocols: 5786d7f5d3SJohn MarinoProtocol Independent Multicast - Sparse Mode (PIM-SM) and 5886d7f5d3SJohn MarinoProtocol Independent Multicast - Dense Mode (PIM-DM). 5986d7f5d3SJohn Marino.Pp 6086d7f5d3SJohn MarinoPIM-SM is a multicast routing protocol that can use the underlying 6186d7f5d3SJohn Marinounicast routing information base or a separate multicast-capable 6286d7f5d3SJohn Marinorouting information base. 6386d7f5d3SJohn MarinoIt builds unidirectional shared trees rooted at a Rendezvous 6486d7f5d3SJohn MarinoPoint (RP) per group, 6586d7f5d3SJohn Marinoand optionally creates shortest-path trees per source. 6686d7f5d3SJohn Marino.Pp 6786d7f5d3SJohn MarinoPIM-DM is a multicast routing protocol that uses the underlying 6886d7f5d3SJohn Marinounicast routing information base to flood multicast datagrams 6986d7f5d3SJohn Marinoto all multicast routers. 7086d7f5d3SJohn MarinoPrune messages are used to prevent future datagrams from propagating 7186d7f5d3SJohn Marinoto routers with no group membership information. 7286d7f5d3SJohn Marino.Pp 7386d7f5d3SJohn MarinoBoth PIM-SM and PIM-DM are fairly complex protocols, 7486d7f5d3SJohn Marinothough PIM-SM is much more complex. 7586d7f5d3SJohn MarinoTo enable PIM-SM or PIM-DM multicast routing in a router, 7686d7f5d3SJohn Marinothe user must enable multicast routing and PIM processing in the kernel 7786d7f5d3SJohn Marino(see 7886d7f5d3SJohn Marino.Sx SYNOPSIS 7986d7f5d3SJohn Marinoabout the kernel configuration options), 8086d7f5d3SJohn Marinoand must run a PIM-SM or PIM-DM capable user-level process. 8186d7f5d3SJohn MarinoFrom developer's point of view, 8286d7f5d3SJohn Marinothe programming guide described in the 8386d7f5d3SJohn Marino.Sx "Programming Guide" 8486d7f5d3SJohn Marinosection should be used to control the PIM processing in the kernel. 8586d7f5d3SJohn Marino.\" 8686d7f5d3SJohn Marino.Ss Programming Guide 8786d7f5d3SJohn MarinoAfter a multicast routing socket is open and multicast forwarding 8886d7f5d3SJohn Marinois enabled in the kernel 8986d7f5d3SJohn Marino(see 9086d7f5d3SJohn Marino.Xr multicast 4 ) , 9186d7f5d3SJohn Marinoone of the following socket options should be used to enable or disable 9286d7f5d3SJohn MarinoPIM processing in the kernel. 9386d7f5d3SJohn MarinoNote that those options require certain privilege 9486d7f5d3SJohn Marino(i.e., root privilege): 9586d7f5d3SJohn Marino.Bd -literal 9686d7f5d3SJohn Marino/* IPv4 */ 9786d7f5d3SJohn Marinoint v = 1; /* 1 to enable, or 0 to disable */ 9886d7f5d3SJohn Marinosetsockopt(mrouter_s4, IPPROTO_IP, MRT_PIM, (void *)&v, sizeof(v)); 9986d7f5d3SJohn Marino.Ed 10086d7f5d3SJohn Marino.Bd -literal 10186d7f5d3SJohn Marino/* IPv6 */ 10286d7f5d3SJohn Marinoint v = 1; /* 1 to enable, or 0 to disable */ 10386d7f5d3SJohn Marinosetsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_PIM, (void *)&v, sizeof(v)); 10486d7f5d3SJohn Marino.Ed 10586d7f5d3SJohn Marino.Pp 10686d7f5d3SJohn MarinoAfter PIM processing is enabled, the multicast-capable interfaces 10786d7f5d3SJohn Marinoshould be added 10886d7f5d3SJohn Marino(see 10986d7f5d3SJohn Marino.Xr multicast 4 ) . 11086d7f5d3SJohn MarinoIn case of PIM-SM, the PIM-Register virtual interface must be added 11186d7f5d3SJohn Marinoas well. 11286d7f5d3SJohn MarinoThis can be accomplished by using the following options: 11386d7f5d3SJohn Marino.Bd -literal 11486d7f5d3SJohn Marino/* IPv4 */ 11586d7f5d3SJohn Marinostruct vifctl vc; 11686d7f5d3SJohn Marinomemset(&vc, 0, sizeof(vc)); 11786d7f5d3SJohn Marino/* Assign all vifctl fields as appropriate */ 11886d7f5d3SJohn Marino\&... 11986d7f5d3SJohn Marinoif (is_pim_register_vif) 12086d7f5d3SJohn Marino vc.vifc_flags |= VIFF_REGISTER; 12186d7f5d3SJohn Marinosetsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_VIF, (void *)&vc, 12286d7f5d3SJohn Marino sizeof(vc)); 12386d7f5d3SJohn Marino.Ed 12486d7f5d3SJohn Marino.Bd -literal 12586d7f5d3SJohn Marino/* IPv6 */ 12686d7f5d3SJohn Marinostruct mif6ctl mc; 12786d7f5d3SJohn Marinomemset(&mc, 0, sizeof(mc)); 12886d7f5d3SJohn Marino/* Assign all mif6ctl fields as appropriate */ 12986d7f5d3SJohn Marino\&... 13086d7f5d3SJohn Marinoif (is_pim_register_vif) 13186d7f5d3SJohn Marino mc.mif6c_flags |= MIFF_REGISTER; 13286d7f5d3SJohn Marinosetsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_ADD_MIF, (void *)&mc, 13386d7f5d3SJohn Marino sizeof(mc)); 13486d7f5d3SJohn Marino.Ed 13586d7f5d3SJohn Marino.Pp 13686d7f5d3SJohn MarinoSending or receiving of PIM packets can be accomplished by 13786d7f5d3SJohn Marinoopening first a 13886d7f5d3SJohn Marino.Dq raw socket 13986d7f5d3SJohn Marino(see 14086d7f5d3SJohn Marino.Xr socket 2 ) , 14186d7f5d3SJohn Marinowith protocol value of 14286d7f5d3SJohn Marino.Dv IPPROTO_PIM : 14386d7f5d3SJohn Marino.Bd -literal 14486d7f5d3SJohn Marino/* IPv4 */ 14586d7f5d3SJohn Marinoint pim_s4; 14686d7f5d3SJohn Marinopim_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM); 14786d7f5d3SJohn Marino.Ed 14886d7f5d3SJohn Marino.Bd -literal 14986d7f5d3SJohn Marino/* IPv6 */ 15086d7f5d3SJohn Marinoint pim_s6; 15186d7f5d3SJohn Marinopim_s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM); 15286d7f5d3SJohn Marino.Ed 15386d7f5d3SJohn Marino.Pp 15486d7f5d3SJohn MarinoThen, the following system calls can be used to send or receive PIM 15586d7f5d3SJohn Marinopackets: 15686d7f5d3SJohn Marino.Xr sendto 2 , 15786d7f5d3SJohn Marino.Xr sendmsg 2 , 15886d7f5d3SJohn Marino.Xr recvfrom 2 , 15986d7f5d3SJohn Marino.Xr recvmsg 2 . 16086d7f5d3SJohn Marino.\" 16186d7f5d3SJohn Marino.Sh SEE ALSO 16286d7f5d3SJohn Marino.Xr getsockopt 2 , 16386d7f5d3SJohn Marino.Xr recvfrom 2 , 16486d7f5d3SJohn Marino.Xr recvmsg 2 , 16586d7f5d3SJohn Marino.Xr sendmsg 2 , 16686d7f5d3SJohn Marino.Xr sendto 2 , 16786d7f5d3SJohn Marino.Xr setsockopt 2 , 16886d7f5d3SJohn Marino.Xr socket 2 , 16986d7f5d3SJohn Marino.Xr inet 4 , 17086d7f5d3SJohn Marino.Xr intro 4 , 17186d7f5d3SJohn Marino.Xr ip 4 , 17286d7f5d3SJohn Marino.Xr multicast 4 17386d7f5d3SJohn Marino.\" 17486d7f5d3SJohn Marino.Sh STANDARDS 17586d7f5d3SJohn MarinoThe PIM-SM protocol is specified in RFC 4601. 17686d7f5d3SJohn MarinoThe PIM-DM protocol is specified in RFC 3973. 17786d7f5d3SJohn Marino.\" 17886d7f5d3SJohn Marino.Sh AUTHORS 17986d7f5d3SJohn Marino.An -nosplit 18086d7f5d3SJohn MarinoThe original IPv4 PIM kernel support for IRIX and SunOS-4.x was 18186d7f5d3SJohn Marinoimplemented by 18286d7f5d3SJohn Marino.An Ahmed Helmy 18386d7f5d3SJohn Marino(USC and SGI). 18486d7f5d3SJohn MarinoLater the code was ported to various 18586d7f5d3SJohn Marino.Bx 18686d7f5d3SJohn Marinoflavors and modified by 18786d7f5d3SJohn Marino.An George Edmond Eddy 18886d7f5d3SJohn Marino(Rusty) (ISI), 18986d7f5d3SJohn Marino.An Hitoshi Asaeda 19086d7f5d3SJohn Marino(WIDE Project), and 19186d7f5d3SJohn Marino.An Pavlin Radoslavov 19286d7f5d3SJohn Marino(USC/ISI and ICSI). 19386d7f5d3SJohn MarinoThe IPv6 PIM kernel support was implemented by the KAME project 19486d7f5d3SJohn Marino.Pa ( http://www.kame.net ) , 19586d7f5d3SJohn Marinoand was based on the IPv4 PIM kernel support. 19686d7f5d3SJohn Marino.Pp 19786d7f5d3SJohn MarinoThis manual page was written by 19886d7f5d3SJohn Marino.An Pavlin Radoslavov 19986d7f5d3SJohn Marino(ICSI). 200