split PRU_CONNECT2 & PRU_PURGEIF function out of pr_generic() usrreq

switches and put into separate functions

  - always KASSERT(solocked(so)) even if not implemented
    (for PRU_CONNECT2 only)

  - replace calls to pr_generic() with req = PRU_CONNECT2 with calls to
    pr_connect2()

  - replace calls to pr_generic() with req = PRU_PURGEIF with calls to
    pr_purgeif()

put common code from unp_connect2() (used by unp_connect() into
unp_connect1() and call out to it when needed

patch only briefly reviewed by rmind@
This commit is contained in:
rtr 2014-08-09 05:33:00 +00:00
parent 4bef47b350
commit 8cf67cc6d5
24 changed files with 628 additions and 359 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_socket.c,v 1.233 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: uipc_socket.c,v 1.234 2014/08/09 05:33:00 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.233 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.234 2014/08/09 05:33:00 rtr Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@ -836,8 +836,7 @@ soconnect2(struct socket *so1, struct socket *so2)
{
KASSERT(solocked2(so1, so2));
return (*so1->so_proto->pr_usrreqs->pr_generic)(so1,
PRU_CONNECT2, NULL, (struct mbuf *)so2, NULL, NULL);
return (*so1->so_proto->pr_usrreqs->pr_connect2)(so1, so2);
}
int

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_syscalls.c,v 1.171 2014/07/09 04:54:03 rtr Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.171 2014/07/09 04:54:03 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_syscalls.c,v 1.172 2014/08/09 05:33:00 rtr Exp $");
#include "opt_pipe.h"
@ -1276,7 +1276,7 @@ pipe1(struct lwp *l, register_t *retval, int flags)
wf->f_data = wso;
retval[1] = fd;
solock(wso);
error = unp_connect2(wso, rso, PRU_CONNECT2);
error = unp_connect2(wso, rso);
sounlock(wso);
if (error != 0)
goto free4;

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_usrreq.c,v 1.168 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.169 2014/08/09 05:33:00 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.168 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.169 2014/08/09 05:33:00 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -565,8 +565,6 @@ static int
unp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
struct unpcb *unp;
int error = 0;
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
@ -574,6 +572,7 @@ unp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -585,27 +584,16 @@ unp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
KASSERT(solocked(so));
unp = sotounpcb(so);
KASSERT(!control);
if (unp == NULL) {
error = EINVAL;
goto release;
}
if (sotounpcb(so) == NULL)
return EINVAL;
switch (req) {
case PRU_CONNECT2:
error = unp_connect2(so, (struct socket *)nam, PRU_CONNECT2);
break;
panic("piusrreq");
default:
panic("piusrreq");
}
release:
return (error);
return 0;
}
/*
@ -1088,6 +1076,56 @@ unp_abort(struct socket *so)
return 0;
}
static int
unp_connect1(struct socket *so, struct socket *so2)
{
struct unpcb *unp = sotounpcb(so);
struct unpcb *unp2;
if (so2->so_type != so->so_type)
return EPROTOTYPE;
/*
* All three sockets involved must be locked by same lock:
*
* local endpoint (so)
* remote endpoint (so2)
* queue head (so2->so_head, only if PR_CONNREQUIRED)
*/
KASSERT(solocked2(so, so2));
KASSERT(so->so_head == NULL);
if (so2->so_head != NULL) {
KASSERT(so2->so_lock == uipc_lock);
KASSERT(solocked2(so2, so2->so_head));
}
unp2 = sotounpcb(so2);
unp->unp_conn = unp2;
switch (so->so_type) {
case SOCK_DGRAM:
unp->unp_nextref = unp2->unp_refs;
unp2->unp_refs = unp;
soisconnected(so);
break;
case SOCK_SEQPACKET: /* FALLTHROUGH */
case SOCK_STREAM:
/*
* SOCK_SEQPACKET and SOCK_STREAM cases are handled by callers
* which are unp_connect() or unp_connect2().
*/
break;
default:
panic("unp_connect1");
}
return 0;
}
int
unp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
@ -1182,7 +1220,38 @@ unp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
}
so2 = so3;
}
error = unp_connect2(so, so2, PRU_CONNECT);
error = unp_connect1(so, so2);
if (error) {
sounlock(so);
goto bad;
}
unp2 = sotounpcb(so2);
switch (so->so_type) {
/*
* SOCK_DGRAM and default cases are handled in prior call to
* unp_connect1(), do not add a default case without fixing
* unp_connect1().
*/
case SOCK_SEQPACKET: /* FALLTHROUGH */
case SOCK_STREAM:
unp2->unp_conn = unp;
if ((unp->unp_flags | unp2->unp_flags) & UNP_CONNWAIT)
soisconnecting(so);
else
soisconnected(so);
soisconnected(so2);
/*
* If the connection is fully established, break the
* association with uipc_lock and give the connected
* pair a seperate lock to share.
*/
KASSERT(so2->so_head != NULL);
unp_setpeerlocks(so, so2);
break;
}
sounlock(so);
bad:
vput(vp);
@ -1194,64 +1263,36 @@ unp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
}
int
unp_connect2(struct socket *so, struct socket *so2, int req)
unp_connect2(struct socket *so, struct socket *so2)
{
struct unpcb *unp = sotounpcb(so);
struct unpcb *unp2;
int error = 0;
if (so2->so_type != so->so_type)
return (EPROTOTYPE);
/*
* All three sockets involved must be locked by same lock:
*
* local endpoint (so)
* remote endpoint (so2)
* queue head (so2->so_head, only if PR_CONNREQUIRED)
*/
KASSERT(solocked2(so, so2));
KASSERT(so->so_head == NULL);
if (so2->so_head != NULL) {
KASSERT(so2->so_lock == uipc_lock);
KASSERT(solocked2(so2, so2->so_head));
}
error = unp_connect1(so, so2);
if (error)
return error;
unp2 = sotounpcb(so2);
unp->unp_conn = unp2;
switch (so->so_type) {
case SOCK_DGRAM:
unp->unp_nextref = unp2->unp_refs;
unp2->unp_refs = unp;
soisconnected(so);
break;
/*
* SOCK_DGRAM and default cases are handled in prior call to
* unp_connect1(), do not add a default case without fixing
* unp_connect1().
*/
case SOCK_SEQPACKET: /* FALLTHROUGH */
case SOCK_STREAM:
unp2->unp_conn = unp;
if (req == PRU_CONNECT &&
((unp->unp_flags | unp2->unp_flags) & UNP_CONNWAIT))
soisconnecting(so);
else
soisconnected(so);
soisconnected(so);
soisconnected(so2);
/*
* If the connection is fully established, break the
* association with uipc_lock and give the connected
* pair a seperate lock to share. For CONNECT2, we
* require that the locks already match (the sockets
* are created that way).
*/
if (req == PRU_CONNECT) {
KASSERT(so2->so_head != NULL);
unp_setpeerlocks(so, so2);
}
break;
default:
panic("unp_connect2");
}
return (0);
return error;
}
static void
@ -1928,6 +1969,7 @@ const struct pr_usrreqs unp_usrreqs = {
.pr_bind = unp_bind,
.pr_listen = unp_listen,
.pr_connect = unp_connect,
.pr_connect2 = unp_connect2,
.pr_disconnect = unp_disconnect,
.pr_shutdown = unp_shutdown,
.pr_abort = unp_abort,

View File

@ -1,4 +1,4 @@
/* $NetBSD: fifo_vnops.c,v 1.76 2014/07/25 08:20:52 dholland Exp $ */
/* $NetBSD: fifo_vnops.c,v 1.77 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.76 2014/07/25 08:20:52 dholland Exp $");
__KERNEL_RCSID(0, "$NetBSD: fifo_vnops.c,v 1.77 2014/08/09 05:33:01 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -149,7 +149,7 @@ fifo_open(void *v)
}
fip->fi_writesock = wso;
solock(wso);
if ((error = unp_connect2(wso, rso, PRU_CONNECT2)) != 0) {
if ((error = unp_connect2(wso, rso)) != 0) {
sounlock(wso);
(void)soclose(wso);
(void)soclose(rso);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.289 2014/07/31 06:35:47 ozaki-r Exp $ */
/* $NetBSD: if.c,v 1.290 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.289 2014/07/31 06:35:47 ozaki-r Exp $");
__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.290 2014/08/09 05:33:01 rtr Exp $");
#include "opt_inet.h"
@ -800,9 +800,7 @@ again:
pr < dp->dom_protoswNPROTOSW; pr++) {
so.so_proto = pr;
if (pr->pr_usrreqs) {
(void) (*pr->pr_usrreqs->pr_generic)(&so,
PRU_PURGEIF, NULL, NULL,
(struct mbuf *) ifp, curlwp);
(void) (*pr->pr_usrreqs->pr_purgeif)(&so, ifp);
purged = 1;
}
}
@ -852,9 +850,7 @@ again:
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++) {
so.so_proto = pr;
if (pr->pr_usrreqs && pr->pr_flags & PR_PURGEIF)
(void)(*pr->pr_usrreqs->pr_generic)(&so,
PRU_PURGEIF, NULL, NULL,
(struct mbuf *)ifp, curlwp);
(void)(*pr->pr_usrreqs->pr_purgeif)(&so, ifp);
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: link_proto.c,v 1.23 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: link_proto.c,v 1.24 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.23 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.24 2014/08/09 05:33:01 rtr Exp $");
#include <sys/param.h>
#include <sys/socket.h>
@ -54,6 +54,7 @@ static int link_accept(struct socket *, struct mbuf *);
static int link_bind(struct socket *, struct mbuf *, struct lwp *);
static int link_listen(struct socket *, struct lwp *);
static int link_connect(struct socket *, struct mbuf *, struct lwp *);
static int link_connect2(struct socket *, struct socket *);
static int link_disconnect(struct socket *);
static int link_shutdown(struct socket *);
static int link_abort(struct socket *);
@ -66,6 +67,7 @@ static int link_recvoob(struct socket *, struct mbuf *, int);
static int link_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *);
static int link_sendoob(struct socket *, struct mbuf *, struct mbuf *);
static int link_purgeif(struct socket *, struct ifnet *);
static int link_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *);
static void link_init(void);
@ -83,6 +85,7 @@ static const struct pr_usrreqs link_usrreqs = {
.pr_bind = link_bind,
.pr_listen = link_listen,
.pr_connect = link_connect,
.pr_connect2 = link_connect2,
.pr_disconnect = link_disconnect,
.pr_shutdown = link_shutdown,
.pr_abort = link_abort,
@ -94,6 +97,7 @@ static const struct pr_usrreqs link_usrreqs = {
.pr_recvoob = link_recvoob,
.pr_send = link_send,
.pr_sendoob = link_sendoob,
.pr_purgeif = link_purgeif,
.pr_generic = link_usrreq,
};
@ -293,6 +297,14 @@ link_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return EOPNOTSUPP;
}
static int
link_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
link_disconnect(struct socket *so)
{
@ -380,6 +392,13 @@ link_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
link_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
static int
link_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
@ -390,6 +409,7 @@ link_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -401,6 +421,7 @@ link_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
return EOPNOTSUPP;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_usrreq.c,v 1.51 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: raw_usrreq.c,v 1.52 2014/08/09 05:33:01 rtr Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.51 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.52 2014/08/09 05:33:01 rtr Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@ -199,8 +199,6 @@ int
raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
struct rawcb *rp = sotorawcb(so);
int s, error = 0;
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
@ -208,6 +206,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -219,33 +218,12 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
s = splsoftnet();
KERNEL_LOCK(1, NULL);
if (sotorawcb(so) == NULL)
return EINVAL;
KASSERT(!control);
if (rp == NULL) {
error = EINVAL;
goto release;
}
panic("raw_usrreq");
switch (req) {
/*
* If a socket isn't bound to a single address,
* the raw input routine will hand it anything
* within that protocol family (assuming there's
* nothing else around it should go to).
*/
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
default:
panic("raw_usrreq");
}
release:
KERNEL_UNLOCK_ONE(NULL);
splx(s);
return (error);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsock.c,v 1.162 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: rtsock.c,v 1.163 2014/08/09 05:33:01 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.162 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.163 2014/08/09 05:33:01 rtr Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -257,6 +257,14 @@ COMPATNAME(route_connect)(struct socket *so, struct mbuf *nam, struct lwp *l)
return EOPNOTSUPP;
}
static int
COMPATNAME(route_connect2)(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
COMPATNAME(route_disconnect)(struct socket *so)
{
@ -390,6 +398,14 @@ COMPATNAME(route_sendoob)(struct socket *so, struct mbuf *m,
return EOPNOTSUPP;
}
static int
COMPATNAME(route_purgeif)(struct socket *so, struct ifnet *ifp)
{
panic("route_purgeif");
return EOPNOTSUPP;
}
static int
COMPATNAME(route_usrreq)(struct socket *so, int req, struct mbuf *m,
@ -403,6 +419,7 @@ COMPATNAME(route_usrreq)(struct socket *so, int req, struct mbuf *m,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -414,6 +431,7 @@ COMPATNAME(route_usrreq)(struct socket *so, int req, struct mbuf *m,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
s = splsoftnet();
error = raw_usrreq(so, req, m, nam, control, l);
@ -1514,6 +1532,7 @@ static const struct pr_usrreqs route_usrreqs = {
.pr_bind = COMPATNAME(route_bind_wrapper),
.pr_listen = COMPATNAME(route_listen_wrapper),
.pr_connect = COMPATNAME(route_connect_wrapper),
.pr_connect2 = COMPATNAME(route_connect2_wrapper),
.pr_disconnect = COMPATNAME(route_disconnect_wrapper),
.pr_shutdown = COMPATNAME(route_shutdown_wrapper),
.pr_abort = COMPATNAME(route_abort_wrapper),
@ -1525,6 +1544,7 @@ static const struct pr_usrreqs route_usrreqs = {
.pr_recvoob = COMPATNAME(route_recvoob_wrapper),
.pr_send = COMPATNAME(route_send_wrapper),
.pr_sendoob = COMPATNAME(route_sendoob_wrapper),
.pr_purgeif = COMPATNAME(route_purgeif_wrapper),
.pr_generic = COMPATNAME(route_usrreq_wrapper),
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: ddp_usrreq.c,v 1.62 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: ddp_usrreq.c,v 1.63 2014/08/09 05:33:01 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.62 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.63 2014/08/09 05:33:01 rtr Exp $");
#include "opt_mbuftrace.h"
@ -88,6 +88,7 @@ ddp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -99,15 +100,10 @@ ddp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
ddp = sotoddpcb(so);
if (req == PRU_PURGEIF) {
mutex_enter(softnet_lock);
at_purgeif((struct ifnet *) rights);
mutex_exit(softnet_lock);
return (0);
}
if (rights && rights->m_len) {
error = EINVAL;
goto release;
@ -117,7 +113,6 @@ ddp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr,
goto release;
}
switch (req) {
case PRU_CONNECT2:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
@ -453,6 +448,14 @@ ddp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
ddp_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
ddp_disconnect(struct socket *so)
{
@ -584,6 +587,17 @@ ddp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
ddp_purgeif(struct socket *so, struct ifnet *ifp)
{
mutex_enter(softnet_lock);
at_purgeif(ifp);
mutex_exit(softnet_lock);
return 0;
}
/*
* 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
@ -661,6 +675,7 @@ PR_WRAP_USRREQS(ddp)
#define ddp_bind ddp_bind_wrapper
#define ddp_listen ddp_listen_wrapper
#define ddp_connect ddp_connect_wrapper
#define ddp_connect2 ddp_connect2_wrapper
#define ddp_disconnect ddp_disconnect_wrapper
#define ddp_shutdown ddp_shutdown_wrapper
#define ddp_abort ddp_abort_wrapper
@ -672,6 +687,7 @@ PR_WRAP_USRREQS(ddp)
#define ddp_recvoob ddp_recvoob_wrapper
#define ddp_send ddp_send_wrapper
#define ddp_sendoob ddp_sendoob_wrapper
#define ddp_purgeif ddp_purgeif_wrapper
#define ddp_usrreq ddp_usrreq_wrapper
const struct pr_usrreqs ddp_usrreqs = {
@ -681,6 +697,7 @@ const struct pr_usrreqs ddp_usrreqs = {
.pr_bind = ddp_bind,
.pr_listen = ddp_listen,
.pr_connect = ddp_connect,
.pr_connect2 = ddp_connect2,
.pr_disconnect = ddp_disconnect,
.pr_shutdown = ddp_shutdown,
.pr_abort = ddp_abort,
@ -692,6 +709,7 @@ const struct pr_usrreqs ddp_usrreqs = {
.pr_recvoob = ddp_recvoob,
.pr_send = ddp_send,
.pr_sendoob = ddp_sendoob,
.pr_purgeif = ddp_purgeif,
.pr_generic = ddp_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: hci_socket.c,v 1.39 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: hci_socket.c,v 1.40 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.39 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.40 2014/08/09 05:33:01 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -551,6 +551,14 @@ hci_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return 0;
}
static int
hci_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
hci_disconnect(struct socket *so)
{
@ -712,6 +720,13 @@ hci_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
hci_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
/*
* User Request.
* up is socket
@ -726,7 +741,7 @@ static int
hci_usrreq(struct socket *up, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *ctl, struct lwp *l)
{
struct hci_pcb *pcb = (struct hci_pcb *)up->so_pcb;
struct hci_pcb *pcb = up->so_pcb;
int err = 0;
DPRINTFN(2, "%s\n", prurequests[req]);
@ -736,6 +751,7 @@ hci_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -747,11 +763,7 @@ hci_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
switch(req) {
case PRU_PURGEIF:
return EOPNOTSUPP;
}
KASSERT(req != PRU_PURGEIF);
/* anything after here *requires* a pcb */
if (pcb == NULL) {
@ -760,7 +772,6 @@ hci_usrreq(struct socket *up, int req, struct mbuf *m,
}
switch(req) {
case PRU_CONNECT2:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
@ -994,6 +1005,7 @@ PR_WRAP_USRREQS(hci)
#define hci_bind hci_bind_wrapper
#define hci_listen hci_listen_wrapper
#define hci_connect hci_connect_wrapper
#define hci_connect2 hci_connect2_wrapper
#define hci_disconnect hci_disconnect_wrapper
#define hci_shutdown hci_shutdown_wrapper
#define hci_abort hci_abort_wrapper
@ -1005,6 +1017,7 @@ PR_WRAP_USRREQS(hci)
#define hci_recvoob hci_recvoob_wrapper
#define hci_send hci_send_wrapper
#define hci_sendoob hci_sendoob_wrapper
#define hci_purgeif hci_purgeif_wrapper
#define hci_usrreq hci_usrreq_wrapper
const struct pr_usrreqs hci_usrreqs = {
@ -1014,6 +1027,7 @@ const struct pr_usrreqs hci_usrreqs = {
.pr_bind = hci_bind,
.pr_listen = hci_listen,
.pr_connect = hci_connect,
.pr_connect2 = hci_connect2,
.pr_disconnect = hci_disconnect,
.pr_shutdown = hci_shutdown,
.pr_abort = hci_abort,
@ -1025,5 +1039,6 @@ const struct pr_usrreqs hci_usrreqs = {
.pr_recvoob = hci_recvoob,
.pr_send = hci_send,
.pr_sendoob = hci_sendoob,
.pr_purgeif = hci_purgeif,
.pr_generic = hci_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: l2cap_socket.c,v 1.30 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: l2cap_socket.c,v 1.31 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.30 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.31 2014/08/09 05:33:01 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -191,6 +191,17 @@ l2cap_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return l2cap_connect_pcb(pcb, sa);
}
static int
l2cap_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
if (so->so_pcb == NULL)
return EINVAL;
return EOPNOTSUPP;
}
static int
l2cap_disconnect(struct socket *so)
{
@ -346,13 +357,19 @@ l2cap_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
l2cap_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
/*
* User Request.
* up is socket
* m is optional mbuf chain containing message
* ctl is either
* optional mbuf chain containing socket options
* optional interface pointer PRU_PURGEIF
* l is pointer to process requesting action (if any)
*
* we are responsible for disposing of m and ctl if
@ -372,6 +389,7 @@ l2cap_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -383,11 +401,7 @@ l2cap_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
switch (req) {
case PRU_PURGEIF:
return EOPNOTSUPP;
}
KASSERT(req != PRU_PURGEIF);
if (pcb == NULL) {
err = EINVAL;
@ -395,7 +409,6 @@ l2cap_usrreq(struct socket *up, int req, struct mbuf *m,
}
switch(req) {
case PRU_CONNECT2:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
@ -563,6 +576,7 @@ PR_WRAP_USRREQS(l2cap)
#define l2cap_bind l2cap_bind_wrapper
#define l2cap_listen l2cap_listen_wrapper
#define l2cap_connect l2cap_connect_wrapper
#define l2cap_connect2 l2cap_connect2_wrapper
#define l2cap_disconnect l2cap_disconnect_wrapper
#define l2cap_shutdown l2cap_shutdown_wrapper
#define l2cap_abort l2cap_abort_wrapper
@ -574,6 +588,7 @@ PR_WRAP_USRREQS(l2cap)
#define l2cap_recvoob l2cap_recvoob_wrapper
#define l2cap_send l2cap_send_wrapper
#define l2cap_sendoob l2cap_sendoob_wrapper
#define l2cap_purgeif l2cap_purgeif_wrapper
#define l2cap_usrreq l2cap_usrreq_wrapper
const struct pr_usrreqs l2cap_usrreqs = {
@ -583,6 +598,7 @@ const struct pr_usrreqs l2cap_usrreqs = {
.pr_bind = l2cap_bind,
.pr_listen = l2cap_listen,
.pr_connect = l2cap_connect,
.pr_connect2 = l2cap_connect2,
.pr_disconnect = l2cap_disconnect,
.pr_shutdown = l2cap_shutdown,
.pr_abort = l2cap_abort,
@ -594,5 +610,6 @@ const struct pr_usrreqs l2cap_usrreqs = {
.pr_recvoob = l2cap_recvoob,
.pr_send = l2cap_send,
.pr_sendoob = l2cap_sendoob,
.pr_purgeif = l2cap_purgeif,
.pr_generic = l2cap_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: rfcomm_socket.c,v 1.32 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: rfcomm_socket.c,v 1.33 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.32 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.33 2014/08/09 05:33:01 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -199,6 +199,19 @@ rfcomm_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return rfcomm_connect_pcb(pcb, sa);
}
static int
rfcomm_connect2(struct socket *so, struct socket *so2)
{
struct rfcomm_dlc *pcb = so->so_pcb;
KASSERT(solocked(so));
if (pcb == NULL)
return EINVAL;
return EOPNOTSUPP;
}
static int
rfcomm_disconnect(struct socket *so)
{
@ -349,13 +362,19 @@ rfcomm_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
rfcomm_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
/*
* User Request.
* up is socket
* m is optional mbuf chain containing message
* ctl is either
* optional mbuf chain containing socket options
* optional interface pointer PRU_PURGEIF
* l is pointer to process requesting action (if any)
*
* we are responsible for disposing of m and ctl if
@ -375,6 +394,7 @@ rfcomm_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -386,18 +406,14 @@ rfcomm_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
switch (req) {
case PRU_PURGEIF:
return EOPNOTSUPP;
}
if (pcb == NULL) {
err = EINVAL;
goto release;
}
switch(req) {
case PRU_CONNECT2:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
@ -577,6 +593,7 @@ PR_WRAP_USRREQS(rfcomm)
#define rfcomm_bind rfcomm_bind_wrapper
#define rfcomm_listen rfcomm_listen_wrapper
#define rfcomm_connect rfcomm_connect_wrapper
#define rfcomm_connect2 rfcomm_connect2_wrapper
#define rfcomm_disconnect rfcomm_disconnect_wrapper
#define rfcomm_shutdown rfcomm_shutdown_wrapper
#define rfcomm_abort rfcomm_abort_wrapper
@ -588,6 +605,7 @@ PR_WRAP_USRREQS(rfcomm)
#define rfcomm_recvoob rfcomm_recvoob_wrapper
#define rfcomm_send rfcomm_send_wrapper
#define rfcomm_sendoob rfcomm_sendoob_wrapper
#define rfcomm_purgeif rfcomm_purgeif_wrapper
#define rfcomm_usrreq rfcomm_usrreq_wrapper
const struct pr_usrreqs rfcomm_usrreqs = {
@ -597,6 +615,7 @@ const struct pr_usrreqs rfcomm_usrreqs = {
.pr_bind = rfcomm_bind,
.pr_listen = rfcomm_listen,
.pr_connect = rfcomm_connect,
.pr_connect2 = rfcomm_connect2,
.pr_disconnect = rfcomm_disconnect,
.pr_shutdown = rfcomm_shutdown,
.pr_abort = rfcomm_abort,
@ -608,5 +627,6 @@ const struct pr_usrreqs rfcomm_usrreqs = {
.pr_recvoob = rfcomm_recvoob,
.pr_send = rfcomm_send,
.pr_sendoob = rfcomm_sendoob,
.pr_purgeif = rfcomm_purgeif,
.pr_generic = rfcomm_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: sco_socket.c,v 1.32 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: sco_socket.c,v 1.33 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.32 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.33 2014/08/09 05:33:01 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -182,6 +182,19 @@ sco_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return sco_connect_pcb(pcb, sa);
}
static int
sco_connect2(struct socket *so, struct socket *so2)
{
struct sco_pcb *pcb = so->so_pcb;
KASSERT(solocked(so));
if (pcb == NULL)
return EINVAL;
return EOPNOTSUPP;
}
static int
sco_disconnect(struct socket *so)
{
@ -335,6 +348,13 @@ sco_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
sco_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
/*
* User Request.
* up is socket
@ -350,7 +370,7 @@ static int
sco_usrreq(struct socket *up, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *ctl, struct lwp *l)
{
struct sco_pcb *pcb = (struct sco_pcb *)up->so_pcb;
struct sco_pcb *pcb = up->so_pcb;
int err = 0;
DPRINTFN(2, "%s\n", prurequests[req]);
@ -360,6 +380,7 @@ sco_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -371,11 +392,7 @@ sco_usrreq(struct socket *up, int req, struct mbuf *m,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
switch(req) {
case PRU_PURGEIF:
return EOPNOTSUPP;
}
KASSERT(req != PRU_PURGEIF);
/* anything after here *requires* a pcb */
if (pcb == NULL) {
@ -384,7 +401,6 @@ sco_usrreq(struct socket *up, int req, struct mbuf *m,
}
switch(req) {
case PRU_CONNECT2:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
@ -531,6 +547,7 @@ PR_WRAP_USRREQS(sco)
#define sco_bind sco_bind_wrapper
#define sco_listen sco_listen_wrapper
#define sco_connect sco_connect_wrapper
#define sco_connect2 sco_connect2_wrapper
#define sco_disconnect sco_disconnect_wrapper
#define sco_shutdown sco_shutdown_wrapper
#define sco_abort sco_abort_wrapper
@ -542,6 +559,7 @@ PR_WRAP_USRREQS(sco)
#define sco_recvoob sco_recvoob_wrapper
#define sco_send sco_send_wrapper
#define sco_sendoob sco_sendoob_wrapper
#define sco_purgeif sco_purgeif_wrapper
#define sco_usrreq sco_usrreq_wrapper
const struct pr_usrreqs sco_usrreqs = {
@ -551,6 +569,7 @@ const struct pr_usrreqs sco_usrreqs = {
.pr_bind = sco_bind,
.pr_listen = sco_listen,
.pr_connect = sco_connect,
.pr_connect2 = sco_connect2,
.pr_disconnect = sco_disconnect,
.pr_shutdown = sco_shutdown,
.pr_abort = sco_abort,
@ -562,5 +581,6 @@ const struct pr_usrreqs sco_usrreqs = {
.pr_recvoob = sco_recvoob,
.pr_send = sco_send,
.pr_sendoob = sco_sendoob,
.pr_purgeif = sco_purgeif,
.pr_generic = sco_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip.c,v 1.144 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: raw_ip.c,v 1.145 2014/08/09 05:33:01 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.144 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.145 2014/08/09 05:33:01 rtr Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -623,6 +623,14 @@ rip_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
rip_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
rip_disconnect(struct socket *so)
{
@ -790,19 +798,33 @@ rip_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
rip_purgeif(struct socket *so, struct ifnet *ifp)
{
int s;
s = splsoftnet();
mutex_enter(softnet_lock);
in_pcbpurgeif0(&rawcbtable, ifp);
in_purgeif(ifp);
in_pcbpurgeif(&rawcbtable, ifp);
mutex_exit(softnet_lock);
splx(s);
return 0;
}
int
rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
struct inpcb *inp;
int s, error = 0;
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -814,39 +836,16 @@ rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
s = splsoftnet();
if (req == PRU_PURGEIF) {
mutex_enter(softnet_lock);
in_pcbpurgeif0(&rawcbtable, (struct ifnet *)control);
in_purgeif((struct ifnet *)control);
in_pcbpurgeif(&rawcbtable, (struct ifnet *)control);
mutex_exit(softnet_lock);
splx(s);
return 0;
}
KASSERT(req != PRU_PURGEIF);
KASSERT(solocked(so));
inp = sotoinpcb(so);
KASSERT(!control);
if (inp == NULL) {
splx(s);
if (sotoinpcb(so) == NULL)
return EINVAL;
}
switch (req) {
panic("rip_usrreq");
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
default:
panic("rip_usrreq");
}
splx(s);
return error;
return 0;
}
PR_WRAP_USRREQS(rip)
@ -856,6 +855,7 @@ PR_WRAP_USRREQS(rip)
#define rip_bind rip_bind_wrapper
#define rip_listen rip_listen_wrapper
#define rip_connect rip_connect_wrapper
#define rip_connect2 rip_connect2_wrapper
#define rip_disconnect rip_disconnect_wrapper
#define rip_shutdown rip_shutdown_wrapper
#define rip_abort rip_abort_wrapper
@ -867,6 +867,7 @@ PR_WRAP_USRREQS(rip)
#define rip_recvoob rip_recvoob_wrapper
#define rip_send rip_send_wrapper
#define rip_sendoob rip_sendoob_wrapper
#define rip_purgeif rip_purgeif_wrapper
#define rip_usrreq rip_usrreq_wrapper
const struct pr_usrreqs rip_usrreqs = {
@ -876,6 +877,7 @@ const struct pr_usrreqs rip_usrreqs = {
.pr_bind = rip_bind,
.pr_listen = rip_listen,
.pr_connect = rip_connect,
.pr_connect2 = rip_connect2,
.pr_disconnect = rip_disconnect,
.pr_shutdown = rip_shutdown,
.pr_abort = rip_abort,
@ -887,6 +889,7 @@ const struct pr_usrreqs rip_usrreqs = {
.pr_recvoob = rip_recvoob,
.pr_send = rip_send,
.pr_sendoob = rip_sendoob,
.pr_purgeif = rip_purgeif,
.pr_generic = rip_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.199 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.200 2014/08/09 05:33:01 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.199 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.200 2014/08/09 05:33:01 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -224,19 +224,13 @@ static int
tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
struct tcpcb *tp = NULL;
int s;
int error = 0;
int ostate = 0;
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -248,65 +242,13 @@ tcp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
s = splsoftnet();
KASSERT(solocked(so));
if (req == PRU_PURGEIF) {
mutex_enter(softnet_lock);
switch (so->so_proto->pr_domain->dom_family) {
#ifdef INET
case PF_INET:
in_pcbpurgeif0(&tcbtable, (struct ifnet *)control);
in_purgeif((struct ifnet *)control);
in_pcbpurgeif(&tcbtable, (struct ifnet *)control);
break;
#endif
#ifdef INET6
case PF_INET6:
in6_pcbpurgeif0(&tcbtable, (struct ifnet *)control);
in6_purgeif((struct ifnet *)control);
in6_pcbpurgeif(&tcbtable, (struct ifnet *)control);
break;
#endif
default:
mutex_exit(softnet_lock);
splx(s);
return (EAFNOSUPPORT);
}
mutex_exit(softnet_lock);
splx(s);
return (0);
}
panic("tcp_usrreq");
if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0) {
splx(s);
return error;
}
ostate = tcp_debug_capture(tp, req);
KASSERT(!control);
#ifdef INET6
/* XXX: KASSERT((inp != NULL) ^ (in6p != NULL)); */
#endif
switch (req) {
/*
* Create a TCP connection between two sockets.
*/
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
default:
panic("tcp_usrreq");
}
tcp_debug_trace(so, tp, ostate, req);
splx(s);
return error;
return 0;
}
static void
@ -878,6 +820,27 @@ release:
return error;
}
static int
tcp_connect2(struct socket *so, struct socket *so2)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
struct tcpcb *tp = NULL;
int error = 0;
int ostate = 0;
KASSERT(solocked(so));
if ((error = tcp_getpcb(so, &inp, &in6p, &tp)) != 0)
return error;
ostate = tcp_debug_capture(tp, PRU_CONNECT2);
tcp_debug_trace(so, tp, ostate, PRU_CONNECT2);
return EOPNOTSUPP;
}
static int
tcp_disconnect(struct socket *so)
{
@ -1203,6 +1166,39 @@ tcp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return error;
}
static int
tcp_purgeif(struct socket *so, struct ifnet *ifp)
{
int s;
s = splsoftnet();
mutex_enter(softnet_lock);
switch (so->so_proto->pr_domain->dom_family) {
#ifdef INET
case PF_INET:
in_pcbpurgeif0(&tcbtable, ifp);
in_purgeif(ifp);
in_pcbpurgeif(&tcbtable, ifp);
break;
#endif
#ifdef INET6
case PF_INET6:
in6_pcbpurgeif0(&tcbtable, ifp);
in6_purgeif(ifp);
in6_pcbpurgeif(&tcbtable, ifp);
break;
#endif
default:
mutex_exit(softnet_lock);
splx(s);
return EAFNOSUPPORT;
}
mutex_exit(softnet_lock);
splx(s);
return 0;
}
/*
* Initiate (or continue) disconnect.
* If embryonic state, just send reset (once).
@ -2443,6 +2439,7 @@ PR_WRAP_USRREQS(tcp)
#define tcp_bind tcp_bind_wrapper
#define tcp_listen tcp_listen_wrapper
#define tcp_connect tcp_connect_wrapper
#define tcp_connect2 tcp_connect2_wrapper
#define tcp_disconnect tcp_disconnect_wrapper
#define tcp_shutdown tcp_shutdown_wrapper
#define tcp_abort tcp_abort_wrapper
@ -2454,6 +2451,7 @@ PR_WRAP_USRREQS(tcp)
#define tcp_recvoob tcp_recvoob_wrapper
#define tcp_send tcp_send_wrapper
#define tcp_sendoob tcp_sendoob_wrapper
#define tcp_purgeif tcp_purgeif_wrapper
#define tcp_usrreq tcp_usrreq_wrapper
const struct pr_usrreqs tcp_usrreqs = {
@ -2463,6 +2461,7 @@ const struct pr_usrreqs tcp_usrreqs = {
.pr_bind = tcp_bind,
.pr_listen = tcp_listen,
.pr_connect = tcp_connect,
.pr_connect2 = tcp_connect2,
.pr_disconnect = tcp_disconnect,
.pr_shutdown = tcp_shutdown,
.pr_abort = tcp_abort,
@ -2474,5 +2473,6 @@ const struct pr_usrreqs tcp_usrreqs = {
.pr_recvoob = tcp_recvoob,
.pr_send = tcp_send,
.pr_sendoob = tcp_sendoob,
.pr_purgeif = tcp_purgeif,
.pr_generic = tcp_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.216 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.217 2014/08/09 05:33:01 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.216 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.217 2014/08/09 05:33:01 rtr Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -949,6 +949,14 @@ udp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
udp_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
udp_disconnect(struct socket *so)
{
@ -1119,19 +1127,33 @@ udp_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
udp_purgeif(struct socket *so, struct ifnet *ifp)
{
int s;
s = splsoftnet();
mutex_enter(softnet_lock);
in_pcbpurgeif0(&udbtable, ifp);
in_purgeif(ifp);
in_pcbpurgeif(&udbtable, ifp);
mutex_exit(softnet_lock);
splx(s);
return 0;
}
static int
udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
struct inpcb *inp;
int s, error = 0;
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -1143,42 +1165,16 @@ udp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
s = splsoftnet();
if (req == PRU_PURGEIF) {
mutex_enter(softnet_lock);
in_pcbpurgeif0(&udbtable, (struct ifnet *)control);
in_purgeif((struct ifnet *)control);
in_pcbpurgeif(&udbtable, (struct ifnet *)control);
mutex_exit(softnet_lock);
splx(s);
return 0;
}
KASSERT(req != PRU_PURGEIF);
KASSERT(solocked(so));
inp = sotoinpcb(so);
KASSERT(!control);
if (inp == NULL) {
splx(s);
if (sotoinpcb(so) == NULL)
return EINVAL;
}
/*
* Note: need to block udp_input while changing
* the udp pcb queue and/or pcb addresses.
*/
switch (req) {
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
panic("udp_usrreq");
default:
panic("udp_usrreq");
}
splx(s);
return error;
return 0;
}
static int
@ -1405,6 +1401,7 @@ PR_WRAP_USRREQS(udp)
#define udp_bind udp_bind_wrapper
#define udp_listen udp_listen_wrapper
#define udp_connect udp_connect_wrapper
#define udp_connect2 udp_connect2_wrapper
#define udp_disconnect udp_disconnect_wrapper
#define udp_shutdown udp_shutdown_wrapper
#define udp_abort udp_abort_wrapper
@ -1416,6 +1413,7 @@ PR_WRAP_USRREQS(udp)
#define udp_recvoob udp_recvoob_wrapper
#define udp_send udp_send_wrapper
#define udp_sendoob udp_sendoob_wrapper
#define udp_purgeif udp_purgeif_wrapper
#define udp_usrreq udp_usrreq_wrapper
const struct pr_usrreqs udp_usrreqs = {
@ -1425,6 +1423,7 @@ const struct pr_usrreqs udp_usrreqs = {
.pr_bind = udp_bind,
.pr_listen = udp_listen,
.pr_connect = udp_connect,
.pr_connect2 = udp_connect2,
.pr_disconnect = udp_disconnect,
.pr_shutdown = udp_shutdown,
.pr_abort = udp_abort,
@ -1436,5 +1435,6 @@ const struct pr_usrreqs udp_usrreqs = {
.pr_recvoob = udp_recvoob,
.pr_send = udp_send,
.pr_sendoob = udp_sendoob,
.pr_purgeif = udp_purgeif,
.pr_generic = udp_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip6.c,v 1.135 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: raw_ip6.c,v 1.136 2014/08/09 05:33:01 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.135 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.136 2014/08/09 05:33:01 rtr Exp $");
#include "opt_ipsec.h"
@ -754,6 +754,14 @@ rip6_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
rip6_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
rip6_disconnect(struct socket *so)
{
@ -911,16 +919,29 @@ rip6_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
rip6_purgeif(struct socket *so, struct ifnet *ifp)
{
mutex_enter(softnet_lock);
in6_pcbpurgeif0(&raw6cbtable, ifp);
in6_purgeif(ifp);
in6_pcbpurgeif(&raw6cbtable, ifp);
mutex_exit(softnet_lock);
return 0;
}
int
rip6_usrreq(struct socket *so, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *control, struct lwp *l)
{
int error = 0;
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -931,28 +952,12 @@ rip6_usrreq(struct socket *so, int req, struct mbuf *m,
KASSERT(req != PRU_RCVD);
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_PURGEIF);
KASSERT(req != PRU_SENDOOB);
if (req == PRU_PURGEIF) {
mutex_enter(softnet_lock);
in6_pcbpurgeif0(&raw6cbtable, (struct ifnet *)control);
in6_purgeif((struct ifnet *)control);
in6_pcbpurgeif(&raw6cbtable, (struct ifnet *)control);
mutex_exit(softnet_lock);
return 0;
}
panic("rip6_usrreq");
switch (req) {
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
default:
panic("rip6_usrreq");
}
if (m != NULL)
m_freem(m);
return error;
return 0;
}
static int
@ -1001,6 +1006,7 @@ PR_WRAP_USRREQS(rip6)
#define rip6_bind rip6_bind_wrapper
#define rip6_listen rip6_listen_wrapper
#define rip6_connect rip6_connect_wrapper
#define rip6_connect2 rip6_connect2_wrapper
#define rip6_disconnect rip6_disconnect_wrapper
#define rip6_shutdown rip6_shutdown_wrapper
#define rip6_abort rip6_abort_wrapper
@ -1012,6 +1018,7 @@ PR_WRAP_USRREQS(rip6)
#define rip6_recvoob rip6_recvoob_wrapper
#define rip6_send rip6_send_wrapper
#define rip6_sendoob rip6_sendoob_wrapper
#define rip6_purgeif rip6_purgeif_wrapper
#define rip6_usrreq rip6_usrreq_wrapper
const struct pr_usrreqs rip6_usrreqs = {
@ -1021,6 +1028,7 @@ const struct pr_usrreqs rip6_usrreqs = {
.pr_bind = rip6_bind,
.pr_listen = rip6_listen,
.pr_connect = rip6_connect,
.pr_connect2 = rip6_connect2,
.pr_disconnect = rip6_disconnect,
.pr_shutdown = rip6_shutdown,
.pr_abort = rip6_abort,
@ -1032,5 +1040,6 @@ const struct pr_usrreqs rip6_usrreqs = {
.pr_recvoob = rip6_recvoob,
.pr_send = rip6_send,
.pr_sendoob = rip6_sendoob,
.pr_purgeif = rip6_purgeif,
.pr_generic = rip6_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp6_usrreq.c,v 1.114 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: udp6_usrreq.c,v 1.115 2014/08/09 05:33:01 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.114 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.115 2014/08/09 05:33:01 rtr Exp $");
#include "opt_inet.h"
#include "opt_inet_csum.h"
@ -730,6 +730,14 @@ udp6_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
udp6_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
udp6_disconnect(struct socket *so)
{
@ -875,11 +883,23 @@ udp6_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
udp6_purgeif(struct socket *so, struct ifnet *ifp)
{
mutex_enter(softnet_lock);
in6_pcbpurgeif0(&udbtable, ifp);
in6_purgeif(ifp);
in6_pcbpurgeif(&udbtable, ifp);
mutex_exit(softnet_lock);
return 0;
}
int
udp6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr6,
struct mbuf *control, struct lwp *l)
{
struct in6pcb *in6p = sotoin6pcb(so);
int error = 0;
KASSERT(req != PRU_ATTACH);
@ -888,6 +908,7 @@ udp6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr6,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -899,22 +920,14 @@ udp6_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *addr6,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
if (req == PRU_PURGEIF) {
mutex_enter(softnet_lock);
in6_pcbpurgeif0(&udbtable, (struct ifnet *)control);
in6_purgeif((struct ifnet *)control);
in6_pcbpurgeif(&udbtable, (struct ifnet *)control);
mutex_exit(softnet_lock);
return 0;
}
if (in6p == NULL) {
if (sotoin6pcb(so) == NULL) {
error = EINVAL;
goto release;
}
switch (req) {
case PRU_CONNECT2:
case PRU_FASTTIMO:
case PRU_SLOWTIMO:
case PRU_PROTORCV:
@ -1009,6 +1022,7 @@ PR_WRAP_USRREQS(udp6)
#define udp6_bind udp6_bind_wrapper
#define udp6_listen udp6_listen_wrapper
#define udp6_connect udp6_connect_wrapper
#define udp6_connect2 udp6_connect2_wrapper
#define udp6_disconnect udp6_disconnect_wrapper
#define udp6_shutdown udp6_shutdown_wrapper
#define udp6_abort udp6_abort_wrapper
@ -1020,6 +1034,7 @@ PR_WRAP_USRREQS(udp6)
#define udp6_recvoob udp6_recvoob_wrapper
#define udp6_send udp6_send_wrapper
#define udp6_sendoob udp6_sendoob_wrapper
#define udp6_purgeif udp6_purgeif_wrapper
#define udp6_usrreq udp6_usrreq_wrapper
const struct pr_usrreqs udp6_usrreqs = {
@ -1029,6 +1044,7 @@ const struct pr_usrreqs udp6_usrreqs = {
.pr_bind = udp6_bind,
.pr_listen = udp6_listen,
.pr_connect = udp6_connect,
.pr_connect2 = udp6_connect2,
.pr_disconnect = udp6_disconnect,
.pr_shutdown = udp6_shutdown,
.pr_abort = udp6_abort,
@ -1040,5 +1056,6 @@ const struct pr_usrreqs udp6_usrreqs = {
.pr_recvoob = udp6_recvoob,
.pr_send = udp6_send,
.pr_sendoob = udp6_sendoob,
.pr_purgeif = udp6_purgeif,
.pr_generic = udp6_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: keysock.c,v 1.42 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: keysock.c,v 1.43 2014/08/09 05:33:01 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.42 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.43 2014/08/09 05:33:01 rtr Exp $");
#include "opt_ipsec.h"
@ -518,6 +518,14 @@ key_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return EOPNOTSUPP;
}
static int
key_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
key_disconnect(struct socket *so)
{
@ -651,6 +659,15 @@ key_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
key_purgeif(struct socket *so, struct ifnet *ifa)
{
panic("key_purgeif");
return EOPNOTSUPP;
}
/*
* key_usrreq()
* derived from net/rtsock.c:route_usrreq()
@ -667,6 +684,7 @@ key_usrreq(struct socket *so, int req,struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -678,6 +696,7 @@ key_usrreq(struct socket *so, int req,struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
s = splsoftnet();
error = raw_usrreq(so, req, m, nam, control, l);
@ -700,6 +719,7 @@ PR_WRAP_USRREQS(key)
#define key_bind key_bind_wrapper
#define key_listen key_listen_wrapper
#define key_connect key_connect_wrapper
#define key_connect2 key_connect2_wrapper
#define key_disconnect key_disconnect_wrapper
#define key_shutdown key_shutdown_wrapper
#define key_abort key_abort_wrapper
@ -711,6 +731,7 @@ PR_WRAP_USRREQS(key)
#define key_recvoob key_recvoob_wrapper
#define key_send key_send_wrapper
#define key_sendoob key_sendoob_wrapper
#define key_purgeif key_purgeif_wrapper
#define key_usrreq key_usrreq_wrapper
const struct pr_usrreqs key_usrreqs = {
@ -720,6 +741,7 @@ const struct pr_usrreqs key_usrreqs = {
.pr_bind = key_bind,
.pr_listen = key_listen,
.pr_connect = key_connect,
.pr_connect2 = key_connect2,
.pr_disconnect = key_disconnect,
.pr_shutdown = key_shutdown,
.pr_abort = key_abort,
@ -731,6 +753,7 @@ const struct pr_usrreqs key_usrreqs = {
.pr_recvoob = key_recvoob,
.pr_send = key_send,
.pr_sendoob = key_sendoob,
.pr_purgeif = key_purgeif,
.pr_generic = key_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpls_proto.c,v 1.23 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: mpls_proto.c,v 1.24 2014/08/09 05:33:01 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.23 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: mpls_proto.c,v 1.24 2014/08/09 05:33:01 rtr Exp $");
#include "opt_inet.h"
#include "opt_mbuftrace.h"
@ -126,6 +126,14 @@ mpls_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return EOPNOTSUPP;
}
static int
mpls_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
mpls_disconnect(struct socket *so)
{
@ -213,17 +221,24 @@ mpls_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
return EOPNOTSUPP;
}
static int
mpls_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
static int
mpls_usrreq(struct socket *so, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *control, struct lwp *l)
{
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -235,6 +250,7 @@ mpls_usrreq(struct socket *so, int req, struct mbuf *m,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
return EOPNOTSUPP;
}
@ -327,6 +343,7 @@ PR_WRAP_USRREQS(mpls)
#define mpls_bind mpls_bind_wrapper
#define mpls_listen mpls_listen_wrapper
#define mpls_connect mpls_connect_wrapper
#define mpls_connect2 mpls_connect2_wrapper
#define mpls_disconnect mpls_disconnect_wrapper
#define mpls_shutdown mpls_shutdown_wrapper
#define mpls_abort mpls_abort_wrapper
@ -338,6 +355,7 @@ PR_WRAP_USRREQS(mpls)
#define mpls_recvoob mpls_recvoob_wrapper
#define mpls_send mpls_send_wrapper
#define mpls_sendoob mpls_sendoob_wrapper
#define mpls_purgeif mpls_purgeif_wrapper
#define mpls_usrreq mpls_usrreq_wrapper
static const struct pr_usrreqs mpls_usrreqs = {
@ -347,6 +365,7 @@ static const struct pr_usrreqs mpls_usrreqs = {
.pr_bind = mpls_bind,
.pr_listen = mpls_listen,
.pr_connect = mpls_connect,
.pr_connect2 = mpls_connect2,
.pr_disconnect = mpls_disconnect,
.pr_shutdown = mpls_shutdown,
.pr_abort = mpls_abort,
@ -358,6 +377,7 @@ static const struct pr_usrreqs mpls_usrreqs = {
.pr_recvoob = mpls_recvoob,
.pr_send = mpls_send,
.pr_sendoob = mpls_sendoob,
.pr_purgeif = mpls_purgeif,
.pr_generic = mpls_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: natm.c,v 1.44 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: natm.c,v 1.45 2014/08/09 05:33:01 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.44 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.45 2014/08/09 05:33:01 rtr Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -189,6 +189,14 @@ natm_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
natm_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
return EOPNOTSUPP;
}
static int
natm_disconnect(struct socket *so)
{
@ -409,9 +417,16 @@ natm_send(struct socket *so, struct mbuf *m, struct mbuf *nam,
static int
natm_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
{
KASSERT(solocked(so));
KASSERT(solocked(so));
return EOPNOTSUPP;
return EOPNOTSUPP;
}
static int
natm_purgeif(struct socket *so, struct ifnet *ifp)
{
return EOPNOTSUPP;
}
/*
@ -436,6 +451,7 @@ natm_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -447,18 +463,12 @@ natm_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
s = SPLSOFTNET();
npcb = (struct natmpcb *) so->so_pcb;
if (npcb == NULL) {
error = EINVAL;
goto done;
}
if (so->so_pcb == NULL)
return EINVAL;
switch (req) {
case PRU_CONNECT2: /* connect two sockets */
case PRU_FASTTIMO: /* 200ms timeout */
case PRU_SLOWTIMO: /* 500ms timeout */
case PRU_PROTORCV: /* receive from below */
@ -473,8 +483,7 @@ natm_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
}
done:
splx(s);
return(error);
return error;
}
/*
@ -562,6 +571,7 @@ PR_WRAP_USRREQS(natm)
#define natm_bind natm_bind_wrapper
#define natm_listen natm_listen_wrapper
#define natm_connect natm_connect_wrapper
#define natm_connect2 natm_connect2_wrapper
#define natm_disconnect natm_disconnect_wrapper
#define natm_shutdown natm_shutdown_wrapper
#define natm_abort natm_abort_wrapper
@ -573,6 +583,7 @@ PR_WRAP_USRREQS(natm)
#define natm_recvoob natm_recvoob_wrapper
#define natm_send natm_send_wrapper
#define natm_sendoob natm_sendoob_wrapper
#define natm_purgeif natm_purgeif_wrapper
#define natm_usrreq natm_usrreq_wrapper
const struct pr_usrreqs natm_usrreqs = {
@ -582,6 +593,7 @@ const struct pr_usrreqs natm_usrreqs = {
.pr_bind = natm_bind,
.pr_listen = natm_listen,
.pr_connect = natm_connect,
.pr_connect2 = natm_connect2,
.pr_disconnect = natm_disconnect,
.pr_shutdown = natm_shutdown,
.pr_abort = natm_abort,
@ -593,5 +605,6 @@ const struct pr_usrreqs natm_usrreqs = {
.pr_recvoob = natm_recvoob,
.pr_send = natm_send,
.pr_sendoob = natm_sendoob,
.pr_purgeif = natm_purgeif,
.pr_generic = natm_usrreq,
};

View File

@ -1,4 +1,4 @@
/* $NetBSD: sockin.c,v 1.57 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: sockin.c,v 1.58 2014/08/09 05:33:01 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.57 2014/08/08 03:05:45 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.58 2014/08/09 05:33:01 rtr Exp $");
#include <sys/param.h>
#include <sys/condvar.h>
@ -69,6 +69,7 @@ static void sockin_init(void);
static int sockin_attach(struct socket *, int);
static void sockin_detach(struct socket *);
static int sockin_accept(struct socket *, struct mbuf *);
static int sockin_connect2(struct socket *, struct socket *);
static int sockin_bind(struct socket *, struct mbuf *, struct lwp *);
static int sockin_listen(struct socket *, struct lwp *);
static int sockin_connect(struct socket *, struct mbuf *, struct lwp *);
@ -84,6 +85,7 @@ static int sockin_recvoob(struct socket *, struct mbuf *, int);
static int sockin_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *);
static int sockin_sendoob(struct socket *, struct mbuf *, struct mbuf *);
static int sockin_purgeif(struct socket *, struct ifnet *);
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 *);
@ -95,6 +97,7 @@ static const struct pr_usrreqs sockin_usrreqs = {
.pr_bind = sockin_bind,
.pr_listen = sockin_listen,
.pr_connect = sockin_connect,
.pr_connect2 = sockin_connect2,
.pr_disconnect = sockin_disconnect,
.pr_shutdown = sockin_shutdown,
.pr_abort = sockin_abort,
@ -106,6 +109,7 @@ static const struct pr_usrreqs sockin_usrreqs = {
.pr_recvoob = sockin_recvoob,
.pr_send = sockin_send,
.pr_sendoob = sockin_sendoob,
.pr_purgeif = sockin_purgeif,
.pr_generic = sockin_usrreq,
};
@ -524,6 +528,14 @@ sockin_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
return error;
}
static int
sockin_connect2(struct socket *so, struct socket *so2)
{
KASSERT(solocked(so));
panic("sockin_connect2: IMPLEMENT ME, connect2 not supported");
}
static int
sockin_disconnect(struct socket *so)
{
@ -677,16 +689,22 @@ sockin_sendoob(struct socket *so, struct mbuf *m, struct mbuf *control)
panic("sockin_sendoob: IMPLEMENT ME, sendoob not supported");
}
static int
sockin_purgeif(struct socket *so, struct ifnet *ifp)
{
panic("sockin_purgeif: IMPLEMENT ME, purgeif not supported");
}
static int
sockin_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
int error = 0;
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONNECT2);
KASSERT(req != PRU_DISCONNECT);
KASSERT(req != PRU_SHUTDOWN);
KASSERT(req != PRU_ABORT);
@ -698,13 +716,11 @@ sockin_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
KASSERT(req != PRU_PURGEIF);
switch (req) {
default:
panic("sockin_usrreq: IMPLEMENT ME, req %d not supported", req);
}
panic("sockin_usrreq: IMPLEMENT ME, req %d not supported", req);
return error;
return 0;
}
static int

View File

@ -1,4 +1,4 @@
/* $NetBSD: protosw.h,v 1.59 2014/08/08 03:05:45 rtr Exp $ */
/* $NetBSD: protosw.h,v 1.60 2014/08/09 05:33:01 rtr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@ -117,7 +117,7 @@ struct protosw {
#define PR_ABRTACPTDIS 0x80 /* abort on accept(2) to disconnected
socket */
#define PR_PURGEIF 0x100 /* might store struct ifnet pointer;
PRU_PURGEIF must be called on ifnet
pr_purgeif() must be called on ifnet
deletion */
/*
@ -239,9 +239,10 @@ struct pr_usrreqs {
int (*pr_attach)(struct socket *, int);
void (*pr_detach)(struct socket *);
int (*pr_accept)(struct socket *, struct mbuf *);
int (*pr_connect)(struct socket *, struct mbuf *, struct lwp *);
int (*pr_connect2)(struct socket *, struct socket *);
int (*pr_bind)(struct socket *, struct mbuf *, struct lwp *);
int (*pr_listen)(struct socket *, struct lwp *);
int (*pr_connect)(struct socket *, struct mbuf *, struct lwp *);
int (*pr_disconnect)(struct socket *);
int (*pr_shutdown)(struct socket *);
int (*pr_abort)(struct socket *);
@ -254,6 +255,7 @@ struct pr_usrreqs {
int (*pr_send)(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *);
int (*pr_sendoob)(struct socket *, struct mbuf *, struct mbuf *);
int (*pr_purgeif)(struct socket *, struct ifnet *);
int (*pr_generic)(struct socket *, int, struct mbuf *,
struct mbuf *, struct mbuf *, struct lwp *);
};
@ -335,6 +337,16 @@ name##_connect_wrapper(struct socket *a, \
return rv; \
} \
static int \
name##_connect2_wrapper(struct socket *a, \
struct socket *b) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
rv = name##_connect2(a, b); \
KERNEL_UNLOCK_ONE(NULL); \
return rv; \
} \
static int \
name##_listen_wrapper(struct socket *a, struct lwp *b) \
{ \
int rv; \
@ -448,6 +460,16 @@ name##_sendoob_wrapper(struct socket *a, \
return rv; \
} \
static int \
name##_purgeif_wrapper(struct socket *a, \
struct ifnet *b) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
rv = name##_purgeif(a, b); \
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) \

View File

@ -1,4 +1,4 @@
/* $NetBSD: un.h,v 1.54 2014/08/05 14:02:42 rtr Exp $ */
/* $NetBSD: un.h,v 1.55 2014/08/09 05:33:01 rtr Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -85,7 +85,7 @@ kmutex_t *uipc_streamlock(void);
kmutex_t *uipc_rawlock(void);
int unp_connect(struct socket *, struct mbuf *, struct lwp *);
int unp_connect2(struct socket *, struct socket *, int);
int unp_connect2(struct socket *, struct socket *);
void unp_dispose(struct mbuf *);
int unp_externalize(struct mbuf *, struct lwp *, int);