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.\" 26addeef82SBruce A. Mah.\" $FreeBSD$ 27addeef82SBruce A. Mah.\" 28ba73f5c5SChristian Brueffer.Dd February 12, 2007 29addeef82SBruce A. Mah.Dt PIM 4 30addeef82SBruce A. Mah.Os 31addeef82SBruce A. Mah.\" 32addeef82SBruce A. Mah.Sh NAME 33addeef82SBruce A. Mah.Nm pim 34addeef82SBruce A. Mah.Nd Protocol Independent Multicast 35addeef82SBruce A. Mah.\" 36addeef82SBruce A. Mah.Sh SYNOPSIS 37addeef82SBruce A. Mah.Cd "options MROUTING" 38addeef82SBruce A. Mah.Pp 39addeef82SBruce A. Mah.In sys/types.h 40addeef82SBruce A. Mah.In sys/socket.h 41addeef82SBruce A. Mah.In netinet/in.h 42addeef82SBruce A. Mah.In netinet/ip_mroute.h 43addeef82SBruce A. Mah.In netinet/pim.h 44addeef82SBruce A. Mah.Ft int 45addeef82SBruce A. Mah.Fn getsockopt "int s" IPPROTO_IP MRT_PIM "void *optval" "socklen_t *optlen" 46addeef82SBruce A. Mah.Ft int 47addeef82SBruce A. Mah.Fn setsockopt "int s" IPPROTO_IP MRT_PIM "const void *optval" "socklen_t optlen" 48addeef82SBruce A. Mah.Ft int 49addeef82SBruce A. Mah.Fn getsockopt "int s" IPPROTO_IPV6 MRT6_PIM "void *optval" "socklen_t *optlen" 50addeef82SBruce A. Mah.Ft int 51addeef82SBruce A. Mah.Fn setsockopt "int s" IPPROTO_IPV6 MRT6_PIM "const void *optval" "socklen_t optlen" 52addeef82SBruce A. Mah.Sh DESCRIPTION 53addeef82SBruce A. Mah.Tn PIM 54addeef82SBruce A. Mahis the common name for two multicast routing protocols: 55addeef82SBruce A. MahProtocol Independent Multicast - Sparse Mode (PIM-SM) and 56addeef82SBruce A. MahProtocol Independent Multicast - Dense Mode (PIM-DM). 57addeef82SBruce A. Mah.Pp 58addeef82SBruce A. MahPIM-SM is a multicast routing protocol that can use the underlying 59addeef82SBruce A. Mahunicast routing information base or a separate multicast-capable 60addeef82SBruce A. Mahrouting information base. 61addeef82SBruce A. MahIt builds unidirectional shared trees rooted at a Rendezvous 62addeef82SBruce A. MahPoint (RP) per group, 63addeef82SBruce A. Mahand optionally creates shortest-path trees per source. 64addeef82SBruce A. Mah.Pp 65addeef82SBruce A. MahPIM-DM is a multicast routing protocol that uses the underlying 66addeef82SBruce A. Mahunicast routing information base to flood multicast datagrams 67addeef82SBruce A. Mahto all multicast routers. 68addeef82SBruce A. MahPrune messages are used to prevent future datagrams from propagating 69addeef82SBruce A. Mahto routers with no group membership information. 70addeef82SBruce A. Mah.Pp 71addeef82SBruce A. MahBoth PIM-SM and PIM-DM are fairly complex protocols, 72addeef82SBruce A. Mahthough PIM-SM is much more complex. 73addeef82SBruce A. MahTo enable PIM-SM or PIM-DM multicast routing in a router, 74addeef82SBruce A. Mahthe user must enable multicast routing and PIM processing in the kernel 75addeef82SBruce A. Mah(see 76addeef82SBruce A. Mah.Sx SYNOPSIS 77addeef82SBruce A. Mahabout the kernel configuration options), 78addeef82SBruce A. Mahand must run a PIM-SM or PIM-DM capable user-level process. 79addeef82SBruce A. MahFrom developer's point of view, 80addeef82SBruce A. Mahthe programming guide described in the 81addeef82SBruce A. Mah.Sx "Programming Guide" 82addeef82SBruce A. Mahsection should be used to control the PIM processing in the kernel. 83addeef82SBruce A. Mah.\" 84addeef82SBruce A. Mah.Ss Programming Guide 85addeef82SBruce A. MahAfter a multicast routing socket is open and multicast forwarding 86addeef82SBruce A. Mahis enabled in the kernel 87addeef82SBruce A. Mah(see 88addeef82SBruce A. Mah.Xr multicast 4 ) , 89addeef82SBruce A. Mahone of the following socket options should be used to enable or disable 90addeef82SBruce A. MahPIM processing in the kernel. 91addeef82SBruce A. MahNote that those options require certain privilege 92addeef82SBruce A. Mah(i.e., root privilege): 93addeef82SBruce A. Mah.Bd -literal 94addeef82SBruce A. Mah/* IPv4 */ 95addeef82SBruce A. Mahint v = 1; /* 1 to enable, or 0 to disable */ 96addeef82SBruce A. Mahsetsockopt(mrouter_s4, IPPROTO_IP, MRT_PIM, (void *)&v, sizeof(v)); 97addeef82SBruce A. Mah.Ed 98addeef82SBruce A. Mah.Bd -literal 99addeef82SBruce A. Mah/* IPv6 */ 100addeef82SBruce A. Mahint v = 1; /* 1 to enable, or 0 to disable */ 101addeef82SBruce A. Mahsetsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_PIM, (void *)&v, sizeof(v)); 102addeef82SBruce A. Mah.Ed 103addeef82SBruce A. Mah.Pp 104addeef82SBruce A. MahAfter PIM processing is enabled, the multicast-capable interfaces 105addeef82SBruce A. Mahshould be added 106addeef82SBruce A. Mah(see 107addeef82SBruce A. Mah.Xr multicast 4 ) . 108addeef82SBruce A. MahIn case of PIM-SM, the PIM-Register virtual interface must be added 109addeef82SBruce A. Mahas well. 110addeef82SBruce A. MahThis can be accomplished by using the following options: 111addeef82SBruce A. Mah.Bd -literal 112addeef82SBruce A. Mah/* IPv4 */ 113addeef82SBruce A. Mahstruct vifctl vc; 114addeef82SBruce A. Mahmemset(&vc, 0, sizeof(vc)); 115addeef82SBruce A. Mah/* Assign all vifctl fields as appropriate */ 116addeef82SBruce A. Mah\&... 117addeef82SBruce A. Mahif (is_pim_register_vif) 118addeef82SBruce A. Mah vc.vifc_flags |= VIFF_REGISTER; 119addeef82SBruce A. Mahsetsockopt(mrouter_s4, IPPROTO_IP, MRT_ADD_VIF, (void *)&vc, 120addeef82SBruce A. Mah sizeof(vc)); 121addeef82SBruce A. Mah.Ed 122addeef82SBruce A. Mah.Bd -literal 123addeef82SBruce A. Mah/* IPv6 */ 124addeef82SBruce A. Mahstruct mif6ctl mc; 125addeef82SBruce A. Mahmemset(&mc, 0, sizeof(mc)); 126addeef82SBruce A. Mah/* Assign all mif6ctl fields as appropriate */ 127addeef82SBruce A. Mah\&... 128addeef82SBruce A. Mahif (is_pim_register_vif) 129addeef82SBruce A. Mah mc.mif6c_flags |= MIFF_REGISTER; 130addeef82SBruce A. Mahsetsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_ADD_MIF, (void *)&mc, 131addeef82SBruce A. Mah sizeof(mc)); 132addeef82SBruce A. Mah.Ed 133addeef82SBruce A. Mah.Pp 134addeef82SBruce A. MahSending or receiving of PIM packets can be accomplished by 135addeef82SBruce A. Mahopening first a 136addeef82SBruce A. Mah.Dq raw socket 137addeef82SBruce A. Mah(see 138addeef82SBruce A. Mah.Xr socket 2 ) , 139addeef82SBruce A. Mahwith protocol value of 140ef151d78SRuslan Ermilov.Dv IPPROTO_PIM : 141addeef82SBruce A. Mah.Bd -literal 142addeef82SBruce A. Mah/* IPv4 */ 143addeef82SBruce A. Mahint pim_s4; 144addeef82SBruce A. Mahpim_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM); 145addeef82SBruce A. Mah.Ed 146addeef82SBruce A. Mah.Bd -literal 147addeef82SBruce A. Mah/* IPv6 */ 148addeef82SBruce A. Mahint pim_s6; 149addeef82SBruce A. Mahpim_s6 = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM); 150addeef82SBruce A. Mah.Ed 151addeef82SBruce A. Mah.Pp 152addeef82SBruce A. MahThen, the following system calls can be used to send or receive PIM 153addeef82SBruce A. Mahpackets: 154addeef82SBruce A. Mah.Xr sendto 2 , 155addeef82SBruce A. Mah.Xr sendmsg 2 , 156addeef82SBruce A. Mah.Xr recvfrom 2 , 157addeef82SBruce A. Mah.Xr recvmsg 2 . 158addeef82SBruce A. Mah.\" 159addeef82SBruce A. Mah.Sh SEE ALSO 160addeef82SBruce A. Mah.Xr getsockopt 2 , 161addeef82SBruce A. Mah.Xr recvfrom 2 , 162addeef82SBruce A. Mah.Xr recvmsg 2 , 163addeef82SBruce A. Mah.Xr sendmsg 2 , 164addeef82SBruce A. Mah.Xr sendto 2 , 165addeef82SBruce A. Mah.Xr setsockopt 2 , 166addeef82SBruce A. Mah.Xr socket 2 , 167addeef82SBruce A. Mah.Xr inet 4 , 168addeef82SBruce A. Mah.Xr intro 4 , 169addeef82SBruce A. Mah.Xr ip 4 , 170addeef82SBruce A. Mah.Xr multicast 4 171addeef82SBruce A. Mah.\" 172addeef82SBruce A. Mah.Sh STANDARDS 173addeef82SBruce A. Mah.\" XXX the PIM-SM number must be updated after RFC 2362 is 174addeef82SBruce A. Mah.\" replaced by a new RFC by the end of year 2003 or so. 175addeef82SBruce A. MahThe PIM-SM protocol is specified in RFC 2362 (to be replaced by 176ef151d78SRuslan Ermilov.%T draft-ietf-pim-sm-v2-new-* ) . 177addeef82SBruce A. MahThe PIM-DM protocol is specified in 178ef151d78SRuslan Ermilov.%T draft-ietf-pim-dm-new-v2-* ) . 179addeef82SBruce A. Mah.\" 180addeef82SBruce A. Mah.Sh AUTHORS 181ef151d78SRuslan Ermilov.An -nosplit 182addeef82SBruce A. MahThe original IPv4 PIM kernel support for IRIX and SunOS-4.x was 183ef151d78SRuslan Ermilovimplemented by 184ef151d78SRuslan Ermilov.An Ahmed Helmy 185ef151d78SRuslan Ermilov(USC and SGI). 186ef151d78SRuslan ErmilovLater the code was ported to various 187ef151d78SRuslan Ermilov.Bx 188ef151d78SRuslan Ermilovflavors and modified by 189ef151d78SRuslan Ermilov.An George Edmond Eddy 190ef151d78SRuslan Ermilov(Rusty) (ISI), 191ef151d78SRuslan Ermilov.An Hitoshi Asaeda 192ef151d78SRuslan Ermilov(WIDE Project), and 193ef151d78SRuslan Ermilov.An Pavlin Radoslavov 194ef151d78SRuslan Ermilov(USC/ISI and ICSI). 195addeef82SBruce A. MahThe IPv6 PIM kernel support was implemented by the KAME project 196ef151d78SRuslan Ermilov.Pq Pa http://www.kame.net , 197ef151d78SRuslan Ermilovand was based on the IPv4 PIM kernel support. 198addeef82SBruce A. Mah.Pp 199ef151d78SRuslan ErmilovThis manual page was written by 200ef151d78SRuslan Ermilov.An Pavlin Radoslavov 201ef151d78SRuslan Ermilov(ICSI). 202