From d23663e96bbc11e6cf462c1939cd04eba59b6a7e Mon Sep 17 00:00:00 2001 From: bluhm Date: Sun, 28 Aug 2022 20:32:01 +0000 Subject: [PATCH] Since we have no raw_usrreq anymore, remove pr_output indirection. pfkeyv2 and route can call their output functions directly. OK mvs@ --- sys/net/pfkeyv2.c | 11 ++++------- sys/net/rtsock.c | 11 ++++------- sys/sys/protosw.h | 9 +++------ 3 files changed, 11 insertions(+), 20 deletions(-) diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c index df2daf9283d..549bb568468 100644 --- a/sys/net/pfkeyv2.c +++ b/sys/net/pfkeyv2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pfkeyv2.c,v 1.244 2022/08/28 18:44:16 mvs Exp $ */ +/* $OpenBSD: pfkeyv2.c,v 1.245 2022/08/28 20:32:01 bluhm Exp $ */ /* * @(#)COPYRIGHT 1.1 (NRL) 17 January 1995 @@ -178,8 +178,7 @@ int pfkeyv2_send(struct socket *, struct mbuf *, struct mbuf *, int pfkeyv2_abort(struct socket *); int pfkeyv2_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); -int pfkeyv2_output(struct mbuf *, struct socket *, struct sockaddr *, - struct mbuf *); +int pfkeyv2_output(struct mbuf *, struct socket *); int pfkey_sendup(struct pkpcb *, struct mbuf *, int); int pfkeyv2_sa_flush(struct tdb *, void *, int); int pfkeyv2_policy_flush(struct ipsec_policy *, void *, unsigned int); @@ -220,7 +219,6 @@ const struct protosw pfkeysw[] = { .pr_domain = &pfkeydomain, .pr_protocol = PF_KEY_V2, .pr_flags = PR_ATOMIC | PR_ADDR, - .pr_output = pfkeyv2_output, .pr_usrreqs = &pfkeyv2_usrreqs, .pr_sysctl = pfkeyv2_sysctl, } @@ -373,7 +371,7 @@ pfkeyv2_send(struct socket *so, struct mbuf *m, struct mbuf *nam, goto out; } - error = (*so->so_proto->pr_output)(m, so, NULL, NULL); + error = pfkeyv2_output(m, so); m = NULL; out: @@ -449,8 +447,7 @@ pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m, } int -pfkeyv2_output(struct mbuf *mbuf, struct socket *so, - struct sockaddr *dstaddr, struct mbuf *control) +pfkeyv2_output(struct mbuf *mbuf, struct socket *so) { void *message; int error = 0; diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index 2d8cb44e614..21a2b4ecd82 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.344 2022/08/28 18:44:16 mvs Exp $ */ +/* $OpenBSD: rtsock.c,v 1.345 2022/08/28 20:32:01 bluhm Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -109,8 +109,7 @@ struct walkarg { void route_prinit(void); void rcb_ref(void *, void *); void rcb_unref(void *, void *); -int route_output(struct mbuf *, struct socket *, struct sockaddr *, - struct mbuf *); +int route_output(struct mbuf *, struct socket *); int route_ctloutput(int, struct socket *, int, int, struct mbuf *); int route_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); @@ -393,7 +392,7 @@ route_send(struct socket *so, struct mbuf *m, struct mbuf *nam, goto out; } - error = (*so->so_proto->pr_output)(m, so, NULL, NULL); + error = route_output(m, so); m = NULL; out: @@ -727,8 +726,7 @@ rtm_report(struct rtentry *rt, u_char type, int seq, int tableid) } int -route_output(struct mbuf *m, struct socket *so, struct sockaddr *dstaddr, - struct mbuf *control) +route_output(struct mbuf *m, struct socket *so) { struct rt_msghdr *rtm = NULL; struct rtentry *rt = NULL; @@ -2461,7 +2459,6 @@ const struct protosw routesw[] = { .pr_type = SOCK_RAW, .pr_domain = &routedomain, .pr_flags = PR_ATOMIC|PR_ADDR|PR_WANTRCVD, - .pr_output = route_output, .pr_ctloutput = route_ctloutput, .pr_usrreqs = &route_usrreqs, .pr_init = route_prinit, diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index be609dea880..3f6bfa87765 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.46 2022/08/28 18:44:17 mvs Exp $ */ +/* $OpenBSD: protosw.h,v 1.47 2022/08/28 20:32:02 bluhm Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -43,8 +43,8 @@ * every 500ms through the pr_slowtimo for timer based actions. * * Protocols pass data between themselves as chains of mbufs using - * the pr_input and pr_output hooks. Pr_input passes data up (towards - * UNIX) and pr_output passes it down (towards the imps); control + * the pr_input and pr_send hooks. Pr_input passes data up (towards + * UNIX) and pr_send passes it down (towards the imps); control * information passes up and down on pr_ctlinput and pr_ctloutput. * The protocol is responsible for the space occupied by any the * arguments to these entries and must dispose it. @@ -87,9 +87,6 @@ struct protosw { /* protocol-protocol hooks */ /* input to protocol (from below) */ int (*pr_input)(struct mbuf **, int *, int, int); - /* output to protocol (from above) */ - int (*pr_output)(struct mbuf *, struct socket *, struct sockaddr *, - struct mbuf *); /* control input (from below) */ void (*pr_ctlinput)(int, struct sockaddr *, u_int, void *); /* control output (from above) */ -- 2.20.1