Module Name: src Committed By: rtr Date: Wed Jul 23 13:17:19 UTC 2014
Modified Files: src/sys/dev: kttcp.c src/sys/kern: uipc_socket.c uipc_usrreq.c src/sys/net: raw_usrreq.c rtsock.c src/sys/netatalk: ddp_usrreq.c src/sys/netbt: hci_socket.c l2cap_socket.c rfcomm_socket.c sco_socket.c src/sys/netinet: raw_ip.c tcp_usrreq.c udp_usrreq.c src/sys/netinet6: raw_ip6.c udp6_usrreq.c src/sys/netipsec: keysock.c src/sys/netmpls: mpls_proto.c src/sys/netnatm: natm.c src/sys/rump/net/lib/libsockin: sockin.c src/sys/sys: protosw.h Log Message: split PRU_SENDOOB and PRU_RCVOOB function out of pr_generic() usrreq switches and put into separate functions xxx_sendoob(struct socket *, struct mbuf *, struct mbuf *) xxx_recvoob(struct socket *, struct mbuf *, int) - always KASSERT(solocked(so)) even if request is not implemented - replace calls to pr_generic() with req = PRU_{SEND,RCV}OOB with calls to pr_{send,recv}oob() respectively. there is still some tweaking of m_freem(m) and m_freem(control) to come for consistency. not performed with this commit for clarity. reviewed by rmind To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.34 src/sys/dev/kttcp.c cvs rdiff -u -r1.225 -r1.226 src/sys/kern/uipc_socket.c cvs rdiff -u -r1.159 -r1.160 src/sys/kern/uipc_usrreq.c cvs rdiff -u -r1.43 -r1.44 src/sys/net/raw_usrreq.c cvs rdiff -u -r1.155 -r1.156 src/sys/net/rtsock.c cvs rdiff -u -r1.53 -r1.54 src/sys/netatalk/ddp_usrreq.c cvs rdiff -u -r1.32 -r1.33 src/sys/netbt/hci_socket.c cvs rdiff -u -r1.23 -r1.24 src/sys/netbt/l2cap_socket.c cvs rdiff -u -r1.24 -r1.25 src/sys/netbt/rfcomm_socket.c cvs rdiff -u -r1.25 -r1.26 src/sys/netbt/sco_socket.c cvs rdiff -u -r1.134 -r1.135 src/sys/netinet/raw_ip.c cvs rdiff -u -r1.188 -r1.189 src/sys/netinet/tcp_usrreq.c cvs rdiff -u -r1.208 -r1.209 src/sys/netinet/udp_usrreq.c cvs rdiff -u -r1.127 -r1.128 src/sys/netinet6/raw_ip6.c cvs rdiff -u -r1.107 -r1.108 src/sys/netinet6/udp6_usrreq.c cvs rdiff -u -r1.35 -r1.36 src/sys/netipsec/keysock.c cvs rdiff -u -r1.15 -r1.16 src/sys/netmpls/mpls_proto.c cvs rdiff -u -r1.37 -r1.38 src/sys/netnatm/natm.c cvs rdiff -u -r1.49 -r1.50 src/sys/rump/net/lib/libsockin/sockin.c cvs rdiff -u -r1.52 -r1.53 src/sys/sys/protosw.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/kttcp.c diff -u src/sys/dev/kttcp.c:1.33 src/sys/dev/kttcp.c:1.34 --- src/sys/dev/kttcp.c:1.33 Sun May 18 14:46:15 2014 +++ src/sys/dev/kttcp.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: kttcp.c,v 1.33 2014/05/18 14:46:15 rmind Exp $ */ +/* $NetBSD: kttcp.c,v 1.34 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (c) 2002 Wasabi Systems, Inc. @@ -42,7 +42,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.33 2014/05/18 14:46:15 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.34 2014/07/23 13:17:18 rtr Exp $"); #include <sys/param.h> #include <sys/types.h> @@ -319,9 +319,12 @@ nopages: so->so_options |= SO_DONTROUTE; if (resid > 0) so->so_state |= SS_MORETOCOME; - error = (*so->so_proto->pr_usrreqs->pr_generic)(so, - (flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND, - top, NULL, NULL, l); + if (flags & MSG_OOB) + error = (*so->so_proto->pr_usrreqs->pr_sendoob)(so, + top, NULL); + else + error = (*so->so_proto->pr_usrreqs->pr_generic)(so, + PRU_SEND, top, NULL, NULL, l); if (dontroute) so->so_options &= ~SO_DONTROUTE; if (resid > 0) @@ -367,8 +370,7 @@ kttcp_soreceive(struct socket *so, unsig if (flags & MSG_OOB) { m = m_get(M_WAIT, MT_DATA); solock(so); - error = (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVOOB, m, - (struct mbuf *)(long)(flags & MSG_PEEK), NULL, NULL); + error = (*pr->pr_usrreqs->pr_recvoob)(so, m, flags & MSG_PEEK); sounlock(so); if (error) goto bad; Index: src/sys/kern/uipc_socket.c diff -u src/sys/kern/uipc_socket.c:1.225 src/sys/kern/uipc_socket.c:1.226 --- src/sys/kern/uipc_socket.c:1.225 Wed Jul 9 14:41:42 2014 +++ src/sys/kern/uipc_socket.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_socket.c,v 1.225 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: uipc_socket.c,v 1.226 2014/07/23 13:17:18 rtr Exp $ */ /*- * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc. @@ -71,7 +71,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.225 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.226 2014/07/23 13:17:18 rtr Exp $"); #include "opt_compat_netbsd.h" #include "opt_sock_counters.h" @@ -1053,9 +1053,12 @@ sosend(struct socket *so, struct mbuf *a so->so_options |= SO_DONTROUTE; if (resid > 0) so->so_state |= SS_MORETOCOME; - error = (*so->so_proto->pr_usrreqs->pr_generic)(so, - (flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND, - top, addr, control, curlwp); + if (flags & MSG_OOB) + error = (*so->so_proto->pr_usrreqs->pr_sendoob)(so, + top, control); + else + error = (*so->so_proto->pr_usrreqs->pr_generic)(so, + PRU_SEND, top, addr, control, curlwp); if (dontroute) so->so_options &= ~SO_DONTROUTE; if (resid > 0) @@ -1167,8 +1170,7 @@ soreceive(struct socket *so, struct mbuf if (flags & MSG_OOB) { m = m_get(M_WAIT, MT_DATA); solock(so); - error = (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVOOB, m, - (struct mbuf *)(long)(flags & MSG_PEEK), NULL, l); + error = (*pr->pr_usrreqs->pr_recvoob)(so, m, flags & MSG_PEEK); sounlock(so); if (error) goto bad; Index: src/sys/kern/uipc_usrreq.c diff -u src/sys/kern/uipc_usrreq.c:1.159 src/sys/kern/uipc_usrreq.c:1.160 --- src/sys/kern/uipc_usrreq.c:1.159 Wed Jul 9 14:41:42 2014 +++ src/sys/kern/uipc_usrreq.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: uipc_usrreq.c,v 1.159 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: uipc_usrreq.c,v 1.160 2014/07/23 13:17:18 rtr Exp $ */ /*- * Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc. @@ -96,7 +96,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.159 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.160 2014/07/23 13:17:18 rtr Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -366,6 +366,25 @@ unp_setaddr(struct socket *so, struct mb } static int +unp_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +unp_sendoob(struct socket *so, struct mbuf *m, struct mbuf * control) +{ + KASSERT(solocked(so)); + + m_freem(m); + m_freem(control); + + return EOPNOTSUPP; +} + +static int unp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { @@ -381,11 +400,13 @@ unp_usrreq(struct socket *so, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); KASSERT(solocked(so)); unp = sotounpcb(so); - KASSERT(!control || (req == PRU_SEND || req == PRU_SENDOOB)); + KASSERT(!control || req == PRU_SEND); if (unp == NULL) { error = EINVAL; goto release; @@ -581,16 +602,6 @@ unp_usrreq(struct socket *so, int req, s unp_detach(so); break; - case PRU_RCVOOB: - error = EOPNOTSUPP; - break; - - case PRU_SENDOOB: - m_freem(control); - m_freem(m); - error = EOPNOTSUPP; - break; - default: panic("piusrreq"); } @@ -1862,5 +1873,7 @@ const struct pr_usrreqs unp_usrreqs = { .pr_stat = unp_stat, .pr_peeraddr = unp_peeraddr, .pr_sockaddr = unp_sockaddr, + .pr_recvoob = unp_recvoob, + .pr_sendoob = unp_sendoob, .pr_generic = unp_usrreq, }; Index: src/sys/net/raw_usrreq.c diff -u src/sys/net/raw_usrreq.c:1.43 src/sys/net/raw_usrreq.c:1.44 --- src/sys/net/raw_usrreq.c:1.43 Wed Jul 9 14:41:42 2014 +++ src/sys/net/raw_usrreq.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_usrreq.c,v 1.43 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: raw_usrreq.c,v 1.44 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (c) 1980, 1986, 1993 @@ -36,7 +36,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.43 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.44 2014/07/23 13:17:18 rtr Exp $"); #include <sys/param.h> #include <sys/mbuf.h> @@ -167,11 +167,13 @@ raw_usrreq(struct socket *so, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); s = splsoftnet(); KERNEL_LOCK(1, NULL); - KASSERT(!control || (req == PRU_SEND || req == PRU_SENDOOB)); + KASSERT(!control || req == PRU_SEND); if (rp == NULL) { error = EINVAL; goto release; @@ -241,19 +243,6 @@ raw_usrreq(struct socket *so, int req, s raw_disconnect(rp); break; - /* - * Not supported. - */ - case PRU_RCVOOB: - error = EOPNOTSUPP; - break; - - case PRU_SENDOOB: - m_freem(control); - m_freem(m); - error = EOPNOTSUPP; - break; - default: panic("raw_usrreq"); } Index: src/sys/net/rtsock.c diff -u src/sys/net/rtsock.c:1.155 src/sys/net/rtsock.c:1.156 --- src/sys/net/rtsock.c:1.155 Wed Jul 9 14:41:42 2014 +++ src/sys/net/rtsock.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rtsock.c,v 1.155 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: rtsock.c,v 1.156 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -61,7 +61,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.155 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.156 2014/07/23 13:17:18 rtr Exp $"); #ifdef _KERNEL_OPT #include "opt_inet.h" @@ -281,6 +281,26 @@ COMPATNAME(route_sockaddr)(struct socket } static int +COMPATNAME(route_recvoob)(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +COMPATNAME(route_sendoob)(struct socket *so, struct mbuf *m, + struct mbuf *control) +{ + KASSERT(solocked(so)); + + m_freem(m); + m_freem(control); + + return EOPNOTSUPP; +} + +static int COMPATNAME(route_usrreq)(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { @@ -293,6 +313,8 @@ COMPATNAME(route_usrreq)(struct socket * KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); s = splsoftnet(); error = raw_usrreq(so, req, m, nam, control, l); @@ -1394,6 +1416,8 @@ static const struct pr_usrreqs route_usr .pr_stat = COMPATNAME(route_stat_wrapper), .pr_peeraddr = COMPATNAME(route_peeraddr_wrapper), .pr_sockaddr = COMPATNAME(route_sockaddr_wrapper), + .pr_recvoob = COMPATNAME(route_recvoob_wrapper), + .pr_sendoob = COMPATNAME(route_sendoob_wrapper), .pr_generic = COMPATNAME(route_usrreq_wrapper), }; Index: src/sys/netatalk/ddp_usrreq.c diff -u src/sys/netatalk/ddp_usrreq.c:1.53 src/sys/netatalk/ddp_usrreq.c:1.54 --- src/sys/netatalk/ddp_usrreq.c:1.53 Wed Jul 9 14:41:42 2014 +++ src/sys/netatalk/ddp_usrreq.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: ddp_usrreq.c,v 1.53 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: ddp_usrreq.c,v 1.54 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (c) 1990,1991 Regents of The University of Michigan. @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.53 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.54 2014/07/23 13:17:18 rtr Exp $"); #include "opt_mbuftrace.h" @@ -89,6 +89,8 @@ ddp_usrreq(struct socket *so, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); ddp = sotoddpcb(so); @@ -171,7 +173,6 @@ ddp_usrreq(struct socket *so, int req, s case PRU_LISTEN: case PRU_CONNECT2: - case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: case PRU_PROTORCV: @@ -180,7 +181,6 @@ ddp_usrreq(struct socket *so, int req, s break; case PRU_RCVD: - case PRU_RCVOOB: /* * Don't mfree. Good architecture... */ @@ -512,6 +512,25 @@ ddp_sockaddr(struct socket *so, struct m return 0; } +static int +ddp_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +ddp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + + return EOPNOTSUPP; +} + /* * For the moment, this just find the pcb with the correct local address. * In the future, this will actually do some real searching, so we can use @@ -590,6 +609,8 @@ PR_WRAP_USRREQS(ddp) #define ddp_stat ddp_stat_wrapper #define ddp_peeraddr ddp_peeraddr_wrapper #define ddp_sockaddr ddp_sockaddr_wrapper +#define ddp_recvoob ddp_recvoob_wrapper +#define ddp_sendoob ddp_sendoob_wrapper #define ddp_usrreq ddp_usrreq_wrapper const struct pr_usrreqs ddp_usrreqs = { @@ -600,6 +621,8 @@ const struct pr_usrreqs ddp_usrreqs = { .pr_stat = ddp_stat, .pr_peeraddr = ddp_peeraddr, .pr_sockaddr = ddp_sockaddr, + .pr_recvoob = ddp_recvoob, + .pr_sendoob = ddp_sendoob, .pr_generic = ddp_usrreq, }; Index: src/sys/netbt/hci_socket.c diff -u src/sys/netbt/hci_socket.c:1.32 src/sys/netbt/hci_socket.c:1.33 --- src/sys/netbt/hci_socket.c:1.32 Wed Jul 9 14:41:42 2014 +++ src/sys/netbt/hci_socket.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: hci_socket.c,v 1.32 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: hci_socket.c,v 1.33 2014/07/23 13:17:18 rtr Exp $ */ /*- * Copyright (c) 2005 Iain Hibbert. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.32 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.33 2014/07/23 13:17:18 rtr Exp $"); /* load symbolic names */ #ifdef BLUETOOTH_DEBUG @@ -547,6 +547,27 @@ hci_sockaddr(struct socket *so, struct m return 0; } +static int +hci_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +hci_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + if (control) + m_freem(control); + + return EOPNOTSUPP; +} + /* * User Request. * up is socket @@ -573,6 +594,8 @@ hci_usrreq(struct socket *up, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); switch(req) { case PRU_PURGEIF: @@ -665,12 +688,10 @@ hci_usrreq(struct socket *up, int req, s return hci_send(pcb, m, (sa ? &sa->bt_bdaddr : &pcb->hp_raddr)); case PRU_RCVD: - case PRU_RCVOOB: return EOPNOTSUPP; /* (no release) */ case PRU_CONNECT2: case PRU_LISTEN: - case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: case PRU_PROTORCV: @@ -905,6 +926,8 @@ PR_WRAP_USRREQS(hci) #define hci_stat hci_stat_wrapper #define hci_peeraddr hci_peeraddr_wrapper #define hci_sockaddr hci_sockaddr_wrapper +#define hci_recvoob hci_recvoob_wrapper +#define hci_sendoob hci_sendoob_wrapper #define hci_usrreq hci_usrreq_wrapper const struct pr_usrreqs hci_usrreqs = { @@ -915,5 +938,7 @@ const struct pr_usrreqs hci_usrreqs = { .pr_stat = hci_stat, .pr_peeraddr = hci_peeraddr, .pr_sockaddr = hci_sockaddr, + .pr_recvoob = hci_recvoob, + .pr_sendoob = hci_sendoob, .pr_generic = hci_usrreq, }; Index: src/sys/netbt/l2cap_socket.c diff -u src/sys/netbt/l2cap_socket.c:1.23 src/sys/netbt/l2cap_socket.c:1.24 --- src/sys/netbt/l2cap_socket.c:1.23 Wed Jul 9 14:41:42 2014 +++ src/sys/netbt/l2cap_socket.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: l2cap_socket.c,v 1.23 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: l2cap_socket.c,v 1.24 2014/07/23 13:17:18 rtr Exp $ */ /*- * Copyright (c) 2005 Iain Hibbert. @@ -31,7 +31,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.23 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.24 2014/07/23 13:17:18 rtr Exp $"); /* load symbolic names */ #ifdef BLUETOOTH_DEBUG @@ -177,6 +177,27 @@ l2cap_sockaddr(struct socket *so, struct return l2cap_sockaddr_pcb(pcb, sa); } +static int +l2cap_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +l2cap_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + if (control) + m_freem(control); + + return EOPNOTSUPP; +} + /* * User Request. * up is socket @@ -209,6 +230,8 @@ l2cap_usrreq(struct socket *up, int req, KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); switch (req) { case PRU_PURGEIF: @@ -283,14 +306,12 @@ l2cap_usrreq(struct socket *up, int req, return l2cap_send(pcb, m0); case PRU_RCVD: - case PRU_RCVOOB: return EOPNOTSUPP; /* (no release) */ case PRU_LISTEN: return l2cap_listen(pcb); case PRU_CONNECT2: - case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: case PRU_PROTORCV: @@ -459,6 +480,8 @@ PR_WRAP_USRREQS(l2cap) #define l2cap_stat l2cap_stat_wrapper #define l2cap_peeraddr l2cap_peeraddr_wrapper #define l2cap_sockaddr l2cap_sockaddr_wrapper +#define l2cap_recvoob l2cap_recvoob_wrapper +#define l2cap_sendoob l2cap_sendoob_wrapper #define l2cap_usrreq l2cap_usrreq_wrapper const struct pr_usrreqs l2cap_usrreqs = { @@ -469,5 +492,7 @@ const struct pr_usrreqs l2cap_usrreqs = .pr_stat = l2cap_stat, .pr_peeraddr = l2cap_peeraddr, .pr_sockaddr = l2cap_sockaddr, + .pr_recvoob = l2cap_recvoob, + .pr_sendoob = l2cap_sendoob, .pr_generic = l2cap_usrreq, }; Index: src/sys/netbt/rfcomm_socket.c diff -u src/sys/netbt/rfcomm_socket.c:1.24 src/sys/netbt/rfcomm_socket.c:1.25 --- src/sys/netbt/rfcomm_socket.c:1.24 Wed Jul 9 14:41:42 2014 +++ src/sys/netbt/rfcomm_socket.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: rfcomm_socket.c,v 1.24 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: rfcomm_socket.c,v 1.25 2014/07/23 13:17:18 rtr Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.24 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.25 2014/07/23 13:17:18 rtr Exp $"); /* load symbolic names */ #ifdef BLUETOOTH_DEBUG @@ -185,6 +185,27 @@ rfcomm_sockaddr(struct socket *so, struc return rfcomm_sockaddr_pcb(pcb, sa); } +static int +rfcomm_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +rfcomm_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + if (control) + m_freem(control); + + return EOPNOTSUPP; +} + /* * User Request. * up is socket @@ -217,6 +238,8 @@ rfcomm_usrreq(struct socket *up, int req KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); switch (req) { case PRU_PURGEIF: @@ -284,14 +307,10 @@ rfcomm_usrreq(struct socket *up, int req case PRU_RCVD: return rfcomm_rcvd(pcb, sbspace(&up->so_rcv)); - case PRU_RCVOOB: - return EOPNOTSUPP; /* (no release) */ - case PRU_LISTEN: return rfcomm_listen(pcb); case PRU_CONNECT2: - case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: case PRU_PROTORCV: @@ -472,6 +491,8 @@ PR_WRAP_USRREQS(rfcomm) #define rfcomm_stat rfcomm_stat_wrapper #define rfcomm_peeraddr rfcomm_peeraddr_wrapper #define rfcomm_sockaddr rfcomm_sockaddr_wrapper +#define rfcomm_recvoob rfcomm_recvoob_wrapper +#define rfcomm_sendoob rfcomm_sendoob_wrapper #define rfcomm_usrreq rfcomm_usrreq_wrapper const struct pr_usrreqs rfcomm_usrreqs = { @@ -482,5 +503,7 @@ const struct pr_usrreqs rfcomm_usrreqs = .pr_stat = rfcomm_stat, .pr_peeraddr = rfcomm_peeraddr, .pr_sockaddr = rfcomm_sockaddr, + .pr_recvoob = rfcomm_recvoob, + .pr_sendoob = rfcomm_sendoob, .pr_generic = rfcomm_usrreq, }; Index: src/sys/netbt/sco_socket.c diff -u src/sys/netbt/sco_socket.c:1.25 src/sys/netbt/sco_socket.c:1.26 --- src/sys/netbt/sco_socket.c:1.25 Wed Jul 9 14:41:42 2014 +++ src/sys/netbt/sco_socket.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sco_socket.c,v 1.25 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: sco_socket.c,v 1.26 2014/07/23 13:17:18 rtr Exp $ */ /*- * Copyright (c) 2006 Itronix Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.25 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.26 2014/07/23 13:17:18 rtr Exp $"); /* load symbolic names */ #ifdef BLUETOOTH_DEBUG @@ -168,6 +168,27 @@ sco_sockaddr(struct socket *so, struct m return sco_sockaddr_pcb(pcb, sa); } +static int +sco_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +sco_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + if (control) + m_freem(control); + + return EOPNOTSUPP; +} + /* * User Request. * up is socket @@ -196,6 +217,8 @@ sco_usrreq(struct socket *up, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); switch(req) { case PRU_PURGEIF: @@ -271,14 +294,12 @@ sco_usrreq(struct socket *up, int req, s return sco_send(pcb, m0); case PRU_RCVD: - case PRU_RCVOOB: return EOPNOTSUPP; /* (no release) */ case PRU_LISTEN: return sco_listen(pcb); case PRU_CONNECT2: - case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: case PRU_PROTORCV: @@ -426,6 +447,8 @@ PR_WRAP_USRREQS(sco) #define sco_stat sco_stat_wrapper #define sco_peeraddr sco_peeraddr_wrapper #define sco_sockaddr sco_sockaddr_wrapper +#define sco_recvoob sco_recvoob_wrapper +#define sco_sendoob sco_sendoob_wrapper #define sco_usrreq sco_usrreq_wrapper const struct pr_usrreqs sco_usrreqs = { @@ -436,5 +459,7 @@ const struct pr_usrreqs sco_usrreqs = { .pr_stat = sco_stat, .pr_peeraddr = sco_peeraddr, .pr_sockaddr = sco_sockaddr, + .pr_recvoob = sco_recvoob, + .pr_sendoob = sco_sendoob, .pr_generic = sco_usrreq, }; Index: src/sys/netinet/raw_ip.c diff -u src/sys/netinet/raw_ip.c:1.134 src/sys/netinet/raw_ip.c:1.135 --- src/sys/netinet/raw_ip.c:1.134 Mon Jul 14 13:39:18 2014 +++ src/sys/netinet/raw_ip.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip.c,v 1.134 2014/07/14 13:39:18 rtr Exp $ */ +/* $NetBSD: raw_ip.c,v 1.135 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -65,7 +65,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.134 2014/07/14 13:39:18 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.135 2014/07/23 13:17:18 rtr Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -613,6 +613,25 @@ rip_sockaddr(struct socket *so, struct m return 0; } +static int +rip_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +rip_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + m_freem(m); + m_freem(control); + + return EOPNOTSUPP; +} + int rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) @@ -627,6 +646,8 @@ rip_usrreq(struct socket *so, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); s = splsoftnet(); if (req == PRU_PURGEIF) { @@ -720,16 +741,6 @@ rip_usrreq(struct socket *so, int req, s } break; - case PRU_RCVOOB: - error = EOPNOTSUPP; - break; - - case PRU_SENDOOB: - m_freem(control); - m_freem(m); - error = EOPNOTSUPP; - break; - default: panic("rip_usrreq"); } @@ -746,6 +757,8 @@ PR_WRAP_USRREQS(rip) #define rip_stat rip_stat_wrapper #define rip_peeraddr rip_peeraddr_wrapper #define rip_sockaddr rip_sockaddr_wrapper +#define rip_recvoob rip_recvoob_wrapper +#define rip_sendoob rip_sendoob_wrapper #define rip_usrreq rip_usrreq_wrapper const struct pr_usrreqs rip_usrreqs = { @@ -756,6 +769,8 @@ const struct pr_usrreqs rip_usrreqs = { .pr_stat = rip_stat, .pr_peeraddr = rip_peeraddr, .pr_sockaddr = rip_sockaddr, + .pr_recvoob = rip_recvoob, + .pr_sendoob = rip_sendoob, .pr_generic = rip_usrreq, }; Index: src/sys/netinet/tcp_usrreq.c diff -u src/sys/netinet/tcp_usrreq.c:1.188 src/sys/netinet/tcp_usrreq.c:1.189 --- src/sys/netinet/tcp_usrreq.c:1.188 Mon Jul 14 13:20:41 2014 +++ src/sys/netinet/tcp_usrreq.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: tcp_usrreq.c,v 1.188 2014/07/14 13:20:41 rtr Exp $ */ +/* $NetBSD: tcp_usrreq.c,v 1.189 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -99,7 +99,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.188 2014/07/14 13:20:41 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.189 2014/07/23 13:17:18 rtr Exp $"); #include "opt_inet.h" #include "opt_ipsec.h" @@ -203,6 +203,8 @@ tcp_usrreq(struct socket *so, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); family = so->so_proto->pr_domain->dom_family; @@ -256,7 +258,7 @@ tcp_usrreq(struct socket *so, int req, s splx(s); return EAFNOSUPPORT; } - KASSERT(!control || (req == PRU_SEND || req == PRU_SENDOOB)); + KASSERT(!control || req == PRU_SEND); #ifdef INET6 /* XXX: KASSERT((inp != NULL) ^ (in6p != NULL)); */ #endif @@ -472,45 +474,6 @@ tcp_usrreq(struct socket *so, int req, s tp = tcp_drop(tp, ECONNABORTED); 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, char *) = tp->t_iobc; - if (((long)nam & MSG_PEEK) == 0) - tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA); - break; - - case PRU_SENDOOB: - if (sbspace(&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_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; - default: panic("tcp_usrreq"); } @@ -1098,6 +1061,139 @@ tcp_sockaddr(struct socket *so, struct m return 0; } +static int +tcp_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + struct inpcb *inp = NULL; +#ifdef INET6 + struct in6pcb *in6p = NULL; +#endif + struct tcpcb *tp = NULL; + int ostate = 0; + + switch (so->so_proto->pr_domain->dom_family) { +#ifdef INET + case PF_INET: + inp = sotoinpcb(so); + break; +#endif +#ifdef INET6 + case PF_INET6: + in6p = sotoin6pcb(so); + break; +#endif + default: + return EAFNOSUPPORT; + } + + if (inp == NULL +#ifdef INET6 + && in6p == NULL +#endif + ) + return EINVAL; + +#ifdef INET + if (inp) { + tp = intotcpcb(inp); + ostate = tcp_debug_capture(tp, PRU_RCVOOB); + } +#endif +#ifdef INET6 + if (in6p) { + tp = in6totcpcb(in6p); + ostate = tcp_debug_capture(tp, PRU_RCVOOB); + } +#endif + + if ((so->so_oobmark == 0 && + (so->so_state & SS_RCVATMARK) == 0) || + so->so_options & SO_OOBINLINE || + tp->t_oobflags & TCPOOB_HADDATA) + return EINVAL; + + if ((tp->t_oobflags & TCPOOB_HAVEDATA) == 0) + return EWOULDBLOCK; + + m->m_len = 1; + *mtod(m, char *) = tp->t_iobc; + if ((flags & MSG_PEEK) == 0) + tp->t_oobflags ^= (TCPOOB_HAVEDATA | TCPOOB_HADDATA); + + tcp_debug_trace(so, tp, ostate, PRU_RCVOOB); + + return 0; +} + +static int +tcp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + struct inpcb *inp = NULL; +#ifdef INET6 + struct in6pcb *in6p = NULL; +#endif + struct tcpcb *tp = NULL; + int ostate = 0; + int error = 0; + + switch (so->so_proto->pr_domain->dom_family) { +#ifdef INET + case PF_INET: + inp = sotoinpcb(so); + break; +#endif +#ifdef INET6 + case PF_INET6: + in6p = sotoin6pcb(so); + break; +#endif + default: + return EAFNOSUPPORT; + } + + if (inp == NULL +#ifdef INET6 + && in6p == NULL +#endif + ) + return EINVAL; + +#ifdef INET + if (inp) { + tp = intotcpcb(inp); + ostate = tcp_debug_capture(tp, PRU_SENDOOB); + } +#endif +#ifdef INET6 + if (in6p) { + tp = in6totcpcb(in6p); + ostate = tcp_debug_capture(tp, PRU_SENDOOB); + } +#endif + + if (sbspace(&so->so_snd) < -512) { + m_freem(m); + return ENOBUFS; + } + /* + * 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_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; + + tcp_debug_trace(so, tp, ostate, PRU_SENDOOB); + + return error; +} + /* * Initiate (or continue) disconnect. * If embryonic state, just send reset (once). @@ -2339,6 +2435,8 @@ PR_WRAP_USRREQS(tcp) #define tcp_stat tcp_stat_wrapper #define tcp_peeraddr tcp_peeraddr_wrapper #define tcp_sockaddr tcp_sockaddr_wrapper +#define tcp_recvoob tcp_recvoob_wrapper +#define tcp_sendoob tcp_sendoob_wrapper #define tcp_usrreq tcp_usrreq_wrapper const struct pr_usrreqs tcp_usrreqs = { @@ -2349,5 +2447,7 @@ const struct pr_usrreqs tcp_usrreqs = { .pr_stat = tcp_stat, .pr_peeraddr = tcp_peeraddr, .pr_sockaddr = tcp_sockaddr, + .pr_recvoob = tcp_recvoob, + .pr_sendoob = tcp_sendoob, .pr_generic = tcp_usrreq, }; Index: src/sys/netinet/udp_usrreq.c diff -u src/sys/netinet/udp_usrreq.c:1.208 src/sys/netinet/udp_usrreq.c:1.209 --- src/sys/netinet/udp_usrreq.c:1.208 Wed Jul 9 14:41:42 2014 +++ src/sys/netinet/udp_usrreq.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: udp_usrreq.c,v 1.208 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: udp_usrreq.c,v 1.209 2014/07/23 13:17:18 rtr Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -66,7 +66,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.208 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.209 2014/07/23 13:17:18 rtr Exp $"); #include "opt_inet.h" #include "opt_compat_netbsd.h" @@ -942,6 +942,25 @@ udp_sockaddr(struct socket *so, struct m } static int +udp_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +udp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + m_freem(m); + m_freem(control); + + return EOPNOTSUPP; +} + +static int udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { @@ -955,6 +974,8 @@ udp_usrreq(struct socket *so, int req, s KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); s = splsoftnet(); if (req == PRU_PURGEIF) { @@ -970,7 +991,7 @@ udp_usrreq(struct socket *so, int req, s KASSERT(solocked(so)); inp = sotoinpcb(so); - KASSERT(!control || (req == PRU_SEND || req == PRU_SENDOOB)); + KASSERT(!control || req == PRU_SEND); if (inp == NULL) { splx(s); return EINVAL; @@ -1055,16 +1076,6 @@ udp_usrreq(struct socket *so, int req, s } break; - case PRU_RCVOOB: - error = EOPNOTSUPP; - break; - - case PRU_SENDOOB: - m_freem(control); - m_freem(m); - error = EOPNOTSUPP; - break; - default: panic("udp_usrreq"); } @@ -1298,6 +1309,8 @@ PR_WRAP_USRREQS(udp) #define udp_stat udp_stat_wrapper #define udp_peeraddr udp_peeraddr_wrapper #define udp_sockaddr udp_sockaddr_wrapper +#define udp_recvoob udp_recvoob_wrapper +#define udp_sendoob udp_sendoob_wrapper #define udp_usrreq udp_usrreq_wrapper const struct pr_usrreqs udp_usrreqs = { @@ -1308,5 +1321,7 @@ const struct pr_usrreqs udp_usrreqs = { .pr_stat = udp_stat, .pr_peeraddr = udp_peeraddr, .pr_sockaddr = udp_sockaddr, + .pr_recvoob = udp_recvoob, + .pr_sendoob = udp_sendoob, .pr_generic = udp_usrreq, }; Index: src/sys/netinet6/raw_ip6.c diff -u src/sys/netinet6/raw_ip6.c:1.127 src/sys/netinet6/raw_ip6.c:1.128 --- src/sys/netinet6/raw_ip6.c:1.127 Wed Jul 9 14:41:42 2014 +++ src/sys/netinet6/raw_ip6.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: raw_ip6.c,v 1.127 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: raw_ip6.c,v 1.128 2014/07/23 13:17:18 rtr Exp $ */ /* $KAME: raw_ip6.c,v 1.82 2001/07/23 18:57:56 jinmei Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.127 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.128 2014/07/23 13:17:18 rtr Exp $"); #include "opt_ipsec.h" @@ -689,6 +689,25 @@ rip6_sockaddr(struct socket *so, struct return 0; } +static int +rip6_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +rip6_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + + return EOPNOTSUPP; +} + int rip6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) @@ -701,6 +720,8 @@ rip6_usrreq(struct socket *so, int req, KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); if (req == PRU_PURGEIF) { mutex_enter(softnet_lock); @@ -872,10 +893,8 @@ rip6_usrreq(struct socket *so, int req, /* * Not supported. */ - case PRU_RCVOOB: case PRU_RCVD: case PRU_LISTEN: - case PRU_SENDOOB: error = EOPNOTSUPP; break; @@ -934,6 +953,8 @@ PR_WRAP_USRREQS(rip6) #define rip6_stat rip6_stat_wrapper #define rip6_peeraddr rip6_peeraddr_wrapper #define rip6_sockaddr rip6_sockaddr_wrapper +#define rip6_recvoob rip6_recvoob_wrapper +#define rip6_sendoob rip6_sendoob_wrapper #define rip6_usrreq rip6_usrreq_wrapper const struct pr_usrreqs rip6_usrreqs = { @@ -944,5 +965,7 @@ const struct pr_usrreqs rip6_usrreqs = { .pr_stat = rip6_stat, .pr_peeraddr = rip6_peeraddr, .pr_sockaddr = rip6_sockaddr, + .pr_recvoob = rip6_recvoob, + .pr_sendoob = rip6_sendoob, .pr_generic = rip6_usrreq, }; Index: src/sys/netinet6/udp6_usrreq.c diff -u src/sys/netinet6/udp6_usrreq.c:1.107 src/sys/netinet6/udp6_usrreq.c:1.108 --- src/sys/netinet6/udp6_usrreq.c:1.107 Wed Jul 9 14:41:42 2014 +++ src/sys/netinet6/udp6_usrreq.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: udp6_usrreq.c,v 1.107 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: udp6_usrreq.c,v 1.108 2014/07/23 13:17:18 rtr Exp $ */ /* $KAME: udp6_usrreq.c,v 1.86 2001/05/27 17:33:00 itojun Exp $ */ /* @@ -62,7 +62,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.107 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.108 2014/07/23 13:17:18 rtr Exp $"); #include "opt_inet.h" #include "opt_inet_csum.h" @@ -732,6 +732,27 @@ udp6_sockaddr(struct socket *so, struct return 0; } +static int +udp6_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +udp6_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + if (m) + m_freem(m); + if (control) + m_freem(control); + + return EOPNOTSUPP; +} + int udp6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr6, struct mbuf *control, struct lwp *l) @@ -746,6 +767,8 @@ udp6_usrreq(struct socket *so, int req, KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); if (req == PRU_PURGEIF) { mutex_enter(softnet_lock); @@ -810,7 +833,6 @@ udp6_usrreq(struct socket *so, int req, case PRU_LISTEN: case PRU_CONNECT2: - case PRU_SENDOOB: case PRU_FASTTIMO: case PRU_SLOWTIMO: case PRU_PROTORCV: @@ -819,7 +841,6 @@ udp6_usrreq(struct socket *so, int req, break; case PRU_RCVD: - case PRU_RCVOOB: return EOPNOTSUPP; /* do not free mbuf's */ default: @@ -910,6 +931,8 @@ PR_WRAP_USRREQS(udp6) #define udp6_stat udp6_stat_wrapper #define udp6_peeraddr udp6_peeraddr_wrapper #define udp6_sockaddr udp6_sockaddr_wrapper +#define udp6_recvoob udp6_recvoob_wrapper +#define udp6_sendoob udp6_sendoob_wrapper #define udp6_usrreq udp6_usrreq_wrapper const struct pr_usrreqs udp6_usrreqs = { @@ -920,5 +943,7 @@ const struct pr_usrreqs udp6_usrreqs = { .pr_stat = udp6_stat, .pr_peeraddr = udp6_peeraddr, .pr_sockaddr = udp6_sockaddr, + .pr_recvoob = udp6_recvoob, + .pr_sendoob = udp6_sendoob, .pr_generic = udp6_usrreq, }; Index: src/sys/netipsec/keysock.c diff -u src/sys/netipsec/keysock.c:1.35 src/sys/netipsec/keysock.c:1.36 --- src/sys/netipsec/keysock.c:1.35 Wed Jul 9 14:41:42 2014 +++ src/sys/netipsec/keysock.c Wed Jul 23 13:17:18 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: keysock.c,v 1.35 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: keysock.c,v 1.36 2014/07/23 13:17:18 rtr Exp $ */ /* $FreeBSD: src/sys/netipsec/keysock.c,v 1.3.2.1 2003/01/24 05:11:36 sam Exp $ */ /* $KAME: keysock.c,v 1.25 2001/08/13 20:07:41 itojun Exp $ */ @@ -32,7 +32,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.35 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.36 2014/07/23 13:17:18 rtr Exp $"); #include "opt_ipsec.h" @@ -540,6 +540,25 @@ key_sockaddr(struct socket *so, struct m return 0; } +static int +key_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +key_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + m_freem(m); + m_freem(control); + + return EOPNOTSUPP; +} + /* * key_usrreq() * derived from net/rtsock.c:route_usrreq() @@ -557,6 +576,8 @@ key_usrreq(struct socket *so, int req,st KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); s = splsoftnet(); error = raw_usrreq(so, req, m, nam, control, l); @@ -580,6 +601,8 @@ PR_WRAP_USRREQS(key) #define key_stat key_stat_wrapper #define key_peeraddr key_peeraddr_wrapper #define key_sockaddr key_sockaddr_wrapper +#define key_recvoob key_recvoob_wrapper +#define key_sendoob key_sendoob_wrapper #define key_usrreq key_usrreq_wrapper const struct pr_usrreqs key_usrreqs = { @@ -590,6 +613,8 @@ const struct pr_usrreqs key_usrreqs = { .pr_stat = key_stat, .pr_peeraddr = key_peeraddr, .pr_sockaddr = key_sockaddr, + .pr_recvoob = key_recvoob, + .pr_sendoob = key_sendoob, .pr_generic = key_usrreq, }; Index: src/sys/netmpls/mpls_proto.c diff -u src/sys/netmpls/mpls_proto.c:1.15 src/sys/netmpls/mpls_proto.c:1.16 --- src/sys/netmpls/mpls_proto.c:1.15 Wed Jul 9 14:41:42 2014 +++ src/sys/netmpls/mpls_proto.c Wed Jul 23 13:17:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: mpls_proto.c,v 1.15 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: mpls_proto.c,v 1.16 2014/07/23 13:17:19 rtr Exp $ */ /* * Copyright (c) 2010 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mpls_proto.c,v 1.15 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mpls_proto.c,v 1.16 2014/07/23 13:17:19 rtr Exp $"); #include "opt_inet.h" #include "opt_mbuftrace.h" @@ -133,6 +133,22 @@ mpls_sockaddr(struct socket *so, struct } static int +mpls_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +mpls_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int mpls_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { @@ -228,6 +244,8 @@ PR_WRAP_USRREQS(mpls) #define mpls_stat mpls_stat_wrapper #define mpls_peeraddr mpls_peeraddr_wrapper #define mpls_sockaddr mpls_sockaddr_wrapper +#define mpls_recvoob mpls_recvoob_wrapper +#define mpls_sendoob mpls_sendoob_wrapper #define mpls_usrreq mpls_usrreq_wrapper static const struct pr_usrreqs mpls_usrreqs = { @@ -238,6 +256,8 @@ static const struct pr_usrreqs mpls_usrr .pr_stat = mpls_stat, .pr_peeraddr = mpls_peeraddr, .pr_sockaddr = mpls_sockaddr, + .pr_recvoob = mpls_recvoob, + .pr_sendoob = mpls_sendoob, .pr_generic = mpls_usrreq, }; Index: src/sys/netnatm/natm.c diff -u src/sys/netnatm/natm.c:1.37 src/sys/netnatm/natm.c:1.38 --- src/sys/netnatm/natm.c:1.37 Wed Jul 9 14:41:42 2014 +++ src/sys/netnatm/natm.c Wed Jul 23 13:17:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: natm.c,v 1.37 2014/07/09 14:41:42 rtr Exp $ */ +/* $NetBSD: natm.c,v 1.38 2014/07/23 13:17:19 rtr Exp $ */ /* * Copyright (c) 1996 Charles D. Cranor and Washington University. @@ -30,7 +30,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.37 2014/07/09 14:41:42 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.38 2014/07/23 13:17:19 rtr Exp $"); #include <sys/param.h> #include <sys/kmem.h> @@ -181,6 +181,22 @@ natm_sockaddr(struct socket *so, struct return EOPNOTSUPP; } +static int +natm_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + +static int +natm_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + KASSERT(solocked(so)); + + return EOPNOTSUPP; +} + /* * user requests */ @@ -204,6 +220,8 @@ natm_usrreq(struct socket *so, int req, KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); s = SPLSOFTNET(); @@ -348,8 +366,6 @@ natm_usrreq(struct socket *so, int req, case PRU_RCVD: /* have taken data; more room now */ case PRU_FASTTIMO: /* 200ms timeout */ case PRU_SLOWTIMO: /* 500ms timeout */ - case PRU_RCVOOB: /* retrieve out of band data */ - case PRU_SENDOOB: /* send out of band data */ case PRU_PROTORCV: /* receive from below */ case PRU_PROTOSEND: /* send to below */ #ifdef DIAGNOSTIC @@ -452,6 +468,8 @@ PR_WRAP_USRREQS(natm) #define natm_stat natm_stat_wrapper #define natm_peeraddr natm_peeraddr_wrapper #define natm_sockaddr natm_sockaddr_wrapper +#define natm_recvoob natm_recvoob_wrapper +#define natm_sendoob natm_sendoob_wrapper #define natm_usrreq natm_usrreq_wrapper const struct pr_usrreqs natm_usrreqs = { @@ -462,5 +480,7 @@ const struct pr_usrreqs natm_usrreqs = { .pr_stat = natm_stat, .pr_peeraddr = natm_peeraddr, .pr_sockaddr = natm_sockaddr, + .pr_recvoob = natm_recvoob, + .pr_sendoob = natm_sendoob, .pr_generic = natm_usrreq, }; Index: src/sys/rump/net/lib/libsockin/sockin.c diff -u src/sys/rump/net/lib/libsockin/sockin.c:1.49 src/sys/rump/net/lib/libsockin/sockin.c:1.50 --- src/sys/rump/net/lib/libsockin/sockin.c:1.49 Wed Jul 9 15:37:55 2014 +++ src/sys/rump/net/lib/libsockin/sockin.c Wed Jul 23 13:17:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: sockin.c,v 1.49 2014/07/09 15:37:55 rtr Exp $ */ +/* $NetBSD: sockin.c,v 1.50 2014/07/23 13:17:19 rtr Exp $ */ /* * Copyright (c) 2008, 2009 Antti Kantee. All Rights Reserved. @@ -26,7 +26,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.49 2014/07/09 15:37:55 rtr Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.50 2014/07/23 13:17:19 rtr Exp $"); #include <sys/param.h> #include <sys/condvar.h> @@ -73,6 +73,8 @@ static int sockin_ioctl(struct socket *, static int sockin_stat(struct socket *, struct stat *); static int sockin_peeraddr(struct socket *, struct mbuf *); static int sockin_sockaddr(struct socket *, struct mbuf *); +static int sockin_recvoob(struct socket *, struct mbuf *, int); +static int sockin_sendoob(struct socket *, struct mbuf *, struct mbuf *); static int sockin_usrreq(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); static int sockin_ctloutput(int op, struct socket *, struct sockopt *); @@ -85,6 +87,8 @@ static const struct pr_usrreqs sockin_us .pr_stat = sockin_stat, .pr_peeraddr = sockin_peeraddr, .pr_sockaddr = sockin_sockaddr, + .pr_recvoob = sockin_recvoob, + .pr_sendoob = sockin_sendoob, .pr_generic = sockin_usrreq, }; @@ -513,6 +517,18 @@ sockin_sockaddr(struct socket *so, struc } static int +sockin_recvoob(struct socket *so, struct mbuf *m, int flags) +{ + panic("sockin_recvoob: IMPLEMENT ME, recvoob not supported"); +} + +static int +sockin_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control) +{ + panic("sockin_sendoob: IMPLEMENT ME, sendoob not supported"); +} + +static int sockin_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam, struct mbuf *control, struct lwp *l) { @@ -523,6 +539,8 @@ sockin_usrreq(struct socket *so, int req KASSERT(req != PRU_SENSE); KASSERT(req != PRU_PEERADDR); KASSERT(req != PRU_SOCKADDR); + KASSERT(req != PRU_RCVOOB); + KASSERT(req != PRU_SENDOOB); switch (req) { case PRU_BIND: Index: src/sys/sys/protosw.h diff -u src/sys/sys/protosw.h:1.52 src/sys/sys/protosw.h:1.53 --- src/sys/sys/protosw.h:1.52 Wed Jul 9 14:41:43 2014 +++ src/sys/sys/protosw.h Wed Jul 23 13:17:19 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: protosw.h,v 1.52 2014/07/09 14:41:43 rtr Exp $ */ +/* $NetBSD: protosw.h,v 1.53 2014/07/23 13:17:19 rtr Exp $ */ /*- * Copyright (c) 1982, 1986, 1993 @@ -243,6 +243,8 @@ struct pr_usrreqs { int (*pr_stat)(struct socket *, struct stat *); int (*pr_peeraddr)(struct socket *, struct mbuf *); int (*pr_sockaddr)(struct socket *, struct mbuf *); + int (*pr_recvoob)(struct socket *, struct mbuf *, int); + int (*pr_sendoob)(struct socket *, struct mbuf *, struct mbuf *); int (*pr_generic)(struct socket *, int, struct mbuf *, struct mbuf *, struct mbuf *, struct lwp *); }; @@ -341,6 +343,26 @@ name##_sockaddr_wrapper(struct socket *a return rv; \ } \ static int \ +name##_recvoob_wrapper(struct socket *a, \ + struct mbuf *b, int c) \ +{ \ + int rv; \ + KERNEL_LOCK(1, NULL); \ + rv = name##_recvoob(a, b, c); \ + KERNEL_UNLOCK_ONE(NULL); \ + return rv; \ +} \ +static int \ +name##_sendoob_wrapper(struct socket *a, \ + struct mbuf *b, struct mbuf *c) \ +{ \ + int rv; \ + KERNEL_LOCK(1, NULL); \ + rv = name##_sendoob(a, b, c); \ + KERNEL_UNLOCK_ONE(NULL); \ + return rv; \ +} \ +static int \ name##_usrreq_wrapper(struct socket *a, int b, \ struct mbuf *c, struct mbuf *d, struct mbuf *e, \ struct lwp *f) \