-/* $OpenBSD: uipc_usrreq.c,v 1.180 2022/08/30 16:24:16 miod Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.181 2022/08/31 21:23:02 mvs Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
}
break;
- case PRU_SENDOOB:
- error = EOPNOTSUPP;
- break;
-
case PRU_SOCKADDR:
uipc_setaddr(unp, nam);
break;
-/* $OpenBSD: pfkeyv2.c,v 1.247 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: pfkeyv2.c,v 1.248 2022/08/31 21:23:02 mvs Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
nam->m_len = pfkey_addr.sa_len;
break;
- case PRU_SENDOOB:
- error = EOPNOTSUPP;
- break;
default:
panic("pfkeyv2_usrreq");
}
-/* $OpenBSD: rtsock.c,v 1.348 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: rtsock.c,v 1.349 2022/08/31 21:23:02 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_SENDOOB:
- error = EOPNOTSUPP;
- break;
default:
panic("route_usrreq");
}
-/* $OpenBSD: ip_divert.c,v 1.81 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: ip_divert.c,v 1.82 2022/08/31 21:23:02 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
break;
case PRU_CONNECT2:
- case PRU_SENDOOB:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
-/* $OpenBSD: raw_ip.c,v 1.142 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.143 2022/08/31 21:23:02 mvs Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
error = EOPNOTSUPP;
break;
- /*
- * Not supported.
- */
- case PRU_SENDOOB:
- error = EOPNOTSUPP;
- break;
-
case PRU_SOCKADDR:
in_setsockaddr(inp, nam);
break;
-/* $OpenBSD: tcp_usrreq.c,v 1.201 2022/08/30 11:53:04 bluhm Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.202 2022/08/31 21:23:02 mvs Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
.pru_abort = tcp_abort,
.pru_sense = tcp_sense,
.pru_rcvoob = tcp_rcvoob,
+ .pru_sendoob = tcp_sendoob,
};
static int pr_slowhz = PR_SLOWHZ;
error = EOPNOTSUPP;
break;
- case PRU_SENDOOB:
- if (sbspace(so, &so->so_snd) < -512) {
- m_freem(m);
- error = ENOBUFS;
- break;
- }
- /*
- * According to RFC961 (Assigned Protocols),
- * the urgent pointer points to the last octet
- * of urgent data. We continue, however,
- * to consider it to indicate the first octet
- * of data past the urgent section.
- * Otherwise, snd_up should be one lower.
- */
- sbappendstream(so, &so->so_snd, m);
- tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
- tp->t_force = 1;
- error = tcp_output(tp);
- tp->t_force = 0;
- break;
-
case PRU_SOCKADDR:
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
return (error);
}
+int
+tcp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *nam,
+ struct mbuf *control)
+{
+ struct inpcb *inp;
+ struct tcpcb *tp;
+ int error;
+ short ostate;
+
+ soassertlocked(so);
+
+ if (control && control->m_len) {
+ error = EINVAL;
+ goto release;
+ }
+
+ if ((error = tcp_sogetpcb(so, &inp, &tp)))
+ goto release;
+
+ if (so->so_options & SO_DEBUG)
+ ostate = tp->t_state;
+
+ if (sbspace(so, &so->so_snd) < -512) {
+ error = ENOBUFS;
+ goto out;
+ }
+
+ /*
+ * According to RFC961 (Assigned Protocols),
+ * the urgent pointer points to the last octet
+ * of urgent data. We continue, however,
+ * to consider it to indicate the first octet
+ * of data past the urgent section.
+ * Otherwise, snd_up should be one lower.
+ */
+ sbappendstream(so, &so->so_snd, m);
+ m = NULL;
+ tp->snd_up = tp->snd_una + so->so_snd.sb_cc;
+ tp->t_force = 1;
+ error = tcp_output(tp);
+ tp->t_force = 0;
+
+out:
+ if (so->so_options & SO_DEBUG)
+ tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_SENDOOB, 0);
+
+release:
+ m_freem(control);
+ m_freem(m);
+
+ return (error);
+}
+
+
/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
-/* $OpenBSD: tcp_var.h,v 1.152 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.153 2022/08/31 21:23:02 mvs Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
int tcp_abort(struct socket *);
int tcp_sense(struct socket *, struct stat *);
int tcp_rcvoob(struct socket *, struct mbuf *, int);
+int tcp_sendoob(struct socket *, struct mbuf *, struct mbuf *,
+ struct mbuf *);
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.296 2022/08/30 11:53:04 bluhm Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.297 2022/08/31 21:23:02 mvs Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
in_setpeeraddr(inp, addr);
break;
- case PRU_SENDOOB:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
-/* $OpenBSD: ip6_divert.c,v 1.80 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: ip6_divert.c,v 1.81 2022/08/31 21:23:02 mvs Exp $ */
/*
* Copyright (c) 2009 Michele Marchetto <michele@openbsd.org>
break;
case PRU_CONNECT2:
- case PRU_SENDOOB:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
-/* $OpenBSD: raw_ip6.c,v 1.163 2022/08/30 11:53:04 bluhm Exp $ */
+/* $OpenBSD: raw_ip6.c,v 1.164 2022/08/31 21:23:02 mvs Exp $ */
/* $KAME: raw_ip6.c,v 1.69 2001/03/04 15:55:44 itojun Exp $ */
/*
error = EOPNOTSUPP;
break;
- /*
- * Not supported.
- */
- case PRU_SENDOOB:
- error = EOPNOTSUPP;
- break;
-
case PRU_SOCKADDR:
in6_setsockaddr(in6p, nam);
break;
-/* $OpenBSD: protosw.h,v 1.49 2022/08/29 08:08:17 mvs Exp $ */
+/* $OpenBSD: protosw.h,v 1.50 2022/08/31 21:23:02 mvs Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
int (*pru_abort)(struct socket *);
int (*pru_sense)(struct socket *, struct stat *);
int (*pru_rcvoob)(struct socket *, struct mbuf *, int);
+ int (*pru_sendoob)(struct socket *, struct mbuf *, struct mbuf *,
+ struct mbuf *);
};
struct protosw {
#ifdef _KERNEL
+#include <sys/mbuf.h>
#include <sys/socketvar.h>
#include <sys/systm.h>
pru_sendoob(struct socket *so, struct mbuf *top, struct mbuf *addr,
struct mbuf *control)
{
- return (*so->so_proto->pr_usrreqs->pru_usrreq)(so,
- PRU_SENDOOB, top, addr, control, curproc);
+ if (so->so_proto->pr_usrreqs->pru_sendoob)
+ return (*so->so_proto->pr_usrreqs->pru_sendoob)(so,
+ top, addr, control);
+ m_freem(top);
+ m_freem(control);
+ return (EOPNOTSUPP);
}
static inline int