summaryrefslogtreecommitdiffstats
path: root/sys/netinet6
diff options
context:
space:
mode:
authorbluhm <bluhm@openbsd.org>2017-01-29 19:58:47 +0000
committerbluhm <bluhm@openbsd.org>2017-01-29 19:58:47 +0000
commit96be3d963b5604cc32eea23d6dcaee46d64ef1dc (patch)
tree20120afa307c098af4862e24cde14c6a2e0c076b /sys/netinet6
parentreturn the sio_open notes to the audio section; from michael reed (diff)
downloadwireguard-openbsd-96be3d963b5604cc32eea23d6dcaee46d64ef1dc.tar.xz
wireguard-openbsd-96be3d963b5604cc32eea23d6dcaee46d64ef1dc.zip
Change the IPv4 pr_input function to the way IPv6 is implemented,
to get rid of struct ip6protosw and some wrapper functions. It is more consistent to have less different structures. The divert_input functions cannot be called anyway, so remove them. OK visa@ mpi@
Diffstat (limited to 'sys/netinet6')
-rw-r--r--sys/netinet6/in6_proto.c16
-rw-r--r--sys/netinet6/ip6_divert.c10
-rw-r--r--sys/netinet6/ip6_input.c14
-rw-r--r--sys/netinet6/ip6protosw.h34
4 files changed, 18 insertions, 56 deletions
diff --git a/sys/netinet6/in6_proto.c b/sys/netinet6/in6_proto.c
index 30fabede281..6fc03970f08 100644
--- a/sys/netinet6/in6_proto.c
+++ b/sys/netinet6/in6_proto.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_proto.c,v 1.87 2016/12/22 11:04:44 rzalamena Exp $ */
+/* $OpenBSD: in6_proto.c,v 1.88 2017/01/29 19:58:47 bluhm Exp $ */
/* $KAME: in6_proto.c,v 1.66 2000/10/10 15:35:47 itojun Exp $ */
/*
@@ -121,7 +121,7 @@
*/
u_char ip6_protox[IPPROTO_MAX];
-struct ip6protosw inet6sw[] = {
+struct protosw inet6sw[] = {
{ 0, &inet6domain, IPPROTO_IPV6, 0,
0, 0, 0, 0,
0,
@@ -129,13 +129,13 @@ struct ip6protosw inet6sw[] = {
ip6_sysctl,
},
{ SOCK_DGRAM, &inet6domain, IPPROTO_UDP, PR_ATOMIC|PR_ADDR|PR_SPLICE,
- udp6_input, 0, udp6_ctlinput, ip6_ctloutput,
+ udp_input, 0, udp6_ctlinput, ip6_ctloutput,
udp_usrreq, 0,
0, 0, 0,
udp_sysctl,
},
{ SOCK_STREAM, &inet6domain, IPPROTO_TCP, PR_CONNREQUIRED|PR_WANTRCVD|PR_ABRTACPTDIS|PR_SPLICE,
- tcp6_input, 0, tcp6_ctlinput, tcp_ctloutput,
+ tcp_input, 0, tcp6_ctlinput, tcp_ctloutput,
tcp_usrreq,
0, 0, 0, 0,
tcp_sysctl,
@@ -188,7 +188,7 @@ struct ip6protosw inet6sw[] = {
#endif /* IPSEC */
#if NGIF > 0
{ SOCK_RAW, &inet6domain, IPPROTO_ETHERIP,PR_ATOMIC|PR_ADDR,
- etherip_input6, rip6_output, 0, rip6_ctloutput,
+ etherip_input, rip6_output, 0, rip6_ctloutput,
rip6_usrreq,
0, 0, 0, 0, etherip_sysctl
},
@@ -204,12 +204,12 @@ struct ip6protosw inet6sw[] = {
},
#else /* NGIF */
{ SOCK_RAW, &inet6domain, IPPROTO_IPV6, PR_ATOMIC|PR_ADDR,
- ip4_input6, rip6_output, 0, rip6_ctloutput,
+ ip4_input, rip6_output, 0, rip6_ctloutput,
rip6_usrreq, /* XXX */
0, 0, 0, 0, ipip_sysctl
},
{ SOCK_RAW, &inet6domain, IPPROTO_IPV4, PR_ATOMIC|PR_ADDR,
- ip4_input6, rip6_output, 0, rip6_ctloutput,
+ ip4_input, rip6_output, 0, rip6_ctloutput,
rip6_usrreq, /* XXX */
0, 0, 0, 0,
},
@@ -223,7 +223,7 @@ struct ip6protosw inet6sw[] = {
#endif /* NCARP */
#if NPF > 0
{ SOCK_RAW, &inet6domain, IPPROTO_DIVERT, PR_ATOMIC|PR_ADDR,
- divert6_input, 0, 0, rip6_ctloutput,
+ 0, 0, 0, rip6_ctloutput,
divert6_usrreq,
divert6_init, 0, 0, 0, divert6_sysctl
},
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index fd435358b12..4e8bfb04e07 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.43 2016/12/19 08:36:50 mpi Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.44 2017/01/29 19:58:47 bluhm Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -74,14 +74,6 @@ divert6_init(void)
}
int
-divert6_input(struct mbuf **mp, int *offp, int proto)
-{
- m_freem(*mp);
-
- return (0);
-}
-
-int
divert6_output(struct inpcb *inp, struct mbuf *m, struct mbuf *nam,
struct mbuf *control)
{
diff --git a/sys/netinet6/ip6_input.c b/sys/netinet6/ip6_input.c
index f52ad6f2095..5e7949f1065 100644
--- a/sys/netinet6/ip6_input.c
+++ b/sys/netinet6/ip6_input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_input.c,v 1.174 2016/12/27 18:45:01 bluhm Exp $ */
+/* $OpenBSD: ip6_input.c,v 1.175 2017/01/29 19:58:47 bluhm Exp $ */
/* $KAME: ip6_input.c,v 1.188 2001/03/29 05:34:31 itojun Exp $ */
/*
@@ -138,16 +138,16 @@ static struct task ip6send_task =
void
ip6_init(void)
{
- struct ip6protosw *pr;
+ struct protosw *pr;
int i;
- pr = (struct ip6protosw *)pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
+ pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW);
if (pr == NULL)
panic("ip6_init");
for (i = 0; i < IPPROTO_MAX; i++)
ip6_protox[i] = pr - inet6sw;
- for (pr = (struct ip6protosw *)inet6domain.dom_protosw;
- pr < (struct ip6protosw *)inet6domain.dom_protoswNPROTOSW; pr++)
+ for (pr = inet6domain.dom_protosw;
+ pr < inet6domain.dom_protoswNPROTOSW; pr++)
if (pr->pr_domain->dom_family == PF_INET6 &&
pr->pr_protocol && pr->pr_protocol != IPPROTO_RAW &&
pr->pr_protocol < IPPROTO_MAX)
@@ -920,8 +920,8 @@ ip6_unknown_opt(u_int8_t *optp, struct mbuf *m, int off)
/*
* Create the "control" list for this pcb.
*
- * The routine will be called from upper layer handlers like tcp6_input().
- * Thus the routine assumes that the caller (tcp6_input) have already
+ * The routine will be called from upper layer handlers like udp_input().
+ * Thus the routine assumes that the caller (udp_input) have already
* called IP6_EXTHDR_CHECK() and all the extension headers are located in the
* very first mbuf on the mbuf chain.
* We may want to add some infinite loop prevention or sanity checks for safety.
diff --git a/sys/netinet6/ip6protosw.h b/sys/netinet6/ip6protosw.h
index 7ae41cca75c..9b118916ec2 100644
--- a/sys/netinet6/ip6protosw.h
+++ b/sys/netinet6/ip6protosw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6protosw.h,v 1.11 2017/01/26 13:03:47 bluhm Exp $ */
+/* $OpenBSD: ip6protosw.h,v 1.12 2017/01/29 19:58:47 bluhm Exp $ */
/* $KAME: ip6protosw.h,v 1.22 2001/02/08 18:02:08 itojun Exp $ */
/*
@@ -109,39 +109,9 @@ struct ip6ctlparam {
u_int8_t ip6c_nxt; /* final next header field */
};
-struct ip6protosw {
- short pr_type; /* socket type used for */
- struct domain *pr_domain; /* domain protocol a member of */
- short pr_protocol; /* protocol number */
- short pr_flags; /* see below */
-
-/* protocol-protocol hooks */
- /* input to protocol (from below) */
- int (*pr_input)(struct mbuf **, int *, int);
- /* output to protocol (from above) */
- int (*pr_output)(struct mbuf *, ...);
- /* control input (from below) */
- void (*pr_ctlinput)(int, struct sockaddr *, u_int, void *);
- /* control output (from above) */
- int (*pr_ctloutput)(int, struct socket *, int, int, struct mbuf **);
-
-/* user-protocol hook */
- /* user request: see list below */
- int (*pr_usrreq)(struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *, struct proc *);
-
-/* utility hooks */
- void (*pr_init)(void); /* initialization hook */
- void (*pr_fasttimo)(void); /* fast timeout (200ms) */
- void (*pr_slowtimo)(void); /* slow timeout (500ms) */
- void (*pr_drain)(void); /* flush any excess space possible */
- /* sysctl for protocol */
- int (*pr_sysctl)(int *, u_int, void *, size_t *, void *, size_t);
-};
-
#ifdef _KERNEL
extern u_char ip6_protox[];
-extern struct ip6protosw inet6sw[];
+extern struct protosw inet6sw[];
#endif
#endif /* !_NETINET6_IP6PROTOSW_H_ */