diff options
author | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2022-09-03 22:43:40 +0000 |
---|---|---|
committer | Vitaliy Makkoveev <mvs@cvs.openbsd.org> | 2022-09-03 22:43:40 +0000 |
commit | fe8bd4c21ccdb6346edd9c98e002219791ef746d (patch) | |
tree | e029150b93f2d8115fc1a882774fc87488b29896 /sys/netinet6 | |
parent | 41377f6c1a23cabe8ffd4a669675e15f7afb4eba (diff) |
Move PRU_PEERADDR request to (*pru_peeraddr)().
Introduce in{,6}_peeraddr() and use them for inet and inet6 sockets,
except tcp(4) case.
Also remove *_usrreq() handlers.
ok bluhm@
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_pcb.c | 13 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.c | 43 | ||||
-rw-r--r-- | sys/netinet6/ip6_divert.h | 4 | ||||
-rw-r--r-- | sys/netinet6/ip6_var.h | 4 | ||||
-rw-r--r-- | sys/netinet6/raw_ip6.c | 35 |
5 files changed, 18 insertions, 81 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index 5410149d4ab..1e17ada3257 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.122 2022/09/03 18:48:50 mvs Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.123 2022/09/03 22:43:38 mvs Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -376,6 +376,17 @@ in6_sockaddr(struct socket *so, struct mbuf *nam) return (0); } +int +in6_peeraddr(struct socket *so, struct mbuf *nam) +{ + struct inpcb *in6p; + + in6p = sotoinpcb(so); + in6_setpeeraddr(in6p, nam); + + return (0); +} + /* * Pass some notification to all connections of a protocol * associated with address dst. The local address and/or port numbers diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c index 892f7fd033d..706d5b9f3b9 100644 --- a/sys/netinet6/ip6_divert.c +++ b/sys/netinet6/ip6_divert.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.c,v 1.84 2022/09/03 18:48:50 mvs Exp $ */ +/* $OpenBSD: ip6_divert.c,v 1.85 2022/09/03 22:43:38 mvs Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -64,7 +64,6 @@ const struct sysctl_bounded_args divert6ctl_vars[] = { }; const struct pr_usrreqs divert6_usrreqs = { - .pru_usrreq = divert6_usrreq, .pru_attach = divert6_attach, .pru_detach = divert6_detach, .pru_bind = divert6_bind, @@ -73,6 +72,7 @@ const struct pr_usrreqs divert6_usrreqs = { .pru_abort = divert6_abort, .pru_control = in6_control, .pru_sockaddr = in6_sockaddr, + .pru_peeraddr = in6_peeraddr, }; int divb6hashsize = DIVERTHASHSIZE; @@ -258,45 +258,6 @@ divert6_packet(struct mbuf *m, int dir, u_int16_t divert_port) m_freem(m); } -/*ARGSUSED*/ -int -divert6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr, - struct mbuf *control, struct proc *p) -{ - struct inpcb *inp = sotoinpcb(so); - int error = 0; - - soassertlocked(so); - - if (inp == NULL) { - error = EINVAL; - goto release; - } - switch (req) { - - case PRU_PEERADDR: - in6_setpeeraddr(inp, addr); - break; - - case PRU_FASTTIMO: - case PRU_SLOWTIMO: - case PRU_PROTORCV: - case PRU_PROTOSEND: - error = EOPNOTSUPP; - break; - - default: - panic("%s", __func__); - } - -release: - if (req != PRU_RCVD && req != PRU_RCVOOB && req != PRU_SENSE) { - m_freem(control); - m_freem(m); - } - return (error); -} - int divert6_attach(struct socket *so, int proto) { diff --git a/sys/netinet6/ip6_divert.h b/sys/netinet6/ip6_divert.h index 21884ac948e..d76c123e15c 100644 --- a/sys/netinet6/ip6_divert.h +++ b/sys/netinet6/ip6_divert.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_divert.h,v 1.18 2022/08/28 18:44:17 mvs Exp $ */ +/* $OpenBSD: ip6_divert.h,v 1.19 2022/09/03 22:43:38 mvs Exp $ */ /* * Copyright (c) 2009 Michele Marchetto <michele@openbsd.org> @@ -70,8 +70,6 @@ extern const struct pr_usrreqs divert6_usrreqs; void divert6_init(void); void divert6_packet(struct mbuf *, int, u_int16_t); int divert6_sysctl(int *, u_int, void *, size_t *, void *, size_t); -int divert6_usrreq(struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); int divert6_attach(struct socket *, int); int divert6_detach(struct socket *); int divert6_bind(struct socket *, struct mbuf *, struct proc *); diff --git a/sys/netinet6/ip6_var.h b/sys/netinet6/ip6_var.h index ee560a02273..f501eb023c8 100644 --- a/sys/netinet6/ip6_var.h +++ b/sys/netinet6/ip6_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ip6_var.h,v 1.101 2022/08/28 18:44:17 mvs Exp $ */ +/* $OpenBSD: ip6_var.h,v 1.102 2022/09/03 22:43:38 mvs Exp $ */ /* $KAME: ip6_var.h,v 1.33 2000/06/11 14:59:20 jinmei Exp $ */ /* @@ -351,8 +351,6 @@ void rip6_ctlinput(int, struct sockaddr *, u_int, void *); int rip6_ctloutput(int, struct socket *, int, int, struct mbuf *); int rip6_output(struct mbuf *, struct socket *, struct sockaddr *, struct mbuf *); -int rip6_usrreq(struct socket *, - int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *); int rip6_attach(struct socket *, int); int rip6_detach(struct socket *); int rip6_bind(struct socket *, struct mbuf *, struct proc *); diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c index 2e080474206..1d8c2709839 100644 --- a/sys/netinet6/raw_ip6.c +++ b/sys/netinet6/raw_ip6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: raw_ip6.c,v 1.167 2022/09/03 18:48:50 mvs Exp $ */ +/* $OpenBSD: raw_ip6.c,v 1.168 2022/09/03 22:43:38 mvs Exp $ */ /* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */ /* @@ -106,7 +106,6 @@ struct inpcbtable rawin6pcbtable; struct cpumem *rip6counters; const struct pr_usrreqs rip6_usrreqs = { - .pru_usrreq = rip6_usrreq, .pru_attach = rip6_attach, .pru_detach = rip6_detach, .pru_bind = rip6_bind, @@ -117,6 +116,7 @@ const struct pr_usrreqs rip6_usrreqs = { .pru_abort = rip6_abort, .pru_control = in6_control, .pru_sockaddr = in6_sockaddr, + .pru_peeraddr = in6_peeraddr, }; /* @@ -576,37 +576,6 @@ extern u_long rip6_sendspace; extern u_long rip6_recvspace; int -rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, - struct mbuf *control, struct proc *p) -{ - struct inpcb *in6p; - int error = 0; - - soassertlocked(so); - - in6p = sotoinpcb(so); - if (in6p == NULL) { - error = EINVAL; - goto release; - } - - switch (req) { - case PRU_PEERADDR: - in6_setpeeraddr(in6p, nam); - break; - - default: - panic("%s", __func__); - } -release: - if (req != PRU_RCVD && req != PRU_RCVOOB && req != PRU_SENSE) { - m_freem(control); - m_freem(m); - } - return (error); -} - -int rip6_attach(struct socket *so, int proto) { struct inpcb *in6p; |