From 46ddeb6be8e839d4e404c98c230fe1b57a9ea32f Mon Sep 17 00:00:00 2001 From: Gleb Smirnoff Date: Mon, 3 Oct 2022 20:53:04 -0700 Subject: [PATCH] netinet6: retire ip6protosw.h The netinet/ipprotosw.h and netinet6/ip6protosw.h were KAME relics, with the former removed in f0ffb944d25 in 2001 and the latter survived until today. It has been reduced down to only one useful declaration that moves to ip6_var.h Reviewed by: melifaro Differential revision: https://reviews.freebsd.org/D36726 --- ObsoleteFiles.inc | 3 + sys/netinet/sctp_os_bsd.h | 1 - sys/netinet/tcp_subr.c | 3 - sys/netinet/tcp_timewait.c | 3 - sys/netinet6/icmp6.c | 1 - sys/netinet6/in6_proto.c | 2 - sys/netinet6/ip6_input.c | 2 - sys/netinet6/ip6_output.c | 1 - sys/netinet6/ip6_var.h | 29 +++++++++ sys/netinet6/ip6protosw.h | 119 ------------------------------------- sys/netinet6/raw_ip6.c | 1 - sys/netinet6/udp6_usrreq.c | 1 - sys/netipsec/ipsec_input.c | 1 - 13 files changed, 32 insertions(+), 135 deletions(-) delete mode 100644 sys/netinet6/ip6protosw.h diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 3d9e7d4c6dd..6cccea90c74 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20221003: ip6protosw.h removed +OLD_FILES+=usr/include/netinet6/ip6protosw.h + # 20221001: deorbit opie OLD_FILES+=etc/opieaccess OLD_FILES+=etc/opiekeys diff --git a/sys/netinet/sctp_os_bsd.h b/sys/netinet/sctp_os_bsd.h index 8240fca64c4..d9b5c140f14 100644 --- a/sys/netinet/sctp_os_bsd.h +++ b/sys/netinet/sctp_os_bsd.h @@ -92,7 +92,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #endif /* INET6 */ diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 9b3525815f7..b9c5be5592f 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -120,9 +120,6 @@ __FBSDID("$FreeBSD$"); #ifdef TCPDEBUG #include #endif -#ifdef INET6 -#include -#endif #ifdef TCP_OFFLOAD #include #endif diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index ad183aa2e18..5cac0af946a 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -86,9 +86,6 @@ __FBSDID("$FreeBSD$"); #ifdef TCPDEBUG #include #endif -#ifdef INET6 -#include -#endif #include #include diff --git a/sys/netinet6/icmp6.c b/sys/netinet6/icmp6.c index 6b81c7a6b00..0d878690771 100644 --- a/sys/netinet6/icmp6.c +++ b/sys/netinet6/icmp6.c @@ -107,7 +107,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c index 688702e17e3..da15e6e2d13 100644 --- a/sys/netinet6/in6_proto.c +++ b/sys/netinet6/in6_proto.c @@ -119,8 +119,6 @@ __FBSDID("$FreeBSD$"); #include #endif /* SCTP */ -#include - /* netinet6/raw_ip6.c */ extern struct protosw rip6_protosw; /* netinet6/udp6_usrreq.c */ diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c index 5c802beae2e..31a3170475c 100644 --- a/sys/netinet6/ip6_input.c +++ b/sys/netinet6/ip6_input.c @@ -129,8 +129,6 @@ __FBSDID("$FreeBSD$"); #include -#include - ip6proto_input_t *ip6_protox[IPPROTO_MAX] = { [0 ... IPPROTO_MAX - 1] = rip6_input }; ip6proto_ctlinput_t *ip6_ctlprotox[IPPROTO_MAX] = { diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c index 617271f9640..b976b058351 100644 --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -121,7 +121,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#include #include extern int in6_mcast_loop; diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index 69ed33bd8e7..2b15443fc4d 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -414,6 +414,35 @@ u_int32_t ip6_randomid(void); u_int32_t ip6_randomflowlabel(void); void in6_delayed_cksum(struct mbuf *m, uint32_t plen, u_short offset); +/* + * Argument type for the last arg of ip6proto_ctlinput_t(). + * + * IPv6 ICMP IPv6 [exthdrs] finalhdr payload + * ^ ^ ^ ^ + * | | ip6c_ip6 ip6c_off + * | ip6c_icmp6 + * ip6c_m + * + * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original + * (internal) packet carries a routing header, it may point the final + * destination address in the routing header. + * + * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6 + * (beware of flowlabel, if you try to compare it against others) + * ip6c_dst: ip6c_finaldst + scope info + */ +struct ip6ctlparam { + struct mbuf *ip6c_m; /* start of mbuf chain */ + struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */ + struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */ + int ip6c_off; /* offset of the target proto header */ + struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */ + struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */ + struct in6_addr *ip6c_finaldst; /* final destination address */ + void *ip6c_cmdarg; /* control command dependent data */ + u_int8_t ip6c_nxt; /* final next header field */ +}; + typedef int ip6proto_input_t(struct mbuf **, int *, int); typedef void ip6proto_ctlinput_t(int, struct sockaddr *, void *); int ip6proto_register(uint8_t, ip6proto_input_t, ip6proto_ctlinput_t); diff --git a/sys/netinet6/ip6protosw.h b/sys/netinet6/ip6protosw.h deleted file mode 100644 index d978e33042b..00000000000 --- a/sys/netinet6/ip6protosw.h +++ /dev/null @@ -1,119 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-3-Clause - * - * Copyright (C) 1995, 1996, 1997, and 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. - * - * $KAME: ip6protosw.h,v 1.25 2001/09/26 06:13:03 keiichi Exp $ - */ - -/*- - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. 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 University 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 REGENTS 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 REGENTS 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. - * - * @(#)protosw.h 8.1 (Berkeley) 6/2/93 - * BSDI protosw.h,v 2.3 1996/10/11 16:02:40 pjd Exp - * $FreeBSD$ - */ - -#ifndef _NETINET6_IP6PROTOSW_H_ -#define _NETINET6_IP6PROTOSW_H_ - -/* - * Protocol switch table for IPv6. - * All other definitions should refer to sys/protosw.h - */ - -struct mbuf; -struct sockaddr; -struct socket; -struct domain; -struct thread; -struct ip6_hdr; -struct icmp6_hdr; -struct in6_addr; -struct pr_usrreqs; - -/* - * argument type for the last arg of pr_ctlinput(). - * should be consulted only with AF_INET6 family. - * - * IPv6 ICMP IPv6 [exthdrs] finalhdr payload - * ^ ^ ^ ^ - * | | ip6c_ip6 ip6c_off - * | ip6c_icmp6 - * ip6c_m - * - * ip6c_finaldst usually points to ip6c_ip6->ip6_dst. if the original - * (internal) packet carries a routing header, it may point the final - * destination address in the routing header. - * - * ip6c_src: ip6c_ip6->ip6_src + scope info + flowlabel in ip6c_ip6 - * (beware of flowlabel, if you try to compare it against others) - * ip6c_dst: ip6c_finaldst + scope info - */ -struct ip6ctlparam { - struct mbuf *ip6c_m; /* start of mbuf chain */ - struct icmp6_hdr *ip6c_icmp6; /* icmp6 header of target packet */ - struct ip6_hdr *ip6c_ip6; /* ip6 header of target packet */ - int ip6c_off; /* offset of the target proto header */ - struct sockaddr_in6 *ip6c_src; /* srcaddr w/ additional info */ - struct sockaddr_in6 *ip6c_dst; /* (final) dstaddr w/ additional info */ - struct in6_addr *ip6c_finaldst; /* final destination address */ - void *ip6c_cmdarg; /* control command dependent data */ - u_int8_t ip6c_nxt; /* final next header field */ -}; - -#ifdef _KERNEL -extern struct protosw inet6sw[]; -#endif - -#endif /* !_NETINET6_IP6PROTOSW_H_ */ diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 0a5d343f372..b1cf9fc68a5 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -98,7 +98,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c index c8e65f64084..4c06e5ea943 100644 --- a/sys/netinet6/udp6_usrreq.c +++ b/sys/netinet6/udp6_usrreq.c @@ -114,7 +114,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include diff --git a/sys/netipsec/ipsec_input.c b/sys/netipsec/ipsec_input.c index ca6c6592dfa..7effed48121 100644 --- a/sys/netipsec/ipsec_input.c +++ b/sys/netipsec/ipsec_input.c @@ -95,7 +95,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include