summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--distrib/sets/lists/comp/mi4
-rw-r--r--distrib/sets/lists/man/mi1
-rw-r--r--sbin/sysctl/sysctl.c9
-rw-r--r--share/man/man4/Makefile4
-rw-r--r--share/man/man4/multicast.4100
-rw-r--r--share/man/man4/pim.4232
-rw-r--r--sys/conf/GENERIC3
-rw-r--r--sys/netinet/in.h4
-rw-r--r--sys/netinet/in_proto.c12
-rw-r--r--sys/netinet/ip_mroute.c663
-rw-r--r--sys/netinet/ip_mroute.h12
-rw-r--r--sys/netinet/pim.h122
-rw-r--r--sys/netinet/pim_var.h83
-rw-r--r--sys/netinet6/in6.h4
-rw-r--r--sys/netinet6/in6_proto.c13
-rw-r--r--sys/netinet6/ip6_mroute.c400
-rw-r--r--sys/netinet6/ip6_mroute.h3
-rw-r--r--sys/netinet6/pim6.h69
-rw-r--r--sys/netinet6/pim6_var.h71
-rw-r--r--sys/netinet6/raw_ip6.c3
-rw-r--r--usr.bin/netstat/inet.c41
-rw-r--r--usr.bin/netstat/inet6.c36
-rw-r--r--usr.bin/netstat/main.c4
-rw-r--r--usr.bin/netstat/mroute6.c6
24 files changed, 30 insertions, 1869 deletions
diff --git a/distrib/sets/lists/comp/mi b/distrib/sets/lists/comp/mi
index ec7832724e7..f53f6608052 100644
--- a/distrib/sets/lists/comp/mi
+++ b/distrib/sets/lists/comp/mi
@@ -1028,8 +1028,6 @@
./usr/include/netinet/ip_ipsp.h
./usr/include/netinet/ip_mroute.h
./usr/include/netinet/ip_var.h
-./usr/include/netinet/pim.h
-./usr/include/netinet/pim_var.h
./usr/include/netinet/tcp.h
./usr/include/netinet/tcp_debug.h
./usr/include/netinet/tcp_fsm.h
@@ -1050,8 +1048,6 @@
./usr/include/netinet6/mld6.h
./usr/include/netinet6/mld6_var.h
./usr/include/netinet6/nd6.h
-./usr/include/netinet6/pim6.h
-./usr/include/netinet6/pim6_var.h
./usr/include/netinet6/raw_ip6.h
./usr/include/netinet6/tcpipv6.h
./usr/include/netmpls
diff --git a/distrib/sets/lists/man/mi b/distrib/sets/lists/man/mi
index 4e8474e7fa4..ddcd1387dee 100644
--- a/distrib/sets/lists/man/mi
+++ b/distrib/sets/lists/man/mi
@@ -1584,7 +1584,6 @@
./usr/share/man/man4/pfsync.4
./usr/share/man/man4/pgt.4
./usr/share/man/man4/piixpm.4
-./usr/share/man/man4/pim.4
./usr/share/man/man4/pipex.4
./usr/share/man/man4/pms.4
./usr/share/man/man4/ppb.4
diff --git a/sbin/sysctl/sysctl.c b/sbin/sysctl/sysctl.c
index 1b981f0d067..41aeda92402 100644
--- a/sbin/sysctl/sysctl.c
+++ b/sbin/sysctl/sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sysctl.c,v 1.223 2016/10/18 09:31:05 otto Exp $ */
+/* $OpenBSD: sysctl.c,v 1.224 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: sysctl.c,v 1.9 1995/09/30 07:12:50 thorpej Exp $ */
/*
@@ -76,7 +76,6 @@
#include <netinet/ip6.h>
#include <netinet/icmp6.h>
#include <netinet6/ip6_var.h>
-#include <netinet6/pim6_var.h>
#include <netinet6/ip6_divert.h>
#include <netmpls/mpls.h>
@@ -565,8 +564,7 @@ parse(char *string, int flags)
if (len < 0)
return;
- if ((mib[2] == IPPROTO_PIM && mib[3] == PIM6CTL_STATS) ||
- (mib[2] == IPPROTO_IPV6 && mib[3] == IPV6CTL_MRTMFC) ||
+ if ((mib[2] == IPPROTO_IPV6 && mib[3] == IPV6CTL_MRTMFC) ||
(mib[2] == IPPROTO_IPV6 && mib[3] == IPV6CTL_MRTMIF) ||
(mib[2] == IPPROTO_DIVERT && mib[3] == DIVERT6CTL_STATS)) {
if (flags == 0)
@@ -1989,7 +1987,6 @@ sysctl_inet(char *string, char **bufpp, int mib[], int flags, int *typep)
struct ctlname inet6name[] = CTL_IPV6PROTO_NAMES;
struct ctlname ip6name[] = IPV6CTL_NAMES;
struct ctlname icmp6name[] = ICMPV6CTL_NAMES;
-struct ctlname pim6name[] = PIM6CTL_NAMES;
struct ctlname divert6name[] = DIVERT6CTL_NAMES;
struct list inet6list = { inet6name, IPV6PROTO_MAXID };
struct list inet6vars[] = {
@@ -2028,7 +2025,7 @@ struct list inet6vars[] = {
/*100*/ { 0, 0 },
{ 0, 0 },
{ 0, 0 },
- { pim6name, PIM6CTL_MAXID }, /* pim6 */
+ { 0, 0 }, /* pim6 */
{ 0, 0 },
{ 0, 0 },
{ 0, 0 },
diff --git a/share/man/man4/Makefile b/share/man/man4/Makefile
index f56ea52fada..175df43bfea 100644
--- a/share/man/man4/Makefile
+++ b/share/man/man4/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.646 2016/12/07 15:53:05 mikeb Exp $
+# $OpenBSD: Makefile,v 1.647 2016/12/22 11:04:44 rzalamena Exp $
MAN= aac.4 ac97.4 acphy.4 \
acpi.4 acpiac.4 acpials.4 acpiasus.4 acpibat.4 \
@@ -46,7 +46,7 @@ MAN= aac.4 ac97.4 acphy.4 \
pair.4 pcagpio.4 pcaled.4 pcdisplay.4 pchb.4 pchtemp.4 pci.4 pcib.4 \
pcfadc.4 pcfiic.4 pcfrtc.4 pciide.4 pckbc.4 pckbd.4 pcmcia.4 pcn.4 \
pcppi.4 \
- pcscp.4 pf.4 pflog.4 pflow.4 pfsync.4 pgt.4 piixpm.4 pim.4 pipex.4 \
+ pcscp.4 pf.4 pflog.4 pflow.4 pfsync.4 pgt.4 piixpm.4 pipex.4 \
pms.4 ppb.4 ppp.4 pppoe.4 pppx.4 pty.4 puc.4 pvbus.4 pwdog.4 \
qla.4 qle.4 qlw.4 qsphy.4 radio.4 \
ral.4 random.4 rdomain.4 rd.4 rdac.4 re.4 rdcphy.4 rgephy.4 ricohrtc.4 \
diff --git a/share/man/man4/multicast.4 b/share/man/man4/multicast.4
index 0f7e7112974..46b932aeb3f 100644
--- a/share/man/man4/multicast.4
+++ b/share/man/man4/multicast.4
@@ -24,10 +24,10 @@
.\" DEALINGS IN THE SOFTWARE.
.\"
.\" $FreeBSD: src/share/man/man4/multicast.4,v 1.4 2004/07/09 09:22:36 ru Exp $
-.\" $OpenBSD: multicast.4,v 1.10 2015/02/16 16:38:54 naddy Exp $
+.\" $OpenBSD: multicast.4,v 1.11 2016/12/22 11:04:44 rzalamena Exp $
.\" $NetBSD: multicast.4,v 1.3 2004/09/12 13:12:26 wiz Exp $
.\"
-.Dd $Mdocdate: February 16 2015 $
+.Dd $Mdocdate: December 22 2016 $
.Dt MULTICAST 4
.Os
.\"
@@ -65,10 +65,8 @@ All multicast-capable routers must run a common multicast routing
protocol.
The Distance Vector Multicast Routing Protocol (DVMRP)
was the first developed multicast routing protocol.
-Later, other protocols such as Multicast Extensions to OSPF (MOSPF),
-Core Based Trees (CBT),
-Protocol Independent Multicast \- Sparse Mode (PIM-SM),
-and Protocol Independent Multicast \- Dense Mode (PIM-DM)
+Later, other protocols such as Multicast Extensions to OSPF (MOSPF) and
+Core Based Trees (CBT)
were developed as well.
.Pp
To start multicast routing,
@@ -150,12 +148,6 @@ setsockopt(mrouter_s6, IPPROTO_ICMPV6, ICMP6_FILTER, (void *)&filter,
sizeof(filter));
.Ed
.Pp
-After multicast forwarding is enabled, the multicast routing socket
-can be used to enable PIM processing in the kernel if either PIM-SM or
-PIM-DM are being used
-(see
-.Xr pim 4 ) .
-.Pp
For each network interface (e.g., physical or a virtual tunnel)
that would be used for multicast forwarding, a corresponding
multicast interface must be added to the kernel:
@@ -582,9 +574,6 @@ flag is used to explicitly disable the
.Dv IGMPMSG_WRONGVIF
kernel signal at the (S,G) granularity if a multicast data packet
arrives on the wrong interface.
-Usually this signal is used to
-complete the shortest-path switch for PIM-SM multicast routing,
-or to trigger a PIM assert message.
However, it should not be delivered for interfaces that are not set in
the outgoing interface, and that are not expecting to
become an incoming interface.
@@ -595,88 +584,8 @@ interfaces, then a data packet that arrives on that interface for
that MFC entry will NOT trigger a WRONGVIF signal.
If that flag is not set, then a signal is triggered (the default action).
.Pp
-The
-.Dv MRT_MFC_FLAGS_BORDER_VIF
-flag is used to specify whether the Border-bit in PIM
-Register messages should be set (when the Register encapsulation
-is performed inside the kernel).
-If it is set for the special PIM Register kernel virtual interface
-(see
-.Xr pim 4 ) ,
-the Border-bit in the Register messages sent to the RP will be set.
-.Pp
-The remaining six bits are reserved for future usage.
-.Pp
-The
-.Va mfcc_rp
-field is used to specify the RP address (for PIM-SM multicast routing)
-for a multicast
-group G if we want to perform kernel-level PIM Register encapsulation.
-The
-.Va mfcc_rp
-field is used only if the
-.Dv MRT_MFC_RP
-advanced API flag/capability has been successfully set by
-.Fn setsockopt MRT_API_CONFIG .
-.Pp
-.\"
-.\" 3. Kernel-level PIM Register encapsulation
-.\"
-If the
-.Dv MRT_MFC_RP
-flag was successfully set by
-.Fn setsockopt MRT_API_CONFIG ,
-then the kernel will attempt to perform
-the PIM Register encapsulation itself instead of sending the
-multicast data packets to user level (inside
-.Dv IGMPMSG_WHOLEPKT
-upcalls) for user-level encapsulation.
-The RP address would be taken from the
-.Va mfcc_rp
-field
-inside the new
-.Vt "struct mfcctl2" .
-However, even if the
-.Dv MRT_MFC_RP
-flag was successfully set, if the
-.Va mfcc_rp
-field was set to
-.Dv INADDR_ANY ,
-then the
-kernel will still deliver an
-.Dv IGMPMSG_WHOLEPKT
-upcall with the
-multicast data packet to the user-level process.
-.Pp
-In addition, if the multicast data packet is too large to fit within
-a single IP packet after the PIM Register encapsulation (e.g., if
-its size was on the order of 65500 bytes), the data packet will be
-fragmented, and then each of the fragments will be encapsulated
-separately.
-Note that typically a multicast data packet can be that
-large only if it was originated locally from the same hosts that
-performs the encapsulation; otherwise the transmission of the
-multicast data packet over Ethernet for example would have
-fragmented it into much smaller pieces.
-.\"
-.\" Note that if this code is ported to IPv6, we may need the kernel to
-.\" perform MTU discovery to the RP, and keep those discoveries inside
-.\" the kernel so the encapsulating router may send back ICMP
-.\" Fragmentation Required if the size of the multicast data packet is
-.\" too large (see "Encapsulating data packets in the Register Tunnel"
-.\" in Section 4.4.1 in the PIM-SM spec
-.\" draft-ietf-pim-sm-v2-new-05.{txt,ps}).
-.\" For IPv4 we may be able to get away without it, but for IPv6 we need
-.\" that.
-.\"
-.\" 4. Mechanism for "multicast bandwidth monitoring and upcalls".
-.\"
-.Pp
Typically, a multicast routing user-level process would need to know the
forwarding bandwidth for some data flow.
-For example, the multicast routing process may want to time out idle MFC
-entries, or for PIM-SM it can initiate (S,G) shortest-path switch if
-the bandwidth rate is above a threshold for example.
.Pp
The original solution for measuring the bandwidth of a dataflow was
that a user-level process would periodically
@@ -947,7 +856,6 @@ after the previous upcall.
.Xr intro 4 ,
.Xr ip 4 ,
.Xr ip6 4 ,
-.Xr pim 4 ,
.Xr mrouted 8 ,
.Xr sysctl 8
.\"
diff --git a/share/man/man4/pim.4 b/share/man/man4/pim.4
deleted file mode 100644
index 6b4e8f7c17f..00000000000
--- a/share/man/man4/pim.4
+++ /dev/null
@@ -1,232 +0,0 @@
-.\" 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.8 2012/08/24 08:54:32 jmc Exp $
-.\" $NetBSD: pim.4,v 1.2 2004/09/12 13:06:14 wiz Exp $
-.\"
-.Dd $Mdocdate: August 24 2012 $
-.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 forwarding via the
-.Va net.inet.ip.mforwarding
-.Xr sysctl 8
-and PIM processing in the kernel
-(see
-.Sx SYNOPSIS
-for the correct kernel configuration option).
-The user must also run a PIM-SM or PIM-DM capable user-level process.
-From a 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 -offset 4n
-/* IPv4 */
-int v = 1; /* 1 to enable, or 0 to disable */
-setsockopt(mrouter_s4, IPPROTO_IP, MRT_PIM, (void *)&v, sizeof(v));
-.Ed
-.Bd -literal -offset 4n
-/* IPv6 */
-int v = 1; /* 1 to enable, or 0 to disable */
-setsockopt(mrouter_s6, IPPROTO_IPV6, MRT6_PIM, (void *)&v, sizeof(v));
-.Ed
-.Pp
-After PIM processing is enabled, the multicast-capable interfaces
-should be added
-(see
-.Xr multicast 4 ) .
-For PIM-SM, the PIM-Register virtual interface must be added
-as well.
-This can be accomplished by using the following options:
-.Bd -literal -offset indent
-/* IPv4 */
-struct vifctl vc;
-memset(&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 *)&vc,
- sizeof(vc));
-.Ed
-.Bd -literal -offset indent
-/* IPv6 */
-struct mif6ctl mc;
-memset(&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 *)&mc,
- sizeof(mc));
-.Ed
-.Pp
-Sending or receiving of PIM packets can be accomplished by
-first opening a
-.Dq raw socket
-(see
-.Xr socket 2 ) ,
-with protocol value of
-.Dv IPPROTO_PIM :
-.Bd -literal -offset indent
-/* IPv4 */
-int pim_s4;
-pim_s4 = socket(AF_INET, SOCK_RAW, IPPROTO_PIM);
-.Ed
-.Bd -literal -offset indent
-/* 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 ,
-and
-.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 ,
-.Xr sysctl 8
-.\"
-.Sh STANDARDS
-.Rs
-.%A A. Adams
-.%A J. Nicholas
-.%A W. Siadak
-.%D January 2005
-.%R RFC 3973
-.%T Protocol Independent Multicast \(en Dense Mode (PIM-DM): Protocol Specification (Revised)
-.Re
-.Pp
-.Rs
-.%A B. Fenner
-.%A M. Handley
-.%A H. Holbrook
-.%A I. Kouvelas
-.%D August 2006
-.%R RFC 4601
-.%T Protocol Independent Multicast \(en Sparse Mode (PIM-SM): Protocol Specification (Revised)
-.Re
-.Pp
-.Rs
-.%A N. Bhaskar
-.%A A. Gall
-.%A J. Lingard
-.%A S. Venaas
-.%D January 2008
-.%R RFC 5059
-.%T Bootstrap Router (BSR) Mechanism for Protocol Independent Multicast (PIM)
-.Re
-.\"
-.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).
-.Pp
-The IPv6 PIM kernel support was implemented by the KAME project
-.Pq Lk http://www.kame.net ,
-and was based on the IPv4 PIM kernel support.
-.Pp
-This manual page was written by
-.An Pavlin Radoslavov
-(ICSI).
diff --git a/sys/conf/GENERIC b/sys/conf/GENERIC
index 14732076e9b..ab20737b81b 100644
--- a/sys/conf/GENERIC
+++ b/sys/conf/GENERIC
@@ -1,4 +1,4 @@
-# $OpenBSD: GENERIC,v 1.236 2016/11/29 09:08:34 mpi Exp $
+# $OpenBSD: GENERIC,v 1.237 2016/12/22 11:04:44 rzalamena Exp $
#
# Machine-independent option; used by all architectures for their
# GENERIC kernel
@@ -58,7 +58,6 @@ option PPP_BSDCOMP # PPP BSD compression
option PPP_DEFLATE
option PIPEX # Ppp IP EXtension, for npppd
option MROUTING # Multicast router
-#option PIM # Protocol Independent Multicast
option MPLS # Multi-Protocol Label Switching
#option BFD # Bi-directional Forwarding Detection
diff --git a/sys/netinet/in.h b/sys/netinet/in.h
index 4b2b0f54f55..997478c4f21 100644
--- a/sys/netinet/in.h
+++ b/sys/netinet/in.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in.h,v 1.119 2016/09/04 17:05:24 claudio Exp $ */
+/* $OpenBSD: in.h,v 1.120 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: in.h,v 1.20 1996/02/13 23:41:47 christos Exp $ */
/*
@@ -487,7 +487,7 @@ struct ip_mreq {
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
- { "pim", CTLTYPE_NODE }, \
+ { 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
diff --git a/sys/netinet/in_proto.c b/sys/netinet/in_proto.c
index d7de5402875..ea67e5cb113 100644
--- a/sys/netinet/in_proto.c
+++ b/sys/netinet/in_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_proto.c,v 1.70 2015/12/03 21:57:59 mpi Exp $ */
+/* $OpenBSD: in_proto.c,v 1.71 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: in_proto.c,v 1.14 1996/02/18 18:58:32 christos Exp $ */
/*
@@ -119,9 +119,6 @@
#endif
#include <netinet/igmp_var.h>
-#ifdef PIM
-#include <netinet/pim_var.h>
-#endif
#include <netinet/tcp.h>
#include <netinet/tcp_timer.h>
#include <netinet/tcp_var.h>
@@ -247,13 +244,6 @@ struct protosw inetsw[] = {
rip_usrreq,
igmp_init, igmp_fasttimo, igmp_slowtimo, 0, igmp_sysctl
},
-#ifdef PIM
-{ SOCK_RAW, &inetdomain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR,
- pim_input, rip_output, 0, rip_ctloutput,
- rip_usrreq,
- 0, 0, 0, 0, pim_sysctl
-},
-#endif /* PIM */
#ifdef IPSEC
{ SOCK_RAW, &inetdomain, IPPROTO_AH, PR_ATOMIC|PR_ADDR,
ah4_input, rip_output, ah4_ctlinput, rip_ctloutput,
diff --git a/sys/netinet/ip_mroute.c b/sys/netinet/ip_mroute.c
index e48ded852a4..42238ba09f4 100644
--- a/sys/netinet/ip_mroute.c
+++ b/sys/netinet/ip_mroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.c,v 1.100 2016/12/21 12:05:01 mpi Exp $ */
+/* $OpenBSD: ip_mroute.c,v 1.101 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: ip_mroute.c,v 1.85 2004/04/26 01:31:57 matt Exp $ */
/*
@@ -53,14 +53,9 @@
* Modified by Pavlin Radoslavov, ICSI, October 2002
*
* MROUTING Revision: 1.2
- * and PIM-SMv2 and PIM-DM support, advanced API support,
- * bandwidth metering and signaling
+ * advanced API support, bandwidth metering and signaling
*/
-#ifdef PIM
-#define _PIM_VT 1
-#endif
-
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/mbuf.h>
@@ -87,11 +82,6 @@
#include <netinet/igmp_var.h>
#include <netinet/ip_mroute.h>
-#ifdef PIM
-#include <netinet/pim.h>
-#include <netinet/pim_var.h>
-#endif
-
#define M_PULLUP(m, len) \
do { \
if ((m) && ((m)->m_flags & M_EXT || (m)->m_len < (len))) \
@@ -147,70 +137,6 @@ int ip_mdq(struct mbuf *, struct ifnet *, struct mfc *);
void phyint_send(struct ip *, struct vif *, struct mbuf *);
void send_packet(struct vif *, struct mbuf *);
-#ifdef PIM
-int pim_register_send(struct ip *, struct vif *,
- struct mbuf *, struct mfc *, unsigned int);
-int pim_register_send_rp(struct ip *, struct vif *,
- struct mbuf *, struct mfc *, unsigned int);
-int pim_register_send_upcall(struct ip *, struct vif *,
- struct mbuf *, struct mfc *, unsigned int);
-struct mbuf *pim_register_prepare(struct ip *, struct mbuf *);
-int set_assert(struct mbuf *);
-int get_assert(struct mbuf *);
-
-struct pimstat pimstat;
-
-/*
- * Note: the PIM Register encapsulation adds the following in front of a
- * data packet:
- *
- * struct pim_encap_hdr {
- * struct ip ip;
- * struct pim_encap_pimhdr pim;
- * }
- *
- */
-struct pim_encap_pimhdr {
- struct pim pim;
- uint32_t flags;
-};
-#define PIM_ENCAP_TTL 64
-
-static struct ip pim_encap_iphdr = {
-#if BYTE_ORDER == LITTLE_ENDIAN
- sizeof(struct ip) >> 2,
- IPVERSION,
-#else
- IPVERSION,
- sizeof(struct ip) >> 2,
-#endif
- 0, /* tos */
- sizeof(struct ip), /* total length */
- 0, /* id */
- 0, /* frag offset */
- PIM_ENCAP_TTL,
- IPPROTO_PIM,
- 0, /* checksum */
-};
-
-static struct pim_encap_pimhdr pim_encap_pimhdr = {
- {
- PIM_MAKE_VT(PIM_VERSION, PIM_REGISTER), /* PIM vers and message type */
- 0, /* reserved */
- 0, /* checksum */
- },
- 0 /* flags */
-};
-
-static struct ifnet multicast_register_if;
-static vifi_t reg_vif_num = VIFI_INVALID;
-
-/*
- * whether or not special PIM assert processing is enabled.
- */
-static int pim_assert;
-#endif /* PIM */
-
static vifi_t numvifs = 0;
/*
@@ -224,7 +150,6 @@ static vifi_t numvifs = 0;
* recorded in `mrt_api_support'.
*/
static const u_int32_t mrt_api_support = (MRT_MFC_FLAGS_DISABLE_WRONGVIF |
- MRT_MFC_FLAGS_BORDER_VIF |
MRT_MFC_RP);
static u_int32_t mrt_api_config = 0;
@@ -309,11 +234,6 @@ ip_mrouter_set(struct socket *so, int optname, struct mbuf **mp)
case MRT_DEL_MFC:
error = del_mfc(so, *mp);
break;
-#ifdef PIM
- case MRT_ASSERT:
- error = set_assert(*mp);
- break;
-#endif
case MRT_API_CONFIG:
error = set_api_config(so, *mp);
break;
@@ -344,11 +264,6 @@ ip_mrouter_get(struct socket *so, int optname, struct mbuf **mp)
case MRT_VERSION:
error = get_version(*mp);
break;
-#ifdef PIM
- case MRT_ASSERT:
- error = get_assert(*mp);
- break;
-#endif
case MRT_API_SUPPORT:
error = get_api_support(*mp);
break;
@@ -651,37 +566,6 @@ get_version(struct mbuf *m)
return (0);
}
-#ifdef PIM
-/*
- * Set PIM assert processing global
- */
-int
-set_assert(struct mbuf *m)
-{
- int *i;
-
- if (m == NULL || m->m_len < sizeof(int))
- return (EINVAL);
-
- i = mtod(m, int *);
- pim_assert = !!*i;
- return (0);
-}
-
-/*
- * Get PIM assert processing global
- */
-int
-get_assert(struct mbuf *m)
-{
- int *i = mtod(m, int *);
-
- *i = pim_assert;
- m->m_len = sizeof(int);
- return (0);
-}
-#endif
-
/*
* Configure API capabilities
*/
@@ -702,19 +586,12 @@ set_api_config(struct socket *so, struct mbuf *m)
* We can set the API capabilities only if it is the first operation
* after MRT_INIT. I.e.:
* - there are no vifs installed
- * - pim_assert is not enabled
* - the MFC table is empty
*/
if (numvifs > 0) {
*apival = 0;
return (EPERM);
}
-#ifdef PIM
- if (pim_assert) {
- *apival = 0;
- return (EPERM);
- }
-#endif
for (i = 0; i < MFCTBLSIZ; i++) {
if (mfchashtbl[rtableid] == NULL)
break;
@@ -799,16 +676,6 @@ add_vif(struct socket *so, struct mbuf *m)
/* Tunnels are no longer supported use gif(4) instead. */
if (vifcp->vifc_flags & VIFF_TUNNEL)
return (EOPNOTSUPP);
-
-#ifdef PIM
- if (vifcp->vifc_flags & VIFF_REGISTER) {
- /*
- * XXX: Because VIFF_REGISTER does not really need a valid
- * local interface (e.g. it could be 127.0.0.2), we don't
- * check its address.
- */
- } else
-#endif
{
inp = sotoinpcb(so);
sin.sin_addr = vifcp->vifc_lcl_addr;
@@ -817,18 +684,6 @@ add_vif(struct socket *so, struct mbuf *m)
return (EADDRNOTAVAIL);
}
-#ifdef PIM
- if (vifcp->vifc_flags & VIFF_REGISTER) {
- ifp = &multicast_register_if;
- if (reg_vif_num == VIFI_INVALID) {
- memset(ifp, 0, sizeof(*ifp));
- snprintf(ifp->if_xname, sizeof ifp->if_xname,
- "register_vif");
- ifp->if_flags = IFF_LOOPBACK;
- reg_vif_num = vifcp->vifc_vifi;
- }
- } else
-#endif
{
/* Use the physical interface associated with the address. */
ifp = ifa->ifa_ifp;
@@ -875,11 +730,6 @@ reset_vif(struct vif *vifp)
struct ifnet *ifp;
struct ifreq ifr;
-#ifdef PIM
- if (vifp->v_flags & VIFF_REGISTER) {
- reg_vif_num = VIFI_INVALID;
- } else
-#endif
{
memset(&ifr, 0, sizeof(ifr));
satosin(&ifr.ifr_addr)->sin_len = sizeof(struct sockaddr_in);
@@ -1465,72 +1315,6 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt)
/* came in the wrong interface */
++mrtstat.mrts_wrong_if;
++rt->mfc_wrong_if;
-#ifdef PIM
- /*
- * If we are doing PIM assert processing, send a message
- * to the routing daemon.
- *
- * XXX: A PIM-SM router needs the WRONGVIF detection so it
- * can complete the SPT switch, regardless of the type
- * of interface (broadcast media, GRE tunnel, etc).
- */
- if (pim_assert && (vifi < numvifs) && viftable[vifi].v_ifp) {
- struct timeval now;
- u_int32_t delta;
-
- if (ifp == &multicast_register_if)
- pimstat.pims_rcv_registers_wrongiif++;
-
- /* Get vifi for the incoming packet */
- for (vifi = 0;
- vifi < numvifs && viftable[vifi].v_ifp != ifp;
- vifi++)
- ;
- if (vifi >= numvifs) {
- /* The iif is not found: ignore the packet. */
- return (0);
- }
-
- if (rt->mfc_flags[vifi] &
- MRT_MFC_FLAGS_DISABLE_WRONGVIF) {
- /* WRONGVIF disabled: ignore the packet */
- return (0);
- }
-
- microtime(&now);
-
- TV_DELTA(rt->mfc_last_assert, now, delta);
-
- if (delta > ASSERT_MSG_TIME) {
- unsigned int rtableid = ifp->if_rdomain;
- struct igmpmsg *im;
- int hlen = ip->ip_hl << 2;
- struct mbuf *mm = m_copym(m, 0, hlen, M_NOWAIT);
-
- M_PULLUP(mm, hlen);
- if (mm == NULL)
- return (ENOBUFS);
-
- rt->mfc_last_assert = now;
-
- im = mtod(mm, struct igmpmsg *);
- im->im_msgtype = IGMPMSG_WRONGVIF;
- im->im_mbz = 0;
- im->im_vif = vifi;
-
- mrtstat.mrts_upcalls++;
-
- sin.sin_addr = im->im_src;
- if (socket_send(ip_mrouter[rtableid], mm,
- &sin) < 0) {
- log(LOG_WARNING, "ip_mforward: "
- "ip_mrouter socket queue full\n");
- ++mrtstat.mrts_upq_sockfull;
- return (ENOBUFS);
- }
- }
- }
-#endif
return (0);
}
@@ -1556,11 +1340,6 @@ ip_mdq(struct mbuf *m, struct ifnet *ifp, struct mfc *rt)
(ip->ip_ttl > rt->mfc_ttls[vifi])) {
vifp->v_pkt_out++;
vifp->v_bytes_out += plen;
-#ifdef PIM
- if (vifp->v_flags & VIFF_REGISTER)
- pim_register_send(ip, vifp, m, rt, rtableid);
- else
-#endif
phyint_send(ip, vifp, m);
}
@@ -1604,441 +1383,3 @@ send_packet(struct vif *vifp, struct mbuf *m)
ip_output(m, NULL, NULL, IP_FORWARDING, &imo, NULL, 0);
splx(s);
}
-
-#ifdef PIM
-/*
- * Send the packet up to the user daemon, or eventually do kernel encapsulation
- */
-int
-pim_register_send(struct ip *ip, struct vif *vifp,
- struct mbuf *m, struct mfc *rt, unsigned int rtableid)
-{
- struct mbuf *mb_copy, *mm;
-
- mb_copy = pim_register_prepare(ip, m);
- if (mb_copy == NULL)
- return (ENOBUFS);
-
- /*
- * Send all the fragments. Note that the mbuf for each fragment
- * is freed by the sending machinery.
- */
- for (mm = mb_copy; mm; mm = mb_copy) {
- mb_copy = mm->m_nextpkt;
- mm->m_nextpkt = NULL;
- mm = m_pullup(mm, sizeof(struct ip));
- if (mm != NULL) {
- ip = mtod(mm, struct ip *);
- if ((mrt_api_config & MRT_MFC_RP) &&
- !in_nullhost(rt->mfc_rp)) {
- pim_register_send_rp(ip, vifp, mm, rt,
- rtableid);
- } else {
- pim_register_send_upcall(ip, vifp, mm, rt,
- rtableid);
- }
- }
- }
-
- return (0);
-}
-
-/*
- * Return a copy of the data packet that is ready for PIM Register
- * encapsulation.
- * XXX: Note that in the returned copy the IP header is a valid one.
- */
-struct mbuf *
-pim_register_prepare(struct ip *ip, struct mbuf *m)
-{
- struct mbuf *mb_copy = NULL;
- int mtu;
-
- in_proto_cksum_out(m, NULL);
-
- /*
- * Copy the old packet & pullup its IP header into the
- * new mbuf so we can modify it.
- */
- mb_copy = m_copym(m, 0, M_COPYALL, M_NOWAIT);
- if (mb_copy == NULL)
- return (NULL);
- mb_copy = m_pullup(mb_copy, ip->ip_hl << 2);
- if (mb_copy == NULL)
- return (NULL);
-
- /* take care of the TTL */
- ip = mtod(mb_copy, struct ip *);
- --ip->ip_ttl;
-
- /* Compute the MTU after the PIM Register encapsulation */
- mtu = 0xffff - sizeof(pim_encap_iphdr) - sizeof(pim_encap_pimhdr);
-
- if (ntohs(ip->ip_len) <= mtu) {
- /* Turn the IP header into a valid one */
- ip->ip_sum = 0;
- ip->ip_sum = in_cksum(mb_copy, ip->ip_hl << 2);
- } else {
- /* Fragment the packet */
- if (ip_fragment(mb_copy, NULL, mtu) != 0) {
- /* XXX: mb_copy was freed by ip_fragment() */
- return (NULL);
- }
- }
- return (mb_copy);
-}
-
-/*
- * Send an upcall with the data packet to the user-level process.
- */
-int
-pim_register_send_upcall(struct ip *ip, struct vif *vifp,
- struct mbuf *mb_copy, struct mfc *rt, unsigned int rtableid)
-{
- struct mbuf *mb_first;
- int len = ntohs(ip->ip_len);
- struct igmpmsg *im;
- struct sockaddr_in k_igmpsrc = { sizeof k_igmpsrc, AF_INET };
-
- /* Add a new mbuf with an upcall header */
- MGETHDR(mb_first, M_DONTWAIT, MT_HEADER);
- if (mb_first == NULL) {
- m_freem(mb_copy);
- return (ENOBUFS);
- }
- mb_first->m_data += max_linkhdr;
- mb_first->m_pkthdr.len = len + sizeof(struct igmpmsg);
- mb_first->m_len = sizeof(struct igmpmsg);
- mb_first->m_next = mb_copy;
-
- /* Send message to routing daemon */
- im = mtod(mb_first, struct igmpmsg *);
- im->im_msgtype = IGMPMSG_WHOLEPKT;
- im->im_mbz = 0;
- im->im_vif = vifp - viftable;
- im->im_src = ip->ip_src;
- im->im_dst = ip->ip_dst;
-
- k_igmpsrc.sin_addr = ip->ip_src;
-
- mrtstat.mrts_upcalls++;
-
- if (socket_send(ip_mrouter[rtableid], mb_first, &k_igmpsrc) < 0) {
- ++mrtstat.mrts_upq_sockfull;
- return (ENOBUFS);
- }
-
- /* Keep statistics */
- pimstat.pims_snd_registers_msgs++;
- pimstat.pims_snd_registers_bytes += len;
-
- return (0);
-}
-
-/*
- * Encapsulate the data packet in PIM Register message and send it to the RP.
- */
-int
-pim_register_send_rp(struct ip *ip, struct vif *vifp,
- struct mbuf *mb_copy, struct mfc *rt, unsigned int rtableid)
-{
- struct mbuf *mb_first;
- struct ip *ip_outer;
- struct pim_encap_pimhdr *pimhdr;
- int len = ntohs(ip->ip_len);
- vifi_t vifi = rt->mfc_parent;
-
- if ((vifi >= numvifs) || in_nullhost(viftable[vifi].v_lcl_addr)) {
- m_freem(mb_copy);
- return (EADDRNOTAVAIL); /* The iif vif is invalid */
- }
-
- /* Add a new mbuf with the encapsulating header */
- MGETHDR(mb_first, M_DONTWAIT, MT_HEADER);
- if (mb_first == NULL) {
- m_freem(mb_copy);
- return (ENOBUFS);
- }
- mb_first->m_data += max_linkhdr;
- mb_first->m_len = sizeof(pim_encap_iphdr) + sizeof(pim_encap_pimhdr);
- mb_first->m_next = mb_copy;
-
- mb_first->m_pkthdr.len = len + mb_first->m_len;
-
- /* Fill in the encapsulating IP and PIM header */
- ip_outer = mtod(mb_first, struct ip *);
- *ip_outer = pim_encap_iphdr;
- ip_outer->ip_id = htons(ip_randomid());
- ip_outer->ip_len = htons(len + sizeof(pim_encap_iphdr) +
- sizeof(pim_encap_pimhdr));
- ip_outer->ip_src = viftable[vifi].v_lcl_addr;
- ip_outer->ip_dst = rt->mfc_rp;
- /*
- * Copy the inner header TOS to the outer header, and take care of the
- * IP_DF bit.
- */
- ip_outer->ip_tos = ip->ip_tos;
- if (ntohs(ip->ip_off) & IP_DF)
- ip_outer->ip_off |= htons(IP_DF);
- pimhdr = (struct pim_encap_pimhdr *)((caddr_t)ip_outer
- + sizeof(pim_encap_iphdr));
- *pimhdr = pim_encap_pimhdr;
- /* If the iif crosses a border, set the Border-bit */
- if (rt->mfc_flags[vifi] & MRT_MFC_FLAGS_BORDER_VIF & mrt_api_config)
- pimhdr->flags |= htonl(PIM_BORDER_REGISTER);
-
- mb_first->m_data += sizeof(pim_encap_iphdr);
- pimhdr->pim.pim_cksum = in_cksum(mb_first, sizeof(pim_encap_pimhdr));
- mb_first->m_data -= sizeof(pim_encap_iphdr);
-
- send_packet(vifp, mb_first);
-
- /* Keep statistics */
- pimstat.pims_snd_registers_msgs++;
- pimstat.pims_snd_registers_bytes += len;
-
- return (0);
-}
-
-/*
- * PIM-SMv2 and PIM-DM messages processing.
- * Receives and verifies the PIM control messages, and passes them
- * up to the listening socket, using rip_input().
- * The only message with special processing is the PIM_REGISTER message
- * (used by PIM-SM): the PIM header is stripped off, and the inner packet
- * is passed to if_simloop().
- */
-void
-pim_input(struct mbuf *m, ...)
-{
- struct ip *ip = mtod(m, struct ip *);
- struct pim *pim;
- int minlen;
- int datalen;
- int ip_tos;
- int iphlen;
- va_list ap;
-
- va_start(ap, m);
- iphlen = va_arg(ap, int);
- va_end(ap);
-
- datalen = ntohs(ip->ip_len) - iphlen;
-
- /* Keep statistics */
- pimstat.pims_rcv_total_msgs++;
- pimstat.pims_rcv_total_bytes += datalen;
-
- /* Validate lengths */
- if (datalen < PIM_MINLEN) {
- pimstat.pims_rcv_tooshort++;
- log(LOG_ERR, "pim_input: packet size too small %d from %lx\n",
- datalen, (u_long)ip->ip_src.s_addr);
- m_freem(m);
- return;
- }
-
- /*
- * If the packet is at least as big as a REGISTER, go agead
- * and grab the PIM REGISTER header size, to avoid another
- * possible m_pullup() later.
- *
- * PIM_MINLEN == pimhdr + u_int32_t == 4 + 4 = 8
- * PIM_REG_MINLEN == pimhdr + reghdr + encap_iphdr == 4 + 4 + 20 = 28
- */
- minlen = iphlen + (datalen >= PIM_REG_MINLEN ?
- PIM_REG_MINLEN : PIM_MINLEN);
- /*
- * Get the IP and PIM headers in contiguous memory, and
- * possibly the PIM REGISTER header.
- */
- if ((m->m_flags & M_EXT || m->m_len < minlen) &&
- (m = m_pullup(m, minlen)) == NULL) {
- log(LOG_ERR, "pim_input: m_pullup failure\n");
- return;
- }
- /* m_pullup() may have given us a new mbuf so reset ip. */
- ip = mtod(m, struct ip *);
- ip_tos = ip->ip_tos;
-
- /* adjust mbuf to point to the PIM header */
- m->m_data += iphlen;
- m->m_len -= iphlen;
- pim = mtod(m, struct pim *);
-
- /*
- * Validate checksum. If PIM REGISTER, exclude the data packet.
- *
- * XXX: some older PIMv2 implementations don't make this distinction,
- * so for compatibility reason perform the checksum over part of the
- * message, and if error, then over the whole message.
- */
- if (PIM_VT_T(pim->pim_vt) == PIM_REGISTER &&
- in_cksum(m, PIM_MINLEN) == 0) {
- /* do nothing, checksum okay */
- } else if (in_cksum(m, datalen)) {
- pimstat.pims_rcv_badsum++;
- m_freem(m);
- return;
- }
-
- /* PIM version check */
- if (PIM_VT_V(pim->pim_vt) < PIM_VERSION) {
- pimstat.pims_rcv_badversion++;
- log(LOG_ERR, "pim_input: incorrect version %d, expecting %d\n",
- PIM_VT_V(pim->pim_vt), PIM_VERSION);
- m_freem(m);
- return;
- }
-
- /* restore mbuf back to the outer IP */
- m->m_data -= iphlen;
- m->m_len += iphlen;
-
- if (PIM_VT_T(pim->pim_vt) == PIM_REGISTER) {
- /*
- * Since this is a REGISTER, we'll make a copy of the register
- * headers ip + pim + u_int32 + encap_ip, to be passed up to the
- * routing daemon.
- */
- int s;
- struct sockaddr_in dst = { sizeof(dst), AF_INET };
- struct mbuf *mcp;
- struct ip *encap_ip;
- u_int32_t *reghdr;
- struct ifnet *vifp;
-
- s = splsoftnet();
- if ((reg_vif_num >= numvifs) || (reg_vif_num == VIFI_INVALID)) {
- splx(s);
- m_freem(m);
- return;
- }
- /* XXX need refcnt? */
- vifp = viftable[reg_vif_num].v_ifp;
- splx(s);
-
- /* Validate length */
- if (datalen < PIM_REG_MINLEN) {
- pimstat.pims_rcv_tooshort++;
- pimstat.pims_rcv_badregisters++;
- log(LOG_ERR, "pim_input: register packet size "
- "too small %d from %lx\n",
- datalen, (u_long)ip->ip_src.s_addr);
- m_freem(m);
- return;
- }
-
- reghdr = (u_int32_t *)(pim + 1);
- encap_ip = (struct ip *)(reghdr + 1);
-
- /* verify the version number of the inner packet */
- if (encap_ip->ip_v != IPVERSION) {
- pimstat.pims_rcv_badregisters++;
- m_freem(m);
- return;
- }
-
- /* verify the inner packet is destined to a mcast group */
- if (!IN_MULTICAST(encap_ip->ip_dst.s_addr)) {
- pimstat.pims_rcv_badregisters++;
- m_freem(m);
- return;
- }
-
- /* If a NULL_REGISTER, pass it to the daemon */
- if ((ntohl(*reghdr) & PIM_NULL_REGISTER))
- goto pim_input_to_daemon;
-
- /*
- * Copy the TOS from the outer IP header to the inner
- * IP header.
- */
- if (encap_ip->ip_tos != ip_tos) {
- /* Outer TOS -> inner TOS */
- encap_ip->ip_tos = ip_tos;
- /* Recompute the inner header checksum. Sigh... */
-
- /* adjust mbuf to point to the inner IP header */
- m->m_data += (iphlen + PIM_MINLEN);
- m->m_len -= (iphlen + PIM_MINLEN);
-
- encap_ip->ip_sum = 0;
- encap_ip->ip_sum = in_cksum(m, encap_ip->ip_hl << 2);
-
- /* restore mbuf to point back to the outer IP header */
- m->m_data -= (iphlen + PIM_MINLEN);
- m->m_len += (iphlen + PIM_MINLEN);
- }
-
- /*
- * Decapsulate the inner IP packet and loopback to forward it
- * as a normal multicast packet. Also, make a copy of the
- * outer_iphdr + pimhdr + reghdr + encap_iphdr
- * to pass to the daemon later, so it can take the appropriate
- * actions (e.g., send back PIM_REGISTER_STOP).
- * XXX: here m->m_data points to the outer IP header.
- */
- mcp = m_copym(m, 0, iphlen + PIM_REG_MINLEN, M_NOWAIT);
- if (mcp == NULL) {
- log(LOG_ERR, "pim_input: pim register: could not "
- "copy register head\n");
- m_freem(m);
- return;
- }
-
- /* Keep statistics */
- /* XXX: registers_bytes include only the encap. mcast pkt */
- pimstat.pims_rcv_registers_msgs++;
- pimstat.pims_rcv_registers_bytes += ntohs(encap_ip->ip_len);
-
- /* forward the inner ip packet; point m_data at the inner ip. */
- m_adj(m, iphlen + PIM_MINLEN);
-
- /* NB: vifp was collected above; can it change on us? */
- if_input_local(vifp, m, dst.sin_family);
-
- /* prepare the register head to send to the mrouting daemon */
- m = mcp;
- }
-
-pim_input_to_daemon:
- /*
- * Pass the PIM message up to the daemon; if it is a Register message,
- * pass the 'head' only up to the daemon. This includes the
- * outer IP header, PIM header, PIM-Register header and the
- * inner IP header.
- * XXX: the outer IP header pkt size of a Register is not adjust to
- * reflect the fact that the inner multicast data is truncated.
- */
- rip_input(m);
-
- return;
-}
-
-/*
- * Sysctl for pim variables.
- */
-int
-pim_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen)
-{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return (ENOTDIR);
-
- switch (name[0]) {
- case PIMCTL_STATS:
- if (newp != NULL)
- return (EPERM);
- return (sysctl_struct(oldp, oldlenp, newp, newlen,
- &pimstat, sizeof(pimstat)));
-
- default:
- return (ENOPROTOOPT);
- }
- /* NOTREACHED */
-}
-
-
-#endif /* PIM */
diff --git a/sys/netinet/ip_mroute.h b/sys/netinet/ip_mroute.h
index 40af4fc153d..b3a73ea42ca 100644
--- a/sys/netinet/ip_mroute.h
+++ b/sys/netinet/ip_mroute.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_mroute.h,v 1.23 2016/12/20 09:33:13 rzalamena Exp $ */
+/* $OpenBSD: ip_mroute.h,v 1.24 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: ip_mroute.h,v 1.23 2004/04/21 17:49:46 itojun Exp $ */
#ifndef _NETINET_IP_MROUTE_H_
@@ -15,8 +15,7 @@
* Modified by Pavlin Radoslavov, ICSI, October 2002.
*
* MROUTING Revision: 1.2
- * and PIM-SMv2 and PIM-DM support, advanced API support,
- * bandwidth metering and signaling.
+ * advanced API support, bandwidth metering and signaling.
*/
#include <sys/queue.h>
@@ -33,7 +32,6 @@
#define MRT_DEL_MFC 105 /* delete forwarding cache entry */
#define MRT_VERSION 106 /* get kernel version number */
#define MRT_ASSERT 107 /* enable assert processing */
-#define MRT_PIM MRT_ASSERT /* enable PIM processing */
#define MRT_API_SUPPORT 109 /* supported MRT API */
#define MRT_API_CONFIG 110 /* config MRT API */
@@ -55,7 +53,6 @@ typedef u_int16_t vifi_t; /* type of a vif index */
#define VIFF_TUNNEL 0x1 /* vif represents a tunnel end-point */
#define VIFF_SRCRT 0x2 /* tunnel uses IP src routing */
-#define VIFF_REGISTER 0x4 /* used for PIM Register encap/decap */
/*
* Argument structure for MRT_ADD_VIF.
@@ -103,11 +100,9 @@ struct mfcctl2 {
* for the mfcc_flags field.
*/
#define MRT_MFC_FLAGS_DISABLE_WRONGVIF (1 << 0) /* disable WRONGVIF signals */
-#define MRT_MFC_FLAGS_BORDER_VIF (1 << 1) /* border vif */
#define MRT_MFC_RP (1 << 8) /* enable RP address */
#define MRT_MFC_BW_UPCALL (1 << 9) /* enable bw upcalls */
-#define MRT_MFC_FLAGS_ALL (MRT_MFC_FLAGS_DISABLE_WRONGVIF | \
- MRT_MFC_FLAGS_BORDER_VIF)
+#define MRT_MFC_FLAGS_ALL (MRT_MFC_FLAGS_DISABLE_WRONGVIF)
#define MRT_API_FLAGS_ALL (MRT_MFC_FLAGS_ALL | \
MRT_MFC_RP | \
MRT_MFC_BW_UPCALL)
@@ -283,7 +278,6 @@ struct igmpmsg {
u_int8_t im_msgtype; /* what type of message */
#define IGMPMSG_NOCACHE 1 /* no MFC in the kernel */
#define IGMPMSG_WRONGVIF 2 /* packet came from wrong interface */
-#define IGMPMSG_WHOLEPKT 3 /* PIM pkt for user level encap. */
#define IGMPMSG_BW_UPCALL 4 /* BW monitoring upcall */
u_int8_t im_mbz; /* must be zero */
u_int8_t im_vif; /* vif rec'd on */
diff --git a/sys/netinet/pim.h b/sys/netinet/pim.h
deleted file mode 100644
index df5c1dca3ec..00000000000
--- a/sys/netinet/pim.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* $OpenBSD: pim.h,v 1.2 2006/04/27 02:19:32 tedu Exp $ */
-/* $NetBSD: pim.h,v 1.1 2004/09/04 23:32:29 manu Exp $ */
-
-/*
- * Copyright (c) 1996-2000
- * University of Southern California/Information Sciences Institute.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: /repoman/r/ncvs/src/sys/netinet/pim.h,v 1.2 2004/03/08 07:45:32 hsu Exp $
- */
-
-#ifndef _NETINET_PIM_H_
-#define _NETINET_PIM_H_
-
-/*
- * Protocol Independent Multicast (PIM) definitions.
- * RFC 2362, June 1998.
- *
- * Written by Ahmed Helmy, USC/SGI, July 1996.
- * Modified by George Edmond Eddy (Rusty), ISI, February 1998.
- * Modified by Pavlin Radoslavov, USC/ISI, May 1998, October 2000.
- */
-
-#include <sys/types.h>
-
-#ifndef _PIM_VT
-#ifndef _BYTE_ORDER
-# error _BYTE_ORDER is not defined!
-#endif
-#if (_BYTE_ORDER != _BIG_ENDIAN) && (_BYTE_ORDER != _LITTLE_ENDIAN)
-# error _BYTE_ORDER must be defined to either _BIG_ENDIAN or _LITTLE_ENDIAN
-#endif
-#endif /* ! _PIM_VT */
-
-/*
- * PIM packet header
- */
-struct pim {
-#ifdef _PIM_VT
- uint8_t pim_vt; /* PIM version and message type */
-#else /* ! _PIM_VT */
-#if _BYTE_ORDER == _BIG_ENDIAN
- u_int pim_vers:4, /* PIM protocol version */
- pim_type:4; /* PIM message type */
-#endif
-#if _BYTE_ORDER == _LITTLE_ENDIAN
- u_int pim_type:4, /* PIM message type */
- pim_vers:4; /* PIM protocol version */
-#endif
-#endif /* ! _PIM_VT */
- uint8_t pim_reserved; /* Reserved */
- uint16_t pim_cksum; /* IP-style checksum */
-};
-/* KAME-related name backward compatibility */
-#define pim_ver pim_vers
-#define pim_rsv pim_reserved
-
-#ifdef _PIM_VT
-#define PIM_MAKE_VT(v, t) (0xff & (((v) << 4) | (0x0f & (t))))
-#define PIM_VT_V(x) (((x) >> 4) & 0x0f)
-#define PIM_VT_T(x) ((x) & 0x0f)
-#endif /* _PIM_VT */
-
-#define PIM_VERSION 2
-#define PIM_MINLEN 8 /* PIM message min. length */
-#define PIM_REG_MINLEN (PIM_MINLEN+20) /* PIM Register hdr + inner IPv4 hdr */
-#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* PIM Register hdr + inner IPv6 hdr */
-
-/*
- * PIM message types
- */
-#define PIM_HELLO 0x0 /* PIM-SM and PIM-DM */
-#define PIM_REGISTER 0x1 /* PIM-SM only */
-#define PIM_REGISTER_STOP 0x2 /* PIM-SM only */
-#define PIM_JOIN_PRUNE 0x3 /* PIM-SM and PIM-DM */
-#define PIM_BOOTSTRAP 0x4 /* PIM-SM only */
-#define PIM_ASSERT 0x5 /* PIM-SM and PIM-DM */
-#define PIM_GRAFT 0x6 /* PIM-DM only */
-#define PIM_GRAFT_ACK 0x7 /* PIM-DM only */
-#define PIM_CAND_RP_ADV 0x8 /* PIM-SM only */
-#define PIM_ALL_DF_ELECTION 0xa /* Bidir-PIM-SM only */
-
-/*
- * PIM-Register message flags
- */
-#define PIM_BORDER_REGISTER 0x80000000U /* The Border bit (host-order) */
-#define PIM_NULL_REGISTER 0x40000000U /* The Null-Register bit (host-order)*/
-
-/*
- * All-PIM-Routers IPv4 and IPv6 multicast addresses
- */
-#define INADDR_ALLPIM_ROUTERS_GROUP (uint32_t)0xe000000dU /* 224.0.0.13 */
-#define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS "ff02::d"
-#define IN6ADDR_LINKLOCAL_ALLPIM_ROUTERS_INIT \
- {{{ 0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d }}}
-
-#endif /* _NETINET_PIM_H_ */
diff --git a/sys/netinet/pim_var.h b/sys/netinet/pim_var.h
deleted file mode 100644
index bddc04a1ff6..00000000000
--- a/sys/netinet/pim_var.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* $OpenBSD: pim_var.h,v 1.3 2007/12/14 18:33:41 deraadt Exp $ */
-/* $NetBSD: pim_var.h,v 1.1 2004/09/04 23:32:29 manu Exp $ */
-
-/*
- * Copyright (c) 1998-2000
- * University of Southern California/Information Sciences Institute.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: /repoman/r/ncvs/src/sys/netinet/pim_var.h,v 1.1 2003/08/07 18:17:43 hsu Exp $
- */
-
-#ifndef _NETINET_PIM_VAR_H_
-#define _NETINET_PIM_VAR_H_
-
-/*
- * Protocol Independent Multicast (PIM),
- * kernel variables and implementation-specific definitions.
- *
- * Written by George Edmond Eddy (Rusty), ISI, February 1998.
- * Modified by Pavlin Radoslavov, USC/ISI, May 1998, Aug 1999, October 2000.
- * Modified by Hitoshi Asaeda, WIDE, August 1998.
- */
-
-/*
- * PIM statistics kept in the kernel
- */
-struct pimstat {
- u_int64_t pims_rcv_total_msgs; /* total PIM messages received */
- u_int64_t pims_rcv_total_bytes; /* total PIM bytes received */
- u_int64_t pims_rcv_tooshort; /* rcvd with too few bytes */
- u_int64_t pims_rcv_badsum; /* rcvd with bad checksum */
- u_int64_t pims_rcv_badversion; /* rcvd bad PIM version */
- u_int64_t pims_rcv_registers_msgs; /* rcvd regs. msgs (data only) */
- u_int64_t pims_rcv_registers_bytes; /* rcvd regs. bytes (data only) */
- u_int64_t pims_rcv_registers_wrongiif; /* rcvd regs. on wrong iif */
- u_int64_t pims_rcv_badregisters; /* rcvd invalid registers */
- u_int64_t pims_snd_registers_msgs; /* sent regs. msgs (data only) */
- u_int64_t pims_snd_registers_bytes; /* sent regs. bytes (data only) */
-};
-
-/*
- * Names for PIM sysctl objects
- */
-#define PIMCTL_STATS 1 /* statistics (read-only) */
-#define PIMCTL_MAXID 2
-
-#define PIMCTL_NAMES { \
- { 0, 0 }, \
- { "stats", CTLTYPE_STRUCT }, \
-}
-
-#ifdef _KERNEL
-extern struct pimstat pimstat;
-
-void pim_input(struct mbuf *, ...);
-int pim_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-#endif
-
-#endif /* _NETINET_PIM_VAR_H_ */
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 524e836c43e..1a1278b7870 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6.h,v 1.91 2016/10/03 12:33:21 mpi Exp $ */
+/* $OpenBSD: in6.h,v 1.92 2016/12/22 11:04:44 rzalamena Exp $ */
/* $KAME: in6.h,v 1.83 2001/03/29 02:55:07 jinmei Exp $ */
/*
@@ -511,7 +511,7 @@ ifatoia6(struct ifaddr *ifa)
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
- { "pim6", CTLTYPE_NODE }, \
+ { 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
{ 0, 0 }, \
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index 8e78a604bb5..30fabede281 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_proto.c,v 1.86 2016/06/01 11:11:44 jca Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.87 2016/12/22 11:04:44 rzalamena Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@@ -91,10 +91,6 @@
#include <netinet/ip_esp.h>
#include <netinet/ip_ipip.h>
-#ifdef PIM
-#include <netinet6/pim6_var.h>
-#endif
-
#include <netinet6/in6_var.h>
#include <netinet6/nd6.h>
#include <netinet6/ip6protosw.h>
@@ -218,13 +214,6 @@ struct ip6protosw inet6sw[] = {
0, 0, 0, 0,
},
#endif /* GIF */
-#ifdef PIM
-{ SOCK_RAW, &inet6domain, IPPROTO_PIM, PR_ATOMIC|PR_ADDR,
- pim6_input, rip6_output, 0, rip6_ctloutput,
- rip6_usrreq,
- 0, 0, 0, 0, pim6_sysctl
-},
-#endif /* PIM */
#if NCARP > 0
{ SOCK_RAW, &inet6domain, IPPROTO_CARP, PR_ATOMIC|PR_ADDR,
carp6_proto_input, rip6_output, 0, rip6_ctloutput,
diff --git a/sys/netinet6/ip6_mroute.c b/sys/netinet6/ip6_mroute.c
index e988aed79f5..ee60d887074 100644
--- a/sys/netinet6/ip6_mroute.c
+++ b/sys/netinet6/ip6_mroute.c
@@ -77,7 +77,7 @@
* Modified by Ajit Thyagarajan, PARC, August 1993
* Modified by Bill Fenner, PARC, April 1994
*
- * MROUTING Revision: 3.5.1.2 + PIM-SMv2 (pimd) Support
+ * MROUTING Revision: 3.5.1.2
*/
#include <sys/param.h>
@@ -105,16 +105,6 @@
#include <netinet6/ip6_var.h>
#include <netinet6/ip6_mroute.h>
-#ifdef PIM
-#include <netinet/pim.h>
-#include <netinet6/pim6_var.h>
-
-int set_pim6(int *);
-int get_pim6(struct mbuf *);
-int socket6_send(struct socket *, struct mbuf *, struct sockaddr_in6 *);
-int register_send(struct ip6_hdr *, struct mif6 *, struct mbuf *);
-#endif
-
int ip6_mdq(struct mbuf *, struct ifnet *, struct mf6c *);
void phyint_send6(struct ip6_hdr *, struct mif6 *, struct mbuf *);
@@ -124,7 +114,7 @@ void phyint_send6(struct ip6_hdr *, struct mif6 *, struct mbuf *);
*/
struct socket *ip6_mrouter = NULL;
int ip6_mrouter_ver = 0;
-int ip6_mrtproto = IPPROTO_PIM; /* for netstat only */
+int ip6_mrtproto; /* for netstat only */
struct mrt6stat mrt6stat;
#define NO_RTE_FOUND 0x1
@@ -151,11 +141,6 @@ static mifi_t nummifs = 0;
static mifi_t reg_mif_num = (mifi_t)-1;
unsigned int reg_mif_idx;
-#ifdef PIM
-struct pim6stat pim6stat;
-static int pim6;
-#endif
-
/*
* Hash function for a source, group entry
*/
@@ -251,12 +236,6 @@ ip6_mrouter_set(int cmd, struct socket *so, struct mbuf *m)
if (m == NULL || m->m_len < sizeof(struct mf6cctl))
return (EINVAL);
return (del_m6fc(mtod(m, struct mf6cctl *)));
-#ifdef PIM
- case MRT6_PIM:
- if (m == NULL || m->m_len < sizeof(int))
- return (EINVAL);
- return (set_pim6(mtod(m, int *)));
-#endif
default:
return (EOPNOTSUPP);
}
@@ -274,10 +253,6 @@ ip6_mrouter_get(int cmd, struct socket *so, struct mbuf **mp)
*mp = m_get(M_WAIT, MT_SOOPTS);
switch (cmd) {
-#ifdef PIM
- case MRT6_PIM:
- return get_pim6(*mp);
-#endif
default:
return EOPNOTSUPP;
}
@@ -439,34 +414,6 @@ mrt6_sysctl_mfc(void *oldp, size_t *oldlenp)
return (0);
}
-#ifdef PIM
-/*
- * Get PIM processiong global
- */
-int
-get_pim6(struct mbuf *m)
-{
- int *i;
-
- i = mtod(m, int *);
-
- *i = pim6;
-
- return 0;
-}
-
-int
-set_pim6(int *i)
-{
- if ((*i != 1) && (*i != 0))
- return EINVAL;
-
- pim6 = *i;
-
- return 0;
-}
-#endif
-
/*
* Enable multicast routing
*/
@@ -490,10 +437,6 @@ ip6_mrouter_init(struct socket *so, int v, int cmd)
arc4random_buf(&mf6chashkey, sizeof(mf6chashkey));
bzero((caddr_t)n6expire, sizeof(n6expire));
-#ifdef PIM
- pim6 = 0;/* used for stubbing out/in pim stuff */
-#endif
-
timeout_set(&expire_upcalls6_ch, expire_upcalls6, NULL);
timeout_add(&expire_upcalls6_ch, EXPIRE_TIMEOUT);
@@ -544,10 +487,6 @@ ip6_mrouter_done(void)
bzero((caddr_t)mif6table, sizeof(mif6table));
nummifs = 0;
-#ifdef PIM
- pim6 = 0; /* used to stub out/in pim specific code */
-#endif
-
timeout_del(&expire_upcalls6_ch);
/*
@@ -629,27 +568,6 @@ add_m6if(struct mif6ctl *mifcp)
if (mifp->m6_ifp)
return EADDRINUSE; /* XXX: is it appropriate? */
-#ifdef PIM
- if (mifcp->mif6c_flags & MIFF_REGISTER) {
- if (reg_mif_num == (mifi_t)-1) {
- ifp = malloc(sizeof(*ifp), M_DEVBUF, M_NOWAIT|M_ZERO);
- if (ifp == NULL)
- return (ENOMEM);
- snprintf(ifp->if_xname, sizeof(ifp->if_xname),
- "register_mif");
- ifp->if_flags |= IFF_LOOPBACK;
- if_attach(ifp);
- if_alloc_sadl(ifp);
-
- reg_mif_num = mifcp->mif6c_mifi;
- reg_mif_idx = ifp->if_index;
- mifcp->mif6c_pifi = ifp->if_index;
- }
-
- ifp = if_get(reg_mif_idx);
- KASSERT(ifp != NULL);
- } else
-#endif
{
ifp = if_get(mifcp->mif6c_pifi);
if (ifp == NULL)
@@ -1241,73 +1159,6 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
/* came in the wrong interface */
mrt6stat.mrt6s_wrong_if++;
rt->mf6c_wrong_if++;
-#ifdef PIM
- /*
- * If we are doing PIM processing, and we are forwarding
- * packets on this interface, send a message to the
- * routing daemon.
- */
- /* have to make sure this is a valid mif */
- if (mifi < nummifs && mif6table[mifi].m6_ifp) {
- mifi_t iif;
-
- if (pim6 && (m->m_flags & M_LOOP) == 0) {
- /*
- * Check the M_LOOP flag to avoid an
- * unnecessary PIM assert.
- * XXX: M_LOOP is an ad-hoc hack...
- */
- struct sockaddr_in6 sin6;
-
- struct mbuf *mm;
- struct mrt6msg *im;
-
- mm = m_copym(m, 0, sizeof(struct ip6_hdr),
- M_NOWAIT);
- if (mm &&
- (M_READONLY(mm) ||
- mm->m_len < sizeof(struct ip6_hdr)))
- mm = m_pullup(mm, sizeof(struct ip6_hdr));
- if (mm == NULL)
- return ENOBUFS;
-
- im = NULL;
- switch (ip6_mrouter_ver) {
- case MRT6_INIT:
- im = mtod(mm, struct mrt6msg *);
- im->im6_msgtype = MRT6MSG_WRONGMIF;
- im->im6_mbz = 0;
- break;
- default:
- m_freem(mm);
- return EINVAL;
- }
-
- for (mifp = mif6table, iif = 0;
- iif < nummifs && mifp &&
- mifp->m6_ifp != ifp;
- mifp++, iif++)
- ;
-
- (void)memset(&sin6, 0, sizeof(sin6));
- sin6.sin6_len = sizeof(sin6);
- sin6.sin6_family = AF_INET6;
- switch (ip6_mrouter_ver) {
- case MRT6_INIT:
- im->im6_mif = iif;
- sin6.sin6_addr = im->im6_src;
- break;
- }
-
- mrt6stat.mrt6s_upcalls++;
-
- if (socket6_send(ip6_mrouter, mm, &sin6) < 0) {
- ++mrt6stat.mrt6s_upq_sockfull;
- return ENOBUFS;
- }
- }
- }
-#endif /* PIM */
return 0;
} /* if wrong iif */
@@ -1335,8 +1186,6 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
/*
* check if the outgoing packet is going to break
* a scope boundary.
- * XXX For packets through PIM register tunnel
- * interface, we believe a routing daemon.
*/
if ((mif6table[rt->mf6c_parent].m6_flags &
MIFF_REGISTER) == 0 &&
@@ -1353,11 +1202,6 @@ ip6_mdq(struct mbuf *m, struct ifnet *ifp, struct mf6c *rt)
mifp->m6_pkt_out++;
mifp->m6_bytes_out += plen;
-#ifdef PIM
- if (mifp->m6_flags & MIFF_REGISTER)
- register_send(ip6, mifp, m);
- else
-#endif
phyint_send6(ip6, mifp, m);
}
}
@@ -1443,246 +1287,6 @@ phyint_send6(struct ip6_hdr *ip6, struct mif6 *mifp, struct mbuf *m)
splx(s);
}
-#ifdef PIM
-int
-register_send(struct ip6_hdr *ip6, struct mif6 *mif, struct mbuf *m)
-{
- struct mbuf *mm;
- int i, len = m->m_pkthdr.len;
- struct sockaddr_in6 sin6;
- struct mrt6msg *im6;
-
- ++pim6stat.pim6s_snd_registers;
-
- /* Make a copy of the packet to send to the user level process */
- MGETHDR(mm, M_DONTWAIT, MT_HEADER);
- if (mm == NULL)
- return ENOBUFS;
- mm->m_data += max_linkhdr;
- mm->m_len = sizeof(struct ip6_hdr);
-
- if ((mm->m_next = m_copym(m, 0, M_COPYALL, M_NOWAIT)) == NULL) {
- m_freem(mm);
- return ENOBUFS;
- }
- i = MHLEN - M_LEADINGSPACE(mm);
- if (i > len)
- i = len;
- mm = m_pullup(mm, i);
- if (mm == NULL)
- return ENOBUFS;
-/* TODO: check it! */
- mm->m_pkthdr.len = len + sizeof(struct ip6_hdr);
-
- /*
- * Send message to routing daemon
- */
- (void)memset(&sin6, 0, sizeof(sin6));
- sin6.sin6_len = sizeof(sin6);
- sin6.sin6_family = AF_INET6;
- sin6.sin6_addr = ip6->ip6_src;
-
- im6 = mtod(mm, struct mrt6msg *);
- im6->im6_msgtype = MRT6MSG_WHOLEPKT;
- im6->im6_mbz = 0;
-
- im6->im6_mif = mif - mif6table;
-
- /* iif info is not given for reg. encap.n */
- mrt6stat.mrt6s_upcalls++;
-
- if (socket6_send(ip6_mrouter, mm, &sin6) < 0) {
- ++mrt6stat.mrt6s_upq_sockfull;
- return ENOBUFS;
- }
- return 0;
-}
-
-/*
- * PIM sparse mode hook
- * Receives the pim control messages, and passes them up to the listening
- * socket, using rip6_input.
- * The only message processed is the REGISTER pim message; the pim header
- * is stripped off, and the inner packet is passed to register_mforward.
- */
-int
-pim6_input(struct mbuf **mp, int *offp, int proto)
-{
- struct pim *pim; /* pointer to a pim struct */
- struct ip6_hdr *ip6;
- int pimlen;
- struct mbuf *m = *mp;
- int minlen;
- int off = *offp;
-
- ++pim6stat.pim6s_rcv_total;
-
- ip6 = mtod(m, struct ip6_hdr *);
- pimlen = m->m_pkthdr.len - *offp;
-
- /*
- * Validate lengths
- */
- if (pimlen < PIM_MINLEN) {
- ++pim6stat.pim6s_rcv_tooshort;
- m_freem(m);
- return (IPPROTO_DONE);
- }
-
- /*
- * if the packet is at least as big as a REGISTER, go ahead
- * and grab the PIM REGISTER header size, to avoid another
- * possible m_pullup() later.
- *
- * PIM_MINLEN == pimhdr + u_int32 == 8
- * PIM6_REG_MINLEN == pimhdr + reghdr + eip6hdr == 4 + 4 + 40
- */
- minlen = (pimlen >= PIM6_REG_MINLEN) ? PIM6_REG_MINLEN : PIM_MINLEN;
-
- /*
- * Make sure that the IP6 and PIM headers in contiguous memory, and
- * possibly the PIM REGISTER header
- */
- IP6_EXTHDR_GET(pim, struct pim *, m, off, minlen);
- if (pim == NULL) {
- pim6stat.pim6s_rcv_tooshort++;
- return IPPROTO_DONE;
- }
-
- /* PIM version check */
- if (pim->pim_ver != PIM_VERSION) {
- ++pim6stat.pim6s_rcv_badversion;
- m_freem(m);
- return (IPPROTO_DONE);
- }
-
-#define PIM6_CHECKSUM
-#ifdef PIM6_CHECKSUM
- {
- int cksumlen;
-
- /*
- * Validate checksum.
- * If PIM REGISTER, exclude the data packet
- */
- if (pim->pim_type == PIM_REGISTER)
- cksumlen = PIM_MINLEN;
- else
- cksumlen = pimlen;
-
- if (in6_cksum(m, IPPROTO_PIM, off, cksumlen)) {
- ++pim6stat.pim6s_rcv_badsum;
- m_freem(m);
- return (IPPROTO_DONE);
- }
- }
-#endif /* PIM_CHECKSUM */
-
- if (pim->pim_type == PIM_REGISTER) {
- /*
- * since this is a REGISTER, we'll make a copy of the register
- * headers ip6+pim+u_int32_t+encap_ip6, to be passed up to the
- * routing daemon.
- */
- static struct sockaddr_in6 dst = { sizeof(dst), AF_INET6 };
-
- struct mbuf *mcp;
- struct ip6_hdr *eip6;
- u_int32_t *reghdr;
-
- ++pim6stat.pim6s_rcv_registers;
-
- if ((reg_mif_num >= nummifs) || (reg_mif_num == (mifi_t) -1)) {
- m_freem(m);
- return (IPPROTO_DONE);
- }
-
- reghdr = (u_int32_t *)(pim + 1);
-
- if ((ntohl(*reghdr) & PIM_NULL_REGISTER))
- goto pim6_input_to_daemon;
-
- /*
- * Validate length
- */
- if (pimlen < PIM6_REG_MINLEN) {
- ++pim6stat.pim6s_rcv_tooshort;
- ++pim6stat.pim6s_rcv_badregisters;
- m_freem(m);
- return (IPPROTO_DONE);
- }
-
- eip6 = (struct ip6_hdr *) (reghdr + 1);
- /* verify the version number of the inner packet */
- if ((eip6->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) {
- ++pim6stat.pim6s_rcv_badregisters;
- m_freem(m);
- return (IPPROTO_NONE);
- }
-
- /* verify the inner packet is destined to a mcast group */
- if (!IN6_IS_ADDR_MULTICAST(&eip6->ip6_dst)) {
- ++pim6stat.pim6s_rcv_badregisters;
- m_freem(m);
- return (IPPROTO_DONE);
- }
-
- /*
- * make a copy of the whole header to pass to the daemon later.
- */
- mcp = m_copym(m, 0, off + PIM6_REG_MINLEN, M_NOWAIT);
- if (mcp == NULL) {
- m_freem(m);
- return (IPPROTO_DONE);
- }
-
- /*
- * forward the inner ip6 packet; point m_data at the inner ip6.
- */
- m_adj(m, off + PIM_MINLEN);
- if_input_local(mif6table[reg_mif_num].m6_ifp, m,
- dst.sin6_family);
-
- /* prepare the register head to send to the mrouting daemon */
- m = mcp;
- }
-
- /*
- * Pass the PIM message up to the daemon; if it is a register message
- * pass the 'head' only up to the daemon. This includes the
- * encapsulator ip6 header, pim header, register header and the
- * encapsulated ip6 header.
- */
- pim6_input_to_daemon:
- rip6_input(&m, offp, proto);
- return (IPPROTO_DONE);
-}
-
-/*
- * Sysctl for pim6 variables.
- */
-int
-pim6_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp,
- void *newp, size_t newlen)
-{
- /* All sysctl names at this level are terminal. */
- if (namelen != 1)
- return (ENOTDIR);
-
- switch (name[0]) {
- case PIM6CTL_STATS:
- if (newp != NULL)
- return (EPERM);
- return (sysctl_struct(oldp, oldlenp, newp, newlen,
- &pim6stat, sizeof(pim6stat)));
-
- default:
- return (ENOPROTOOPT);
- }
- /* NOTREACHED */
-}
-#endif /* PIM */
-
u_int32_t
_mf6chash(const struct in6_addr *a, const struct in6_addr *g)
{
diff --git a/sys/netinet6/ip6_mroute.h b/sys/netinet6/ip6_mroute.h
index 5062d08ce13..5b1d7df7f50 100644
--- a/sys/netinet6/ip6_mroute.h
+++ b/sys/netinet6/ip6_mroute.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_mroute.h,v 1.16 2015/06/08 22:19:28 krw Exp $ */
+/* $OpenBSD: ip6_mroute.h,v 1.17 2016/12/22 11:04:44 rzalamena Exp $ */
/* $KAME: ip6_mroute.h,v 1.17 2001/02/10 02:05:52 itojun Exp $ */
/*
@@ -53,7 +53,6 @@
#define MRT6_DEL_MIF 103 /* delete multicast interface */
#define MRT6_ADD_MFC 104 /* insert forwarding cache entry */
#define MRT6_DEL_MFC 105 /* delete forwarding cache entry */
-#define MRT6_PIM 107 /* enable pim code */
#define MRT6_INIT 108 /* initialize forwarder (mrt6msg) */
/*
diff --git a/sys/netinet6/pim6.h b/sys/netinet6/pim6.h
deleted file mode 100644
index c5581977ce5..00000000000
--- a/sys/netinet6/pim6.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* $OpenBSD: pim6.h,v 1.4 2013/10/21 10:05:18 deraadt Exp $ */
-/* $KAME: pim6.h,v 1.3 2000/03/25 07:23:58 sumikawa Exp $ */
-
-/*
- * Copyright (C) 1998 WIDE Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-/*
- * Protocol Independent Multicast (PIM) definitions
- *
- * Written by Ahmed Helmy, SGI, July 1996
- *
- * MULTICAST
- */
-
-/*
- * PIM packet header
- */
-#define PIM_VERSION 2
-struct pim {
-#if _BYTE_ORDER == LITTLE_ENDIAN
- u_int pim_type:4, /* the PIM message type, currently they are:
- * Hello, Register, Register-Stop, Join/Prune,
- * Bootstrap, Assert, Graft (PIM-DM only),
- * Graft-Ack (PIM-DM only), C-RP-Adv
- */
- pim_ver:4; /* PIM version number; 2 for PIMv2 */
-#else
- u_int pim_ver:4, /* PIM version */
- pim_type:4; /* PIM type */
-#endif
- u_char pim_rsv; /* Reserved */
- u_short pim_cksum; /* IP style check sum */
-};
-
-#define PIM_MINLEN 8 /* The header min. length is 8 */
-#define PIM6_REG_MINLEN (PIM_MINLEN+40) /* Register message + inner IP6 header */
-
-/*
- * Message types
- */
-#define PIM_REGISTER 1 /* PIM Register type is 1 */
-
-/* second bit in reg_head is the null bit */
-#define PIM_NULL_REGISTER 0x40000000
diff --git a/sys/netinet6/pim6_var.h b/sys/netinet6/pim6_var.h
deleted file mode 100644
index 9df921325f8..00000000000
--- a/sys/netinet6/pim6_var.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* $OpenBSD: pim6_var.h,v 1.11 2013/10/24 11:47:33 deraadt Exp $ */
-/* $KAME: pim6_var.h,v 1.8 2000/06/06 08:07:43 jinmei Exp $ */
-
-/*
- * Copyright (C) 1998 WIDE Project.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _NETINET6_PIM6_VAR_H_
-#define _NETINET6_PIM6_VAR_H_
-
-/*
- * Protocol Independent Multicast (PIM),
- * implementation-specific definitions.
- *
- * Written by George Edmond Eddy (Rusty), ISI, February 1998
- * Modified by Pavlin Ivanov Radoslavov, USC/ISI, May 1998
- */
-
-struct pim6stat {
- u_int64_t pim6s_rcv_total; /* total PIM messages received */
- u_int64_t pim6s_rcv_tooshort; /* received with too few bytes */
- u_int64_t pim6s_rcv_badsum; /* received with bad checksum */
- u_int64_t pim6s_rcv_badversion; /* received bad PIM version */
- u_int64_t pim6s_rcv_registers; /* received registers */
- u_int64_t pim6s_rcv_badregisters; /* received invalid registers */
- u_int64_t pim6s_snd_registers; /* sent registers */
-};
-
-/*
- * Names for PIM6 sysctl objects
- */
-#define PIM6CTL_STATS 1 /* PIM6 stats */
-#define PIM6CTL_MAXID 2
-
-#define PIM6CTL_NAMES { \
- { 0, 0 }, \
- { "stats", CTLTYPE_NODE }, \
-}
-
-#ifdef _KERNEL
-extern struct pim6stat pim6stat;
-int pim6_input(struct mbuf **, int *, int);
-int pim6_sysctl(int *, u_int, void *, size_t *, void *, size_t);
-#endif /* _KERNEL */
-
-#endif /* _NETINET6_PIM6_VAR_H_ */
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index 8445d7827d1..58cb0e34ab7 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.100 2016/12/19 08:36:50 mpi Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.101 2016/12/22 11:04:44 rzalamena Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -528,7 +528,6 @@ rip6_ctloutput(int op, struct socket *so, int level, int optname,
case MRT6_DEL_MIF:
case MRT6_ADD_MFC:
case MRT6_DEL_MFC:
- case MRT6_PIM:
if (op == PRCO_SETOPT) {
error = ip6_mrouter_set(optname, so, *mp);
if (*mp)
diff --git a/usr.bin/netstat/inet.c b/usr.bin/netstat/inet.c
index 8bbac52bf9d..ceae24934d1 100644
--- a/usr.bin/netstat/inet.c
+++ b/usr.bin/netstat/inet.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet.c,v 1.152 2016/11/11 15:01:43 bluhm Exp $ */
+/* $OpenBSD: inet.c,v 1.153 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: inet.c,v 1.14 1995/10/03 21:42:37 thorpej Exp $ */
/*
@@ -49,7 +49,6 @@
#include <netinet/icmp_var.h>
#include <netinet/igmp_var.h>
#include <netinet/ip_var.h>
-#include <netinet/pim_var.h>
#include <netinet/tcp.h>
#include <netinet/tcp_seq.h>
#define TCPSTATES
@@ -771,44 +770,6 @@ igmp_stats(char *name)
#undef py
}
-/*
- * Dump PIM statistics structure.
- */
-void
-pim_stats(char *name)
-{
- struct pimstat pimstat;
- int mib[] = { CTL_NET, PF_INET, IPPROTO_PIM, PIMCTL_STATS };
- size_t len = sizeof(pimstat);
-
- if (sysctl(mib, sizeof(mib) / sizeof(mib[0]),
- &pimstat, &len, NULL, 0) == -1) {
- if (errno != ENOPROTOOPT)
- warn("%s", name);
- return;
- }
-
- printf("%s:\n", name);
-#define p(f, m) if (pimstat.f || sflag <= 1) \
- printf(m, pimstat.f, plural(pimstat.f))
-#define py(f, m) if (pimstat.f || sflag <= 1) \
- printf(m, pimstat.f, pimstat.f != 1 ? "ies" : "y")
-
- p(pims_rcv_total_msgs, "\t%llu message%s received\n");
- p(pims_rcv_total_bytes, "\t%llu byte%s received\n");
- p(pims_rcv_tooshort, "\t%llu message%s received with too few bytes\n");
- p(pims_rcv_badsum, "\t%llu message%s received with bad checksum\n");
- p(pims_rcv_badversion, "\t%llu message%s received with bad version\n");
- p(pims_rcv_registers_msgs, "\t%llu data register message%s received\n");
- p(pims_rcv_registers_bytes, "\t%llu data register byte%s received\n");
- p(pims_rcv_registers_wrongiif, "\t%llu data register message%s received on wrong iif\n");
- p(pims_rcv_badregisters, "\t%llu bad register%s received\n");
- p(pims_snd_registers_msgs, "\t%llu data register message%s sent\n");
- p(pims_snd_registers_bytes, "\t%llu data register byte%s sent\n");
-#undef p
-#undef py
-}
-
struct rpcnams {
struct rpcnams *next;
in_port_t port;
diff --git a/usr.bin/netstat/inet6.c b/usr.bin/netstat/inet6.c
index 9e8be861345..299d0bffb33 100644
--- a/usr.bin/netstat/inet6.c
+++ b/usr.bin/netstat/inet6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: inet6.c,v 1.50 2016/03/28 07:30:28 jca Exp $ */
+/* $OpenBSD: inet6.c,v 1.51 2016/12/22 11:04:44 rzalamena Exp $ */
/* BSDI inet.c,v 2.3 1995/10/24 02:19:29 prb Exp */
/*
* Copyright (c) 1983, 1988, 1993
@@ -45,7 +45,6 @@
#include <netinet/ip_var.h>
#include <netinet6/ip6_var.h>
#include <netinet6/in6_var.h>
-#include <netinet6/pim6_var.h>
#include <netinet6/raw_ip6.h>
#include <netinet6/ip6_divert.h>
@@ -168,7 +167,7 @@ static char *ip6nh[] = {
"#100",
"#101",
"#102",
- "PIM",
+ "#103",
"#104",
"#105",
"#106",
@@ -826,37 +825,6 @@ icmp6_stats(char *name)
}
/*
- * Dump PIM statistics structure.
- */
-void
-pim6_stats(char *name)
-{
- struct pim6stat pim6stat;
- int mib[] = { CTL_NET, PF_INET6, IPPROTO_PIM, PIM6CTL_STATS };
- size_t len = sizeof(pim6stat);
-
- if (sysctl(mib, sizeof(mib) / sizeof(mib[0]),
- &pim6stat, &len, NULL, 0) == -1) {
- if (errno != ENOPROTOOPT)
- warn("%s", name);
- return;
- }
-
- printf("%s:\n", name);
-#define p(f, m) if (pim6stat.f || sflag <= 1) \
- printf(m, (unsigned long long)pim6stat.f, plural(pim6stat.f))
-
- p(pim6s_rcv_total, "\t%llu message%s received\n");
- p(pim6s_rcv_tooshort, "\t%llu message%s received with too few bytes\n");
- p(pim6s_rcv_badsum, "\t%llu message%s received with bad checksum\n");
- p(pim6s_rcv_badversion, "\t%llu message%s received with bad version\n");
- p(pim6s_rcv_registers, "\t%llu register%s received\n");
- p(pim6s_rcv_badregisters, "\t%llu bad register%s received\n");
- p(pim6s_snd_registers, "\t%llu register%s sent\n");
-#undef p
-}
-
-/*
* Dump raw ip6 statistics structure.
*/
void
diff --git a/usr.bin/netstat/main.c b/usr.bin/netstat/main.c
index 8c7bbc9dd2f..e534b166634 100644
--- a/usr.bin/netstat/main.c
+++ b/usr.bin/netstat/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.110 2016/07/20 19:57:54 bluhm Exp $ */
+/* $OpenBSD: main.c,v 1.111 2016/12/22 11:04:44 rzalamena Exp $ */
/* $NetBSD: main.c,v 1.9 1996/05/07 02:55:02 thorpej Exp $ */
/*
@@ -84,7 +84,6 @@ struct protox {
{ carp_stats, "carp", 0 },
{ pfsync_stats, "pfsync", 0 },
{ div_stats, "divert", IPPROTO_DIVERT },
- { pim_stats, "pim", 0 },
{ pflow_stats, "pflow", 0 },
{ NULL, NULL, 0 }
};
@@ -93,7 +92,6 @@ struct protox ip6protox[] = {
{ ip6_stats, "ip6", IPPROTO_IPV6 },
{ div6_stats, "divert6", IPPROTO_DIVERT },
{ icmp6_stats, "icmp6", 0 },
- { pim6_stats, "pim6", 0 },
{ rip6_stats, "rip6", 0 },
{ NULL, NULL, 0 }
};
diff --git a/usr.bin/netstat/mroute6.c b/usr.bin/netstat/mroute6.c
index 7a85cc6c94b..b6e83d95339 100644
--- a/usr.bin/netstat/mroute6.c
+++ b/usr.bin/netstat/mroute6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mroute6.c,v 1.21 2016/08/27 04:13:43 guenther Exp $ */
+/* $OpenBSD: mroute6.c,v 1.22 2016/12/22 11:04:44 rzalamena Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -107,8 +107,6 @@ mroute6pr(void)
case 0:
printf("no IPv6 multicast routing compiled into this system\n");
return;
- case IPPROTO_PIM:
- break;
default:
printf("IPv6 multicast routing protocol %u, unknown\n",
mrtproto);
@@ -212,8 +210,6 @@ mrt6_stats(void)
case 0:
printf("no IPv6 multicast routing compiled into this system\n");
return;
- case IPPROTO_PIM:
- break;
default:
printf("IPv6 multicast routing protocol %u, unknown\n",
mrt6proto);