revert the removal of struct lwp * parameter from bind, listen and connect

user requests.

this should resolve the issue relating to nfs client hangs presented
recently by wiz on current-users@
This commit is contained in:
rtr 2014-08-05 05:24:26 +00:00
parent bcbb568e2a
commit ce6a5ff64f
25 changed files with 145 additions and 143 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_socket.c,v 1.230 2014/07/31 20:28:59 mrg Exp $ */
/* $NetBSD: uipc_socket.c,v 1.231 2014/08/05 05:24:26 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.230 2014/07/31 20:28:59 mrg Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.231 2014/08/05 05:24:26 rtr Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@ -629,7 +629,7 @@ sobind(struct socket *so, struct mbuf *nam, struct lwp *l)
int error;
solock(so);
error = (*so->so_proto->pr_usrreqs->pr_bind)(so, nam);
error = (*so->so_proto->pr_usrreqs->pr_bind)(so, nam, l);
sounlock(so);
return error;
}
@ -645,7 +645,7 @@ solisten(struct socket *so, int backlog, struct lwp *l)
sounlock(so);
return EINVAL;
}
error = (*so->so_proto->pr_usrreqs->pr_listen)(so);
error = (*so->so_proto->pr_usrreqs->pr_listen)(so, l);
if (error != 0) {
sounlock(so);
return error;
@ -826,7 +826,7 @@ soconnect(struct socket *so, struct mbuf *nam, struct lwp *l)
(error = sodisconnect(so))))
error = EISCONN;
else
error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam);
error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l);
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: uipc_usrreq.c,v 1.164 2014/07/31 14:12:57 rtr Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.165 2014/08/05 05:24:26 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.164 2014/07/31 14:12:57 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.165 2014/08/05 05:24:26 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -495,7 +495,7 @@ unp_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
* intervening control ops, like
* another connection.
*/
error = unp_connect(so, nam);
error = unp_connect(so, nam, l);
}
} else {
if ((so->so_state & SS_ISCONNECTED) == 0)
@ -920,7 +920,7 @@ makeun(struct mbuf *nam, size_t *addrlen) {
}
static int
unp_bind(struct socket *so, struct mbuf *nam)
unp_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct sockaddr_un *sun;
struct unpcb *unp;
@ -950,7 +950,7 @@ unp_bind(struct socket *so, struct mbuf *nam)
unp->unp_flags |= UNP_BUSY;
sounlock(so);
p = curlwp->l_proc;
p = l->l_proc;
sun = makeun(nam, &addrlen);
pb = pathbuf_create(sun->sun_path);
@ -994,8 +994,8 @@ unp_bind(struct socket *so, struct mbuf *nam)
unp->unp_addrlen = addrlen;
unp->unp_addr = sun;
unp->unp_connid.unp_pid = p->p_pid;
unp->unp_connid.unp_euid = kauth_cred_geteuid(curlwp->l_cred);
unp->unp_connid.unp_egid = kauth_cred_getegid(curlwp->l_cred);
unp->unp_connid.unp_euid = kauth_cred_geteuid(l->l_cred);
unp->unp_connid.unp_egid = kauth_cred_getegid(l->l_cred);
unp->unp_flags |= UNP_EIDSBIND;
VOP_UNLOCK(vp);
vput(nd.ni_dvp);
@ -1011,7 +1011,7 @@ unp_bind(struct socket *so, struct mbuf *nam)
}
static int
unp_listen(struct socket *so)
unp_listen(struct socket *so, struct lwp *l)
{
struct unpcb *unp = sotounpcb(so);
@ -1064,7 +1064,7 @@ unp_abort(struct socket *so)
}
int
unp_connect(struct socket *so, struct mbuf *nam)
unp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct sockaddr_un *sun;
vnode_t *vp;

View File

@ -1,4 +1,4 @@
/* $NetBSD: link_proto.c,v 1.20 2014/07/31 13:21:33 rtr Exp $ */
/* $NetBSD: link_proto.c,v 1.21 2014/08/05 05:24:26 rtr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.20 2014/07/31 13:21:33 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.21 2014/08/05 05:24:26 rtr Exp $");
#include <sys/param.h>
#include <sys/socket.h>
@ -51,9 +51,9 @@ static int sockaddr_dl_cmp(const struct sockaddr *, const struct sockaddr *);
static int link_attach(struct socket *, int);
static void link_detach(struct socket *);
static int link_accept(struct socket *, struct mbuf *);
static int link_bind(struct socket *, struct mbuf *);
static int link_listen(struct socket *);
static int link_connect(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_disconnect(struct socket *);
static int link_shutdown(struct socket *);
static int link_abort(struct socket *);
@ -265,7 +265,7 @@ link_accept(struct socket *so, struct mbuf *nam)
}
static int
link_bind(struct socket *so, struct mbuf *nam)
link_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
@ -273,7 +273,7 @@ link_bind(struct socket *so, struct mbuf *nam)
}
static int
link_listen(struct socket *so)
link_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -281,7 +281,7 @@ link_listen(struct socket *so)
}
static int
link_connect(struct socket *so, struct mbuf *nam)
link_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_usrreq.c,v 1.48 2014/07/31 05:13:53 rtr Exp $ */
/* $NetBSD: raw_usrreq.c,v 1.49 2014/08/05 05:24:26 rtr Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.48 2014/07/31 05:13:53 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.49 2014/08/05 05:24:26 rtr Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@ -216,7 +216,7 @@ raw_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
error = EISCONN;
goto die;
}
error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam);
error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam, l);
if (error) {
die:
m_freem(m);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rtsock.c,v 1.159 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: rtsock.c,v 1.160 2014/08/05 05:24:26 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.159 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.160 2014/08/05 05:24:26 rtr Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@ -234,7 +234,7 @@ COMPATNAME(route_accept)(struct socket *so, struct mbuf *nam)
}
static int
COMPATNAME(route_bind)(struct socket *so, struct mbuf *nam)
COMPATNAME(route_bind)(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
@ -242,7 +242,7 @@ COMPATNAME(route_bind)(struct socket *so, struct mbuf *nam)
}
static int
COMPATNAME(route_listen)(struct socket *so)
COMPATNAME(route_listen)(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -250,7 +250,7 @@ COMPATNAME(route_listen)(struct socket *so)
}
static int
COMPATNAME(route_connect)(struct socket *so, struct mbuf *nam)
COMPATNAME(route_connect)(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));

View File

@ -1,4 +1,4 @@
/* $NetBSD: ddp_usrreq.c,v 1.57 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: ddp_usrreq.c,v 1.58 2014/08/05 05:24:26 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.57 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.58 2014/08/05 05:24:26 rtr Exp $");
#include "opt_mbuftrace.h"
@ -452,7 +452,7 @@ ddp_accept(struct socket *so, struct mbuf *nam)
}
static int
ddp_bind(struct socket *so, struct mbuf *nam)
ddp_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
KASSERT(sotoddpcb(so) != NULL);
@ -461,7 +461,7 @@ ddp_bind(struct socket *so, struct mbuf *nam)
}
static int
ddp_listen(struct socket *so)
ddp_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -469,7 +469,7 @@ ddp_listen(struct socket *so)
}
static int
ddp_connect(struct socket *so, struct mbuf *nam)
ddp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct ddpcb *ddp = sotoddpcb(so);
int error = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: hci_socket.c,v 1.36 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: hci_socket.c,v 1.37 2014/08/05 05:24:26 rtr Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.36 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: hci_socket.c,v 1.37 2014/08/05 05:24:26 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -492,7 +492,7 @@ hci_accept(struct socket *so, struct mbuf *nam)
}
static int
hci_bind(struct socket *so, struct mbuf *nam)
hci_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct hci_pcb *pcb = so->so_pcb;
struct sockaddr_bt *sa;
@ -519,7 +519,7 @@ hci_bind(struct socket *so, struct mbuf *nam)
}
static int
hci_listen(struct socket *so)
hci_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -527,7 +527,7 @@ hci_listen(struct socket *so)
}
static int
hci_connect(struct socket *so, struct mbuf *nam)
hci_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct hci_pcb *pcb = so->so_pcb;
struct sockaddr_bt *sa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: l2cap_socket.c,v 1.27 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: l2cap_socket.c,v 1.28 2014/08/05 05:24:26 rtr Exp $ */
/*-
* Copyright (c) 2005 Iain Hibbert.
@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.27 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: l2cap_socket.c,v 1.28 2014/08/05 05:24:26 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -134,7 +134,7 @@ l2cap_accept(struct socket *so, struct mbuf *nam)
}
static int
l2cap_bind(struct socket *so, struct mbuf *nam)
l2cap_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct l2cap_channel *pcb = so->so_pcb;
struct sockaddr_bt *sa;
@ -156,7 +156,7 @@ l2cap_bind(struct socket *so, struct mbuf *nam)
}
static int
l2cap_listen(struct socket *so)
l2cap_listen(struct socket *so, struct lwp *l)
{
struct l2cap_channel *pcb = so->so_pcb;
@ -169,7 +169,7 @@ l2cap_listen(struct socket *so)
}
static int
l2cap_connect(struct socket *so, struct mbuf *nam)
l2cap_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct l2cap_channel *pcb = so->so_pcb;
struct sockaddr_bt *sa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: rfcomm_socket.c,v 1.29 2014/07/31 15:16:06 rtr Exp $ */
/* $NetBSD: rfcomm_socket.c,v 1.30 2014/08/05 05:24:26 rtr Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.29 2014/07/31 15:16:06 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: rfcomm_socket.c,v 1.30 2014/08/05 05:24:26 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -142,7 +142,7 @@ rfcomm_accept(struct socket *so, struct mbuf *nam)
}
static int
rfcomm_bind(struct socket *so, struct mbuf *nam)
rfcomm_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct rfcomm_dlc *pcb = so->so_pcb;
struct sockaddr_bt *sa;
@ -164,7 +164,7 @@ rfcomm_bind(struct socket *so, struct mbuf *nam)
}
static int
rfcomm_listen(struct socket *so)
rfcomm_listen(struct socket *so, struct lwp *l)
{
struct rfcomm_dlc *pcb = so->so_pcb;
@ -177,7 +177,7 @@ rfcomm_listen(struct socket *so)
}
static int
rfcomm_connect(struct socket *so, struct mbuf *nam)
rfcomm_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct rfcomm_dlc *pcb = so->so_pcb;
struct sockaddr_bt *sa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sco_socket.c,v 1.29 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: sco_socket.c,v 1.30 2014/08/05 05:24:26 rtr Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.29 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: sco_socket.c,v 1.30 2014/08/05 05:24:26 rtr Exp $");
/* load symbolic names */
#ifdef BLUETOOTH_DEBUG
@ -125,7 +125,7 @@ sco_accept(struct socket *so, struct mbuf *nam)
}
static int
sco_bind(struct socket *so, struct mbuf *nam)
sco_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct sco_pcb *pcb = so->so_pcb;
struct sockaddr_bt *sa;
@ -147,7 +147,7 @@ sco_bind(struct socket *so, struct mbuf *nam)
}
static int
sco_listen(struct socket *so)
sco_listen(struct socket *so, struct lwp *l)
{
struct sco_pcb *pcb = so->so_pcb;
@ -160,7 +160,7 @@ sco_listen(struct socket *so)
}
static int
sco_connect(struct socket *so, struct mbuf *nam)
sco_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct sco_pcb *pcb = so->so_pcb;
struct sockaddr_bt *sa;

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_pcb.c,v 1.150 2014/08/03 22:11:50 rmind Exp $ */
/* $NetBSD: in_pcb.c,v 1.151 2014/08/05 05:24:26 rtr Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -93,7 +93,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.150 2014/08/03 22:11:50 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: in_pcb.c,v 1.151 2014/08/05 05:24:26 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -402,7 +402,7 @@ in_pcbbind_port(struct inpcb *inp, struct sockaddr_in *sin, kauth_cred_t cred)
}
int
in_pcbbind(void *v, struct mbuf *nam)
in_pcbbind(void *v, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = v;
struct sockaddr_in *sin = NULL; /* XXXGCC */
@ -428,12 +428,12 @@ in_pcbbind(void *v, struct mbuf *nam)
}
/* Bind address. */
error = in_pcbbind_addr(inp, sin, curlwp->l_cred);
error = in_pcbbind_addr(inp, sin, l->l_cred);
if (error)
return (error);
/* Bind port. */
error = in_pcbbind_port(inp, sin, curlwp->l_cred);
error = in_pcbbind_port(inp, sin, l->l_cred);
if (error) {
inp->inp_laddr.s_addr = INADDR_ANY;
@ -527,7 +527,7 @@ in_pcbconnect(void *v, struct mbuf *nam, struct lwp *l)
return (EADDRINUSE);
if (in_nullhost(inp->inp_laddr)) {
if (inp->inp_lport == 0) {
error = in_pcbbind(inp, NULL);
error = in_pcbbind(inp, NULL, l);
/*
* This used to ignore the return value
* completely, but we need to check for

View File

@ -1,4 +1,4 @@
/* $NetBSD: in_pcb.h,v 1.53 2014/07/24 15:12:03 rtr Exp $ */
/* $NetBSD: in_pcb.h,v 1.54 2014/08/05 05:24:26 rtr Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@ -131,7 +131,7 @@ struct inpcb {
#ifdef _KERNEL
void in_losing(struct inpcb *);
int in_pcballoc(struct socket *, void *);
int in_pcbbind(void *, struct mbuf *);
int in_pcbbind(void *, struct mbuf *, struct lwp *);
int in_pcbconnect(void *, struct mbuf *, struct lwp *);
void in_pcbdetach(void *);
void in_pcbdisconnect(void *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip.c,v 1.141 2014/08/03 11:44:52 rtr Exp $ */
/* $NetBSD: raw_ip.c,v 1.142 2014/08/05 05:24:26 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.141 2014/08/03 11:44:52 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip.c,v 1.142 2014/08/05 05:24:26 rtr Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -558,7 +558,7 @@ rip_accept(struct socket *so, struct mbuf *nam)
}
static int
rip_bind(struct socket *so, struct mbuf *nam)
rip_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = sotoinpcb(so);
struct sockaddr_in *addr;
@ -596,7 +596,7 @@ release:
}
static int
rip_listen(struct socket *so)
rip_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -604,7 +604,7 @@ rip_listen(struct socket *so)
}
static int
rip_connect(struct socket *so, struct mbuf *nam)
rip_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = sotoinpcb(so);
int error = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcp_usrreq.c,v 1.195 2014/08/02 03:55:26 rtr Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.196 2014/08/05 05:24:26 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.195 2014/08/02 03:55:26 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: tcp_usrreq.c,v 1.196 2014/08/05 05:24:26 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -737,7 +737,7 @@ tcp_accept(struct socket *so, struct mbuf *nam)
}
static int
tcp_bind(struct socket *so, struct mbuf *nam)
tcp_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
@ -760,12 +760,12 @@ tcp_bind(struct socket *so, struct mbuf *nam)
switch (so->so_proto->pr_domain->dom_family) {
#ifdef INET
case PF_INET:
error = in_pcbbind(inp, nam);
error = in_pcbbind(inp, nam, l);
break;
#endif
#ifdef INET6
case PF_INET6:
error = in6_pcbbind(in6p, nam);
error = in6_pcbbind(in6p, nam, l);
if (!error) {
/* mapped addr case */
if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_laddr))
@ -783,7 +783,7 @@ tcp_bind(struct socket *so, struct mbuf *nam)
}
static int
tcp_listen(struct socket *so)
tcp_listen(struct socket *so, struct lwp *l)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
@ -805,14 +805,14 @@ tcp_listen(struct socket *so)
s = splsoftnet();
#ifdef INET
if (inp && inp->inp_lport == 0) {
error = in_pcbbind(inp, NULL);
error = in_pcbbind(inp, NULL, l);
if (error)
goto release;
}
#endif
#ifdef INET6
if (in6p && in6p->in6p_lport == 0) {
error = in6_pcbbind(in6p, NULL);
error = in6_pcbbind(in6p, NULL, l);
if (error)
goto release;
}
@ -827,7 +827,7 @@ release:
}
static int
tcp_connect(struct socket *so, struct mbuf *nam)
tcp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = NULL;
struct in6pcb *in6p = NULL;
@ -854,21 +854,21 @@ tcp_connect(struct socket *so, struct mbuf *nam)
#ifdef INET
if (inp) {
if (inp->inp_lport == 0) {
error = in_pcbbind(inp, NULL);
error = in_pcbbind(inp, NULL, l);
if (error)
goto release;
}
error = in_pcbconnect(inp, nam, curlwp);
error = in_pcbconnect(inp, nam, l);
}
#endif
#ifdef INET6
if (in6p) {
if (in6p->in6p_lport == 0) {
error = in6_pcbbind(in6p, NULL);
error = in6_pcbbind(in6p, NULL, l);
if (error)
goto release;
}
error = in6_pcbconnect(in6p, nam, curlwp);
error = in6_pcbconnect(in6p, nam, l);
if (!error) {
/* mapped addr case */
if (IN6_IS_ADDR_V4MAPPED(&in6p->in6p_faddr))

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp_usrreq.c,v 1.213 2014/08/02 03:55:26 rtr Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.214 2014/08/05 05:24:26 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.213 2014/08/02 03:55:26 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp_usrreq.c,v 1.214 2014/08/05 05:24:26 rtr Exp $");
#include "opt_inet.h"
#include "opt_compat_netbsd.h"
@ -905,7 +905,7 @@ udp_accept(struct socket *so, struct mbuf *nam)
}
static int
udp_bind(struct socket *so, struct mbuf *nam)
udp_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = sotoinpcb(so);
int error = 0;
@ -916,14 +916,14 @@ udp_bind(struct socket *so, struct mbuf *nam)
KASSERT(nam != NULL);
s = splsoftnet();
error = in_pcbbind(inp, nam);
error = in_pcbbind(inp, nam, l);
splx(s);
return error;
}
static int
udp_listen(struct socket *so)
udp_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -931,7 +931,7 @@ udp_listen(struct socket *so)
}
static int
udp_connect(struct socket *so, struct mbuf *nam)
udp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct inpcb *inp = sotoinpcb(so);
int error = 0;
@ -942,7 +942,7 @@ udp_connect(struct socket *so, struct mbuf *nam)
KASSERT(nam != NULL);
s = splsoftnet();
error = in_pcbconnect(inp, nam, curlwp);
error = in_pcbconnect(inp, nam, l);
if (! error)
soisconnected(so);
splx(s);

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_pcb.c,v 1.127 2014/08/03 22:55:24 rmind Exp $ */
/* $NetBSD: in6_pcb.c,v 1.128 2014/08/05 05:24:27 rtr Exp $ */
/* $KAME: in6_pcb.c,v 1.84 2001/02/08 18:02:08 itojun Exp $ */
/*
@ -62,7 +62,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.127 2014/08/03 22:55:24 rmind Exp $");
__KERNEL_RCSID(0, "$NetBSD: in6_pcb.c,v 1.128 2014/08/05 05:24:27 rtr Exp $");
#include "opt_inet.h"
#include "opt_ipsec.h"
@ -362,7 +362,7 @@ in6_pcbbind_port(struct in6pcb *in6p, struct sockaddr_in6 *sin6, struct lwp *l)
}
int
in6_pcbbind(void *v, struct mbuf *nam)
in6_pcbbind(void *v, struct mbuf *nam, struct lwp *l)
{
struct in6pcb *in6p = v;
struct sockaddr_in6 lsin6;
@ -394,12 +394,12 @@ in6_pcbbind(void *v, struct mbuf *nam)
}
/* Bind address. */
error = in6_pcbbind_addr(in6p, sin6, curlwp);
error = in6_pcbbind_addr(in6p, sin6, l);
if (error)
return (error);
/* Bind port. */
error = in6_pcbbind_port(in6p, sin6, curlwp);
error = in6_pcbbind_port(in6p, sin6, l);
if (error) {
/*
* Reset the address here to "any" so we don't "leak" the
@ -540,7 +540,7 @@ in6_pcbconnect(void *v, struct mbuf *nam, struct lwp *l)
in6p->in6p_laddr.s6_addr32[3] == 0))
{
if (in6p->in6p_lport == 0) {
error = in6_pcbbind(in6p, NULL);
error = in6_pcbbind(in6p, NULL, l);
if (error != 0)
return error;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: in6_pcb.h,v 1.38 2014/07/24 15:12:03 rtr Exp $ */
/* $NetBSD: in6_pcb.h,v 1.39 2014/08/05 05:24:27 rtr Exp $ */
/* $KAME: in6_pcb.h,v 1.45 2001/02/09 05:59:46 itojun Exp $ */
/*
@ -154,7 +154,7 @@ struct in6pcb {
void in6_losing(struct in6pcb *);
void in6_pcbinit(struct inpcbtable *, int, int);
int in6_pcballoc(struct socket *, void *);
int in6_pcbbind(void *, struct mbuf *);
int in6_pcbbind(void *, struct mbuf *, struct lwp *);
int in6_pcbconnect(void *, struct mbuf *, struct lwp *);
void in6_pcbdetach(struct in6pcb *);
void in6_pcbdisconnect(struct in6pcb *);

View File

@ -1,4 +1,4 @@
/* $NetBSD: raw_ip6.c,v 1.132 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: raw_ip6.c,v 1.133 2014/08/05 05:24:27 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.132 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: raw_ip6.c,v 1.133 2014/08/05 05:24:27 rtr Exp $");
#include "opt_ipsec.h"
@ -653,7 +653,7 @@ rip6_accept(struct socket *so, struct mbuf *nam)
}
static int
rip6_bind(struct socket *so, struct mbuf *nam)
rip6_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct in6pcb *in6p = sotoin6pcb(so);
struct sockaddr_in6 *addr;
@ -691,7 +691,7 @@ rip6_bind(struct socket *so, struct mbuf *nam)
}
static int
rip6_listen(struct socket *so)
rip6_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -699,7 +699,7 @@ rip6_listen(struct socket *so)
}
static int
rip6_connect(struct socket *so, struct mbuf *nam)
rip6_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct in6pcb *in6p = sotoin6pcb(so);
struct sockaddr_in6 *addr;

View File

@ -1,4 +1,4 @@
/* $NetBSD: udp6_usrreq.c,v 1.111 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: udp6_usrreq.c,v 1.112 2014/08/05 05:24:27 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.111 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: udp6_usrreq.c,v 1.112 2014/08/05 05:24:27 rtr Exp $");
#include "opt_inet.h"
#include "opt_inet_csum.h"
@ -686,7 +686,7 @@ udp6_accept(struct socket *so, struct mbuf *nam)
}
static int
udp6_bind(struct socket *so, struct mbuf *nam)
udp6_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct in6pcb *in6p = sotoin6pcb(so);
int error = 0;
@ -696,13 +696,13 @@ udp6_bind(struct socket *so, struct mbuf *nam)
KASSERT(in6p != NULL);
s = splsoftnet();
error = in6_pcbbind(in6p, nam);
error = in6_pcbbind(in6p, nam, l);
splx(s);
return error;
}
static int
udp6_listen(struct socket *so)
udp6_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -710,7 +710,7 @@ udp6_listen(struct socket *so)
}
static int
udp6_connect(struct socket *so, struct mbuf *nam)
udp6_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
struct in6pcb *in6p = sotoin6pcb(so);
int error = 0;
@ -722,7 +722,7 @@ udp6_connect(struct socket *so, struct mbuf *nam)
if (!IN6_IS_ADDR_UNSPECIFIED(&in6p->in6p_faddr))
return EISCONN;
s = splsoftnet();
error = in6_pcbconnect(in6p, nam, curlwp);
error = in6_pcbconnect(in6p, nam, l);
splx(s);
if (error == 0)
soisconnected(so);

View File

@ -1,4 +1,4 @@
/* $NetBSD: keysock.c,v 1.39 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: keysock.c,v 1.40 2014/08/05 05:24:27 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.39 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: keysock.c,v 1.40 2014/08/05 05:24:27 rtr Exp $");
#include "opt_ipsec.h"
@ -495,7 +495,7 @@ key_accept(struct socket *so, struct mbuf *nam)
}
static int
key_bind(struct socket *so, struct mbuf *nam)
key_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
@ -503,7 +503,7 @@ key_bind(struct socket *so, struct mbuf *nam)
}
static int
key_listen(struct socket *so)
key_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -511,7 +511,7 @@ key_listen(struct socket *so)
}
static int
key_connect(struct socket *so, struct mbuf *nam)
key_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));

View File

@ -1,4 +1,4 @@
/* $NetBSD: mpls_proto.c,v 1.20 2014/07/31 05:37:00 rtr Exp $ */
/* $NetBSD: mpls_proto.c,v 1.21 2014/08/05 05:24:27 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.20 2014/07/31 05:37:00 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: mpls_proto.c,v 1.21 2014/08/05 05:24:27 rtr Exp $");
#include "opt_inet.h"
#include "opt_mbuftrace.h"
@ -103,7 +103,7 @@ mpls_accept(struct socket *so, struct mbuf *nam)
}
static int
mpls_bind(struct socket *so, struct mbuf *nam)
mpls_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
@ -111,7 +111,7 @@ mpls_bind(struct socket *so, struct mbuf *nam)
}
static int
mpls_listen(struct socket *so)
mpls_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -119,7 +119,7 @@ mpls_listen(struct socket *so)
}
static int
mpls_connect(struct socket *so, struct mbuf *nam)
mpls_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));

View File

@ -1,4 +1,4 @@
/* $NetBSD: natm.c,v 1.41 2014/07/31 03:39:35 rtr Exp $ */
/* $NetBSD: natm.c,v 1.42 2014/08/05 05:24:27 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.41 2014/07/31 03:39:35 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: natm.c,v 1.42 2014/08/05 05:24:27 rtr Exp $");
#include <sys/param.h>
#include <sys/kmem.h>
@ -106,7 +106,7 @@ natm_accept(struct socket *so, struct mbuf *nam)
}
static int
natm_bind(struct socket *so, struct mbuf *nam)
natm_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
@ -114,7 +114,7 @@ natm_bind(struct socket *so, struct mbuf *nam)
}
static int
natm_listen(struct socket *so)
natm_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -122,7 +122,7 @@ natm_listen(struct socket *so)
}
static int
natm_connect(struct socket *so, struct mbuf *nam)
natm_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
int error = 0, s2;
struct natmpcb *npcb;

View File

@ -1,4 +1,4 @@
/* $NetBSD: sockin.c,v 1.54 2014/07/31 03:39:36 rtr Exp $ */
/* $NetBSD: sockin.c,v 1.55 2014/08/05 05:24:27 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.54 2014/07/31 03:39:36 rtr Exp $");
__KERNEL_RCSID(0, "$NetBSD: sockin.c,v 1.55 2014/08/05 05:24:27 rtr Exp $");
#include <sys/param.h>
#include <sys/condvar.h>
@ -69,9 +69,9 @@ 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_bind(struct socket *, struct mbuf *);
static int sockin_listen(struct socket *);
static int sockin_connect(struct socket *, struct mbuf *);
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 *);
static int sockin_disconnect(struct socket *);
static int sockin_shutdown(struct socket *);
static int sockin_abort(struct socket *);
@ -485,7 +485,7 @@ sockin_accept(struct socket *so, struct mbuf *nam)
}
static int
sockin_bind(struct socket *so, struct mbuf *nam)
sockin_bind(struct socket *so, struct mbuf *nam, struct lwp *l)
{
KASSERT(solocked(so));
KASSERT(nam != NULL);
@ -496,7 +496,7 @@ sockin_bind(struct socket *so, struct mbuf *nam)
}
static int
sockin_listen(struct socket *so)
sockin_listen(struct socket *so, struct lwp *l)
{
KASSERT(solocked(so));
@ -504,7 +504,7 @@ sockin_listen(struct socket *so)
}
static int
sockin_connect(struct socket *so, struct mbuf *nam)
sockin_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
{
int error = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: protosw.h,v 1.56 2014/07/31 03:39:36 rtr Exp $ */
/* $NetBSD: protosw.h,v 1.57 2014/08/05 05:24:27 rtr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@ -239,9 +239,9 @@ struct pr_usrreqs {
int (*pr_attach)(struct socket *, int);
void (*pr_detach)(struct socket *);
int (*pr_accept)(struct socket *, struct mbuf *);
int (*pr_bind)(struct socket *, struct mbuf *);
int (*pr_listen)(struct socket *);
int (*pr_connect)(struct socket *, struct mbuf *);
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 *);
@ -312,29 +312,31 @@ name##_accept_wrapper(struct socket *a, struct mbuf *b) \
return rv; \
} \
static int \
name##_bind_wrapper(struct socket *a, struct mbuf *b) \
name##_bind_wrapper(struct socket *a, struct mbuf *b, \
struct lwp *c) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
rv = name##_bind(a, b); \
rv = name##_bind(a, b, c); \
KERNEL_UNLOCK_ONE(NULL); \
return rv; \
} \
static int \
name##_connect_wrapper(struct socket *a, struct mbuf *b)\
name##_connect_wrapper(struct socket *a, \
struct mbuf *b, struct lwp *c) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
rv = name##_connect(a, b); \
rv = name##_connect(a, b, c); \
KERNEL_UNLOCK_ONE(NULL); \
return rv; \
} \
static int \
name##_listen_wrapper(struct socket *a) \
name##_listen_wrapper(struct socket *a, struct lwp *b) \
{ \
int rv; \
KERNEL_LOCK(1, NULL); \
rv = name##_listen(a); \
rv = name##_listen(a, b); \
KERNEL_UNLOCK_ONE(NULL); \
return rv; \
} \

View File

@ -1,4 +1,4 @@
/* $NetBSD: un.h,v 1.52 2014/07/31 14:12:57 rtr Exp $ */
/* $NetBSD: un.h,v 1.53 2014/08/05 05:24:27 rtr Exp $ */
/*
* Copyright (c) 1982, 1986, 1993
@ -84,7 +84,7 @@ kmutex_t *uipc_dgramlock (void);
kmutex_t *uipc_streamlock (void);
kmutex_t *uipc_rawlock (void);
int unp_connect (struct socket *, struct mbuf *);
int unp_connect (struct socket *, struct mbuf *, struct lwp *);
int unp_connect2 (struct socket *, struct socket *, int);
void unp_dispose (struct mbuf *);
int unp_externalize (struct mbuf *, struct lwp *, int);