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