-/* $OpenBSD: uipc_usrreq.c,v 1.178 2022/08/28 21:35:11 mvs Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.179 2022/08/29 08:08:17 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
}
break;
- case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: pfkeyv2.c,v 1.246 2022/08/28 21:35:11 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.247 2022/08/29 08:08:17 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
nam->m_len = pfkey_addr.sa_len;
break;
- case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: rtsock.c,v 1.347 2022/08/29 07:51:45 bluhm Exp $ */
+/* $OpenBSD: rtsock.c,v 1.348 2022/08/29 08:08:17 mvs Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
nam->m_len = route_src.sa_len;
break;
- case PRU_RCVOOB:
case PRU_SENDOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: ip_divert.c,v 1.80 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.81 2022/08/29 08:08:17 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: raw_ip.c,v 1.141 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.142 2022/08/29 08:08:17 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
* Not supported.
*/
case PRU_SENDOOB:
- case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: tcp_usrreq.c,v 1.198 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.199 2022/08/29 08:08:17 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
.pru_send = tcp_send,
.pru_abort = tcp_abort,
.pru_sense = tcp_sense,
+ .pru_rcvoob = tcp_rcvoob,
};
static int pr_slowhz = PR_SLOWHZ;
error = EOPNOTSUPP;
break;
- case PRU_RCVOOB:
- if ((so->so_oobmark == 0 &&
- (so->so_state & SS_RCVATMARK) == 0) ||
- so->so_options & SO_OOBINLINE ||
- tp->t_oobflags & TCPOOB_HADDATA) {
- error = EINVAL;
- break;
- }
- if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) {
- error = EWOULDBLOCK;
- break;
- }
- m->m_len = 1;
- *mtod(m, caddr_t) = tp->t_iobc;
- if (((long)nam & MSG_PEEK) == 0)
- tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
- break;
-
case PRU_SENDOOB:
if (sbspace(so, &so->so_snd) < -512) {
m_freem(m);
return (0);
}
+int
+tcp_rcvoob(struct socket *so, struct mbuf *m, int flags)
+{
+ struct inpcb *inp;
+ struct tcpcb *tp;
+ int error;
+
+ soassertlocked(so);
+
+ if ((error = tcp_sogetpcb(so, &inp, &tp)))
+ return (error);
+
+ if ((so->so_oobmark == 0 &&
+ (so->so_state & SS_RCVATMARK) == 0) ||
+ so->so_options & SO_OOBINLINE ||
+ tp->t_oobflags & TCPOOB_HADDATA) {
+ error = EINVAL;
+ goto out;
+ }
+ if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) {
+ error = EWOULDBLOCK;
+ goto out;
+ }
+ m->m_len = 1;
+ *mtod(m, caddr_t) = tp->t_iobc;
+ if ((flags & MSG_PEEK) == 0)
+ tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA);
+out:
+ if (so->so_options & SO_DEBUG)
+ tcp_trace(TA_USER, tp->t_state, tp, tp, NULL, PRU_RCVOOB, 0);
+ return (error);
+}
+
/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
-/* $OpenBSD: tcp_var.h,v 1.151 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.152 2022/08/29 08:08:17 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
struct mbuf *);
int tcp_abort(struct socket *);
int tcp_sense(struct socket *, struct stat *);
+int tcp_rcvoob(struct socket *, struct mbuf *, int);
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.293 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.294 2022/08/29 08:08:17 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_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: ip6_divert.c,v 1.79 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.80 2022/08/29 08:08:17 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
case PRU_SLOWTIMO:
case PRU_PROTORCV:
case PRU_PROTOSEND:
- case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: raw_ip6.c,v 1.161 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.162 2022/08/29 08:08:17 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
* Not supported.
*/
case PRU_SENDOOB:
- case PRU_RCVOOB:
error = EOPNOTSUPP;
break;
-/* $OpenBSD: protosw.h,v 1.48 2022/08/28 21:35:12 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.49 2022/08/29 08:08:17 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
struct mbuf *);
int (*pru_abort)(struct socket *);
int (*pru_sense)(struct socket *, struct stat *);
+ int (*pru_rcvoob)(struct socket *, struct mbuf *, int);
};
struct protosw {
static inline int
pru_rcvoob(struct socket *so, struct mbuf *m, int flags)
{
- return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
- PRU_RCVOOB, m, (struct mbuf *)(long)flags, NULL, curproc);
+ if (so->so_proto->pr_usrreqs->pru_rcvoob)
+ return (*so->so_proto->pr_usrreqs->pru_rcvoob)(so, m, flags);
+ return (EOPNOTSUPP);
}
static inline int