summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/uipc_socket.c8
-rw-r--r--sys/kern/uipc_usrreq.c60
-rw-r--r--sys/net/pfkeyv2.c3
-rw-r--r--sys/net/rtsock.c34
-rw-r--r--sys/netinet/ip_divert.c3
-rw-r--r--sys/netinet/raw_ip.c3
-rw-r--r--sys/netinet/tcp_usrreq.c52
-rw-r--r--sys/netinet/tcp_var.h3
-rw-r--r--sys/netinet/udp_usrreq.c3
-rw-r--r--sys/netinet6/ip6_divert.c3
-rw-r--r--sys/netinet6/raw_ip6.c3
-rw-r--r--sys/sys/protosw.h10
-rw-r--r--sys/sys/unpcb.h3
13 files changed, 111 insertions, 77 deletions
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index f3de909f3ae..6547ae918b6 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.284 2022/08/21 16:22:17 mvs Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.285 2022/08/26 16:17:38 mvs Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -1156,7 +1156,7 @@ dontblock:
SBLASTRECORDCHK(&so->so_rcv, "soreceive 4");
SBLASTMBUFCHK(&so->so_rcv, "soreceive 4");
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
- pru_rcvd(so, flags);
+ pru_rcvd(so);
}
if (orig_resid == uio->uio_resid && orig_resid &&
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {
@@ -1521,7 +1521,7 @@ somove(struct socket *so, int wait)
if (m == NULL) {
sbdroprecord(so, &so->so_rcv);
if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb)
- pru_rcvd(so, 0);
+ pru_rcvd(so);
goto nextpkt;
}
@@ -1627,7 +1627,7 @@ somove(struct socket *so, int wait)
/* Send window update to source peer as receive buffer has changed. */
if (so->so_proto->pr_flags & PR_WANTRCVD && so->so_pcb)
- pru_rcvd(so, 0);
+ pru_rcvd(so);
/* Receive buffer did shrink by len bytes, adjust oob. */
state = so->so_state;
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 0a5a1ab92cb..fcbb08be5dc 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.174 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.175 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -136,6 +136,7 @@ const struct pr_usrreqs uipc_usrreqs = {
.pru_accept = uipc_accept,
.pru_disconnect = uipc_disconnect,
.pru_shutdown = uipc_shutdown,
+ .pru_rcvd = uipc_rcvd,
};
void
@@ -243,32 +244,6 @@ uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
}
break;
- case PRU_RCVD:
- switch (so->so_type) {
-
- case SOCK_DGRAM:
- panic("uipc 1");
- /*NOTREACHED*/
-
- case SOCK_STREAM:
- case SOCK_SEQPACKET:
- if ((so2 = unp_solock_peer(so)) == NULL)
- break;
- /*
- * Adjust backpressure on sender
- * and wakeup any waiting to write.
- */
- so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt;
- so2->so_snd.sb_cc = so->so_rcv.sb_cc;
- sowwakeup(so2);
- sounlock(so2);
- break;
-
- default:
- panic("uipc 2");
- }
- break;
-
case PRU_SEND:
if (control) {
sounlock(so);
@@ -571,6 +546,37 @@ uipc_shutdown(struct socket *so)
}
int
+uipc_rcvd(struct socket *so)
+{
+ struct socket *so2;
+
+ switch (so->so_type) {
+ case SOCK_DGRAM:
+ panic("uipc 1");
+ /*NOTREACHED*/
+
+ case SOCK_STREAM:
+ case SOCK_SEQPACKET:
+ if ((so2 = unp_solock_peer(so)) == NULL)
+ break;
+ /*
+ * Adjust backpressure on sender
+ * and wakeup any waiting to write.
+ */
+ so2->so_snd.sb_mbcnt = so->so_rcv.sb_mbcnt;
+ so2->so_snd.sb_cc = so->so_rcv.sb_cc;
+ sowwakeup(so2);
+ sounlock(so2);
+ break;
+
+ default:
+ panic("uipc 2");
+ }
+
+ return (0);
+}
+
+int
uipc_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp,
size_t newlen)
{
diff --git a/sys/net/pfkeyv2.c b/sys/net/pfkeyv2.c
index 8fbac63bf33..6347579f317 100644
--- a/sys/net/pfkeyv2.c
+++ b/sys/net/pfkeyv2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkeyv2.c,v 1.241 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.242 2022/08/26 16:17:39 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -396,7 +396,6 @@ pfkeyv2_usrreq(struct socket *so, int req, struct mbuf *m,
break;
case PRU_RCVOOB:
- case PRU_RCVD:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 6f4ba086c9c..08e05a7902e 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.341 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.342 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -116,6 +116,7 @@ int route_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
struct mbuf *, struct proc *);
int route_disconnect(struct socket *);
int route_shutdown(struct socket *);
+int route_rcvd(struct socket *);
void route_input(struct mbuf *m0, struct socket *, sa_family_t);
int route_arp_conflict(struct rtentry *, struct rt_addrinfo *);
int route_cleargateway(struct rtentry *, void *, unsigned int);
@@ -255,17 +256,6 @@ route_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
nam->m_len = route_src.sa_len;
break;
- case PRU_RCVD:
- /*
- * If we are in a FLUSH state, check if the buffer is
- * empty so that we can clear the flag.
- */
- if (((rop->rop_flags & ROUTECB_FLAG_FLUSH) != 0) &&
- ((sbspace(rop->rop_socket, &rop->rop_socket->so_rcv) ==
- rop->rop_socket->so_rcv.sb_hiwat)))
- rop->rop_flags &= ~ROUTECB_FLAG_FLUSH;
- break;
-
case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
@@ -375,6 +365,25 @@ route_shutdown(struct socket *so)
}
int
+route_rcvd(struct socket *so)
+{
+ struct rtpcb *rop = sotortpcb(so);
+
+ soassertlocked(so);
+
+ /*
+ * If we are in a FLUSH state, check if the buffer is
+ * empty so that we can clear the flag.
+ */
+ if (((rop->rop_flags & ROUTECB_FLAG_FLUSH) != 0) &&
+ ((sbspace(rop->rop_socket, &rop->rop_socket->so_rcv) ==
+ rop->rop_socket->so_rcv.sb_hiwat)))
+ rop->rop_flags &= ~ROUTECB_FLAG_FLUSH;
+
+ return (0);
+}
+
+int
route_ctloutput(int op, struct socket *so, int level, int optname,
struct mbuf *m)
{
@@ -2415,6 +2424,7 @@ const struct pr_usrreqs route_usrreqs = {
.pru_detach = route_detach,
.pru_disconnect = route_disconnect,
.pru_shutdown = route_shutdown,
+ .pru_rcvd = route_rcvd,
};
const struct protosw routesw[] = {
diff --git a/sys/netinet/ip_divert.c b/sys/netinet/ip_divert.c
index 2f61c4acc25..bb2b637fe83 100644
--- a/sys/netinet/ip_divert.c
+++ b/sys/netinet/ip_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_divert.c,v 1.76 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.77 2022/08/26 16:17:39 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -294,7 +294,6 @@ divert_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 7794610a6ab..f226a7af9f5 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.137 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.138 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -537,7 +537,6 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
* Not supported.
*/
case PRU_SENDOOB:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index e99ed008f9b..7c473d51146 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.194 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.195 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -121,6 +121,7 @@ const struct pr_usrreqs tcp_usrreqs = {
.pru_accept = tcp_accept,
.pru_disconnect = tcp_disconnect,
.pru_shutdown = tcp_shutdown,
+ .pru_rcvd = tcp_rcvd,
};
static int pr_slowhz = PR_SLOWHZ;
@@ -225,21 +226,6 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
break;
/*
- * After a receive, possibly send window update to peer.
- */
- case PRU_RCVD:
- /*
- * soreceive() calls this function when a user receives
- * ancillary data on a listening socket. We don't call
- * tcp_output in such a case, since there is no header
- * template for a listening socket and hence the kernel
- * will panic.
- */
- if ((so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING)) != 0)
- (void) tcp_output(tp);
- break;
-
- /*
* Do a send by putting data in output queue and updating urgent
* marker if URG set. Possibly send more data.
*/
@@ -915,6 +901,40 @@ out:
}
/*
+ * After a receive, possibly send window update to peer.
+ */
+int
+tcp_rcvd(struct socket *so)
+{
+ struct inpcb *inp;
+ struct tcpcb *tp;
+ int error;
+ short ostate;
+
+ soassertlocked(so);
+
+ if ((error = tcp_sogetpcb(so, &inp, &tp)))
+ return (error);
+
+ if (so->so_options & SO_DEBUG)
+ ostate = tp->t_state;
+
+ /*
+ * soreceive() calls this function when a user receives
+ * ancillary data on a listening socket. We don't call
+ * tcp_output in such a case, since there is no header
+ * template for a listening socket and hence the kernel
+ * will panic.
+ */
+ if ((so->so_state & (SS_ISCONNECTED|SS_ISCONNECTING)) != 0)
+ (void) tcp_output(tp);
+
+ if (so->so_options & SO_DEBUG)
+ tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_RCVD, 0);
+ return (0);
+}
+
+/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
* If in ``let data drain'' option and linger null, just drop.
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 7902c6b7cf7..6b9a237ba90 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.147 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.148 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -720,6 +720,7 @@ int tcp_connect(struct socket *, struct mbuf *);
int tcp_accept(struct socket *, struct mbuf *);
int tcp_disconnect(struct socket *);
int tcp_shutdown(struct socket *);
+int tcp_rcvd(struct socket *);
void tcp_xmit_timer(struct tcpcb *, int);
void tcpdropoldhalfopen(struct tcpcb *, u_int16_t);
void tcp_sack_option(struct tcpcb *,struct tcphdr *,u_char *,int);
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 0fc71754fff..75b507c0552 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.289 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.290 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -1164,7 +1164,6 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
diff --git a/sys/netinet6/ip6_divert.c b/sys/netinet6/ip6_divert.c
index 3b3ae067b7f..2ecce90e31b 100644
--- a/sys/netinet6/ip6_divert.c
+++ b/sys/netinet6/ip6_divert.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip6_divert.c,v 1.75 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.76 2022/08/26 16:17:39 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
@@ -300,7 +300,6 @@ divert6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
diff --git a/sys/netinet6/raw_ip6.c b/sys/netinet6/raw_ip6.c
index f80c9fe5d88..25715c8435e 100644
--- a/sys/netinet6/raw_ip6.c
+++ b/sys/netinet6/raw_ip6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip6.c,v 1.157 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.158 2022/08/26 16:17:39 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
@@ -654,7 +654,6 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
* Not supported.
*/
case PRU_SENDOOB:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index 18510ef9e42..c7afdcada0d 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: protosw.h,v 1.43 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.44 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
@@ -72,6 +72,7 @@ struct pr_usrreqs {
int (*pru_accept)(struct socket *, struct mbuf *);
int (*pru_disconnect)(struct socket *);
int (*pru_shutdown)(struct socket *);
+ int (*pru_rcvd)(struct socket *);
};
struct protosw {
@@ -314,10 +315,11 @@ pru_shutdown(struct socket *so)
}
static inline int
-pru_rcvd(struct socket *so, int flags)
+pru_rcvd(struct socket *so)
{
- return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
- PRU_RCVD, NULL, (struct mbuf *)(long)flags, NULL, curproc);
+ if (so->so_proto->pr_usrreqs->pru_rcvd)
+ return (*so->so_proto->pr_usrreqs->pru_rcvd)(so);
+ return (EOPNOTSUPP);
}
static inline int
diff --git a/sys/sys/unpcb.h b/sys/sys/unpcb.h
index 4a51945945f..9248fb9295d 100644
--- a/sys/sys/unpcb.h
+++ b/sys/sys/unpcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: unpcb.h,v 1.33 2022/08/22 21:18:48 mvs Exp $ */
+/* $OpenBSD: unpcb.h,v 1.34 2022/08/26 16:17:39 mvs Exp $ */
/* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */
/*
@@ -119,6 +119,7 @@ int uipc_connect(struct socket *, struct mbuf *);
int uipc_accept(struct socket *, struct mbuf *);
int uipc_disconnect(struct socket *);
int uipc_shutdown(struct socket *);
+int uipc_rcvd(struct socket *);
void unp_init(void);
int unp_bind(struct unpcb *, struct mbuf *, struct proc *);