-/* $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 $ */
/*
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) {
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;
}
/* 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;
-/* $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 $ */
/*
.pru_accept = uipc_accept,
.pru_disconnect = uipc_disconnect,
.pru_shutdown = uipc_shutdown,
+ .pru_rcvd = uipc_rcvd,
};
void
}
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);
return (0);
}
+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)
-/* $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
break;
case PRU_RCVOOB:
- case PRU_RCVD:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
-/* $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 $ */
/*
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);
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;
return (0);
}
+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)
.pru_detach = route_detach,
.pru_disconnect = route_disconnect,
.pru_shutdown = route_shutdown,
+ .pru_rcvd = route_rcvd,
};
const struct protosw routesw[] = {
-/* $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>
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $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 $ */
/*
* Not supported.
*/
case PRU_SENDOOB:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $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 $ */
/*
.pru_accept = tcp_accept,
.pru_disconnect = tcp_disconnect,
.pru_shutdown = tcp_shutdown,
+ .pru_rcvd = tcp_rcvd,
};
static int pr_slowhz = PR_SLOWHZ;
error = EOPNOTSUPP;
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.
return (error);
}
+/*
+ * 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).
-/* $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 $ */
/*
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);
-/* $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 $ */
/*
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $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>
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $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 $ */
/*
* Not supported.
*/
case PRU_SENDOOB:
- case PRU_RCVD:
case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $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 $ */
/*-
int (*pru_accept)(struct socket *, struct mbuf *);
int (*pru_disconnect)(struct socket *);
int (*pru_shutdown)(struct socket *);
+ int (*pru_rcvd)(struct socket *);
};
struct protosw {
}
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
-/* $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 $ */
/*
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 *);