summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorthib <thib@openbsd.org>2008-05-23 15:51:12 +0000
committerthib <thib@openbsd.org>2008-05-23 15:51:12 +0000
commit621c015e2fbe65fdf3205e452a522f5ed4896427 (patch)
tree55b799dfbba135124ee55d9ea801968c48dce9b3
parent- remove USER_LDT, it was never in a state where it would copile, nor will (diff)
downloadwireguard-openbsd-621c015e2fbe65fdf3205e452a522f5ed4896427.tar.xz
wireguard-openbsd-621c015e2fbe65fdf3205e452a522f5ed4896427.zip
Deal with the situation when TCP nfs mounts timeout and processes
get hung in nfs_reconnect() because they do not have the proper privilages to bind to a socket, by adding a struct proc * argument to sobind() (and the *_usrreq() routines, and finally in{6}_pcbbind) and do the sobind() with proc0 in nfs_connect. OK markus@, blambert@. "go ahead" deraadt@. Fixes an issue reported by bernd@ (Tested by bernd@). Fixes PR5135 too.
-rw-r--r--sys/kern/sys_socket.c6
-rw-r--r--sys/kern/uipc_socket.c35
-rw-r--r--sys/kern/uipc_socket2.c6
-rw-r--r--sys/kern/uipc_syscalls.c10
-rw-r--r--sys/kern/uipc_usrreq.c5
-rw-r--r--sys/net/if.c6
-rw-r--r--sys/net/pfkey.c20
-rw-r--r--sys/net/raw_cb.h4
-rw-r--r--sys/net/raw_usrreq.c5
-rw-r--r--sys/net/route.h4
-rw-r--r--sys/net/rtsock.c6
-rw-r--r--sys/netinet/in_pcb.c10
-rw-r--r--sys/netinet/in_pcb.h6
-rw-r--r--sys/netinet/ip_var.h4
-rw-r--r--sys/netinet/raw_ip.c4
-rw-r--r--sys/netinet/tcp_usrreq.c19
-rw-r--r--sys/netinet/tcp_var.h4
-rw-r--r--sys/netinet/udp_usrreq.c11
-rw-r--r--sys/netinet/udp_var.h4
-rw-r--r--sys/netinet6/in6_pcb.c8
-rw-r--r--sys/nfs/krpc_subr.c4
-rw-r--r--sys/nfs/nfs_socket.c8
-rw-r--r--sys/sys/protosw.h4
-rw-r--r--sys/sys/socketvar.h6
24 files changed, 102 insertions, 97 deletions
diff --git a/sys/kern/sys_socket.c b/sys/kern/sys_socket.c
index 0bde91ca287..9ebffb76bc8 100644
--- a/sys/kern/sys_socket.c
+++ b/sys/kern/sys_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_socket.c,v 1.11 2007/02/26 23:53:33 kurt Exp $ */
+/* $OpenBSD: sys_socket.c,v 1.12 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: sys_socket.c,v 1.13 1995/08/12 23:59:09 mycroft Exp $ */
/*
@@ -124,7 +124,7 @@ soo_ioctl(struct file *fp, u_long cmd, caddr_t data, struct proc *p)
if (IOCGROUP(cmd) == 'r')
return (rtioctl(cmd, data, p));
return ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
- (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)0));
+ (struct mbuf *)cmd, (struct mbuf *)data, (struct mbuf *)0, p));
}
int
@@ -169,7 +169,7 @@ soo_stat(struct file *fp, struct stat *ub, struct proc *p)
ub->st_mode = S_IFSOCK;
return ((*so->so_proto->pr_usrreq)(so, PRU_SENSE,
(struct mbuf *)ub, (struct mbuf *)0,
- (struct mbuf *)0));
+ (struct mbuf *)0, p));
}
/* ARGSUSED */
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 7422689fa11..4728d781d99 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket.c,v 1.69 2008/05/09 02:52:15 markus Exp $ */
+/* $OpenBSD: uipc_socket.c,v 1.70 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: uipc_socket.c,v 1.21 1996/02/04 02:17:52 christos Exp $ */
/*
@@ -117,7 +117,7 @@ socreate(int dom, struct socket **aso, int type, int proto)
so->so_cpid = p->p_pid;
so->so_proto = prp;
error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL,
- (struct mbuf *)(long)proto, NULL);
+ (struct mbuf *)(long)proto, NULL, p);
if (error) {
so->so_state |= SS_NOFDREF;
sofree(so);
@@ -137,12 +137,12 @@ socreate(int dom, struct socket **aso, int type, int proto)
}
int
-sobind(struct socket *so, struct mbuf *nam)
+sobind(struct socket *so, struct mbuf *nam, struct proc *p)
{
int s = splsoftnet();
int error;
- error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, NULL, nam, NULL);
+ error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, NULL, nam, NULL, p);
splx(s);
return (error);
}
@@ -152,7 +152,8 @@ solisten(struct socket *so, int backlog)
{
int s = splsoftnet(), error;
- error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL, NULL, NULL);
+ error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL, NULL, NULL,
+ curproc);
if (error) {
splx(s);
return (error);
@@ -239,7 +240,7 @@ soclose(struct socket *so)
drop:
if (so->so_pcb) {
int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH, NULL,
- NULL, NULL);
+ NULL, NULL, curproc);
if (error == 0)
error = error2;
}
@@ -260,7 +261,8 @@ soabort(struct socket *so)
{
splassert(IPL_SOFTNET);
- return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL, NULL, NULL);
+ return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL, NULL, NULL,
+ curproc);
}
int
@@ -275,7 +277,7 @@ soaccept(struct socket *so, struct mbuf *nam)
if ((so->so_state & SS_ISDISCONNECTED) == 0 ||
(so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0)
error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT, NULL,
- nam, NULL);
+ nam, NULL, curproc);
else
error = ECONNABORTED;
splx(s);
@@ -303,7 +305,7 @@ soconnect(struct socket *so, struct mbuf *nam)
error = EISCONN;
else
error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT,
- NULL, nam, NULL);
+ NULL, nam, NULL, curproc);
splx(s);
return (error);
}
@@ -315,7 +317,7 @@ soconnect2(struct socket *so1, struct socket *so2)
int error;
error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2, NULL,
- (struct mbuf *)so2, NULL);
+ (struct mbuf *)so2, NULL, curproc);
splx(s);
return (error);
}
@@ -335,7 +337,7 @@ sodisconnect(struct socket *so)
goto bad;
}
error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT, NULL, NULL,
- NULL);
+ NULL, curproc);
bad:
splx(s);
return (error);
@@ -501,7 +503,7 @@ nopages:
so->so_state &= ~SS_ISSENDING;
error = (*so->so_proto->pr_usrreq)(so,
(flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND,
- top, addr, control);
+ top, addr, control, curproc);
splx(s);
if (dontroute)
so->so_options &= ~SO_DONTROUTE;
@@ -568,7 +570,7 @@ soreceive(struct socket *so, struct mbuf **paddr, struct uio *uio,
if (flags & MSG_OOB) {
m = m_get(M_WAIT, MT_DATA);
error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m,
- (struct mbuf *)(long)(flags & MSG_PEEK), NULL);
+ (struct mbuf *)(long)(flags & MSG_PEEK), NULL, curproc);
if (error)
goto bad;
do {
@@ -584,7 +586,7 @@ bad:
if (mp)
*mp = NULL;
if (so->so_state & SS_ISCONFIRMING && uio->uio_resid)
- (*pr->pr_usrreq)(so, PRU_RCVD, NULL, NULL, NULL);
+ (*pr->pr_usrreq)(so, PRU_RCVD, NULL, NULL, NULL, curproc);
restart:
if ((error = sblock(&so->so_rcv, SBLOCKWAIT(flags))) != 0)
@@ -903,7 +905,7 @@ dontblock:
SBLASTMBUFCHK(&so->so_rcv, "soreceive 4");
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
(*pr->pr_usrreq)(so, PRU_RCVD, NULL,
- (struct mbuf *)(long)flags, NULL);
+ (struct mbuf *)(long)flags, NULL, curproc);
}
if (orig_resid == uio->uio_resid && orig_resid &&
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {
@@ -936,7 +938,8 @@ soshutdown(struct socket *so, int how)
return (0);
/* FALLTHROUGH */
case SHUT_WR:
- return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, NULL, NULL, NULL);
+ return (*pr->pr_usrreq)(so, PRU_SHUTDOWN, NULL, NULL, NULL,
+ curproc);
default:
return (EINVAL);
}
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c
index c5b9a9c246e..1cf4403f75d 100644
--- a/sys/kern/uipc_socket2.c
+++ b/sys/kern/uipc_socket2.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_socket2.c,v 1.43 2007/09/19 15:08:29 blambert Exp $ */
+/* $OpenBSD: uipc_socket2.c,v 1.44 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: uipc_socket2.c,v 1.11 1996/02/04 02:17:55 christos Exp $ */
/*
@@ -194,8 +194,8 @@ sonewconn(struct socket *head, int connstatus)
(void) soreserve(so, snd_sb_hiwat, rcv_sb_hiwat);
soqinsque(head, so, soqueue);
- if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH,
- (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0)) {
+ if ((*so->so_proto->pr_usrreq)(so, PRU_ATTACH, NULL, NULL, NULL,
+ curproc)) {
(void) soqremque(so, soqueue);
pool_put(&socket_pool, so);
return ((struct socket *)0);
diff --git a/sys/kern/uipc_syscalls.c b/sys/kern/uipc_syscalls.c
index b7f17d0186a..288f69c2097 100644
--- a/sys/kern/uipc_syscalls.c
+++ b/sys/kern/uipc_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_syscalls.c,v 1.67 2008/04/06 19:42:16 stefan Exp $ */
+/* $OpenBSD: uipc_syscalls.c,v 1.68 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: uipc_syscalls.c,v 1.19 1996/02/09 19:00:48 christos Exp $ */
/*
@@ -112,7 +112,7 @@ sys_bind(struct proc *p, void *v, register_t *retval)
error = sockargs(&nam, SCARG(uap, name), SCARG(uap, namelen),
MT_SONAME);
if (error == 0) {
- error = sobind(fp->f_data, nam);
+ error = sobind(fp->f_data, nam, p);
m_freem(nam);
}
FRELE(fp);
@@ -934,7 +934,7 @@ sys_getsockname(struct proc *p, void *v, register_t *retval)
goto bad;
so = fp->f_data;
m = m_getclr(M_WAIT, MT_SONAME);
- error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0);
+ error = (*so->so_proto->pr_usrreq)(so, PRU_SOCKADDR, 0, m, 0, p);
if (error)
goto bad;
if (len > m->m_len)
@@ -978,7 +978,7 @@ sys_getpeername(struct proc *p, void *v, register_t *retval)
if (error)
goto bad;
m = m_getclr(M_WAIT, MT_SONAME);
- error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, 0, m, 0);
+ error = (*so->so_proto->pr_usrreq)(so, PRU_PEERADDR, 0, m, 0, p);
if (error)
goto bad;
if (len > m->m_len)
@@ -1022,7 +1022,7 @@ sys_getpeereid(struct proc *p, void *v, register_t *retval)
error = ENOBUFS;
goto bad;
}
- error = (*so->so_proto->pr_usrreq)(so, PRU_PEEREID, 0, m, 0);
+ error = (*so->so_proto->pr_usrreq)(so, PRU_PEEREID, 0, m, 0, p);
if (!error && m->m_len != sizeof(struct unpcbid))
error = EOPNOTSUPP;
if (error)
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 20967b94b2e..f8792708406 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uipc_usrreq.c,v 1.42 2008/04/15 19:01:45 deraadt Exp $ */
+/* $OpenBSD: uipc_usrreq.c,v 1.43 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */
/*
@@ -62,12 +62,11 @@ ino_t unp_ino; /* prototype for fake inode numbers */
/*ARGSUSED*/
int
uipc_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control)
+ struct mbuf *control, struct proc *p)
{
struct unpcb *unp = sotounpcb(so);
struct socket *so2;
int error = 0;
- struct proc *p = curproc; /* XXX */
if (req == PRU_CONTROL)
return (EOPNOTSUPP);
diff --git a/sys/net/if.c b/sys/net/if.c
index 2d226cc12d4..37638c8bcb8 100644
--- a/sys/net/if.c
+++ b/sys/net/if.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if.c,v 1.170 2008/05/07 05:51:12 mpf Exp $ */
+/* $OpenBSD: if.c,v 1.171 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */
/*
@@ -1421,7 +1421,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
#if !defined(COMPAT_43) && !defined(COMPAT_LINUX) && !defined(COMPAT_SVR4)
error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
(struct mbuf *) cmd, (struct mbuf *) data,
- (struct mbuf *) ifp));
+ (struct mbuf *) ifp, p));
#else
{
u_long ocmd = cmd;
@@ -1461,7 +1461,7 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, struct proc *p)
}
error = ((*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
(struct mbuf *) cmd, (struct mbuf *) data,
- (struct mbuf *) ifp));
+ (struct mbuf *) ifp, p));
switch (ocmd) {
case OSIOCGIFADDR:
diff --git a/sys/net/pfkey.c b/sys/net/pfkey.c
index 7b6f92a8792..f80e0971966 100644
--- a/sys/net/pfkey.c
+++ b/sys/net/pfkey.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pfkey.c,v 1.17 2007/09/13 21:00:14 hshoexer Exp $ */
+/* $OpenBSD: pfkey.c,v 1.18 2008/05/23 15:51:12 thib Exp $ */
/*
* @(#)COPYRIGHT 1.1 (NRL) 17 January 1995
@@ -92,7 +92,7 @@ struct sockaddr pfkey_addr = { 2, PF_KEY, };
/* static struct domain pfkey_domain; */
static int pfkey_usrreq(struct socket *socket, int req, struct mbuf *mbuf,
- struct mbuf *nam, struct mbuf *control);
+ struct mbuf *nam, struct mbuf *control, struct proc *);
static int pfkey_output(struct mbuf *mbuf, struct socket *socket);
int pfkey_register(struct pfkey_version *version);
@@ -195,7 +195,7 @@ ret:
}
static int
-pfkey_attach(struct socket *socket, struct mbuf *proto)
+pfkey_attach(struct socket *socket, struct mbuf *proto, struct proc *p)
{
int rval;
int s;
@@ -205,7 +205,7 @@ pfkey_attach(struct socket *socket, struct mbuf *proto)
return (ENOMEM);
s = splnet();
- rval = raw_usrreq(socket, PRU_ATTACH, NULL, proto, NULL);
+ rval = raw_usrreq(socket, PRU_ATTACH, NULL, proto, NULL, p);
splx(s);
if (rval)
goto ret;
@@ -226,13 +226,13 @@ ret:
}
static int
-pfkey_detach(struct socket *socket)
+pfkey_detach(struct socket *socket, struct proc *p)
{
int rval, i, s;
rval = pfkey_versions[socket->so_proto->pr_protocol]->release(socket);
s = splnet();
- i = raw_usrreq(socket, PRU_DETACH, NULL, NULL, NULL);
+ i = raw_usrreq(socket, PRU_DETACH, NULL, NULL, NULL, p);
splx(s);
if (!rval)
@@ -243,7 +243,7 @@ pfkey_detach(struct socket *socket)
static int
pfkey_usrreq(struct socket *socket, int req, struct mbuf *mbuf,
- struct mbuf *nam, struct mbuf *control)
+ struct mbuf *nam, struct mbuf *control, struct proc *p)
{
int rval;
int s;
@@ -255,14 +255,14 @@ pfkey_usrreq(struct socket *socket, int req, struct mbuf *mbuf,
switch (req) {
case PRU_ATTACH:
- return (pfkey_attach(socket, nam));
+ return (pfkey_attach(socket, nam, p));
case PRU_DETACH:
- return (pfkey_detach(socket));
+ return (pfkey_detach(socket, p));
default:
s = splnet();
- rval = raw_usrreq(socket, req, mbuf, nam, control);
+ rval = raw_usrreq(socket, req, mbuf, nam, control, p);
splx(s);
}
diff --git a/sys/net/raw_cb.h b/sys/net/raw_cb.h
index 5cfd6d7ed4d..448607a77d2 100644
--- a/sys/net/raw_cb.h
+++ b/sys/net/raw_cb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_cb.h,v 1.6 2003/06/02 23:28:12 millert Exp $ */
+/* $OpenBSD: raw_cb.h,v 1.7 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: raw_cb.h,v 1.9 1996/02/13 22:00:41 christos Exp $ */
/*
@@ -65,7 +65,7 @@ void raw_disconnect(struct rawcb *);
void raw_init(void);
void raw_input(struct mbuf *, ...);
int raw_usrreq(struct socket *,
- int, struct mbuf *, struct mbuf *, struct mbuf *);
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
#endif /* _KERNEL */
#endif /* _NET_RAW_CB_H_ */
diff --git a/sys/net/raw_usrreq.c b/sys/net/raw_usrreq.c
index 039a3a06133..2df21ab09c1 100644
--- a/sys/net/raw_usrreq.c
+++ b/sys/net/raw_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_usrreq.c,v 1.10 2004/01/03 14:08:53 espie Exp $ */
+/* $OpenBSD: raw_usrreq.c,v 1.11 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: raw_usrreq.c,v 1.11 1996/02/13 22:00:43 christos Exp $ */
/*
@@ -147,10 +147,11 @@ raw_ctlinput(cmd, arg, d)
/*ARGSUSED*/
int
-raw_usrreq(so, req, m, nam, control)
+raw_usrreq(so, req, m, nam, control, p)
struct socket *so;
int req;
struct mbuf *m, *nam, *control;
+ struct proc *p;
{
struct rawcb *rp = sotorawcb(so);
int error = 0;
diff --git a/sys/net/route.h b/sys/net/route.h
index 56a5cb24eea..62ee41b5013 100644
--- a/sys/net/route.h
+++ b/sys/net/route.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.h,v 1.49 2008/05/07 05:14:21 claudio Exp $ */
+/* $OpenBSD: route.h,v 1.50 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $ */
/*
@@ -369,7 +369,7 @@ int rtable_add(u_int);
int rtable_exists(u_int);
int route_output(struct mbuf *, ...);
int route_usrreq(struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *);
+ struct mbuf *, struct mbuf *, struct proc *);
void rt_ifmsg(struct ifnet *);
void rt_ifannouncemsg(struct ifnet *, int);
void rt_maskedcopy(struct sockaddr *,
diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c
index 72d8b07446f..a193d931a52 100644
--- a/sys/net/rtsock.c
+++ b/sys/net/rtsock.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rtsock.c,v 1.70 2008/05/07 05:14:21 claudio Exp $ */
+/* $OpenBSD: rtsock.c,v 1.71 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */
/*
@@ -111,7 +111,7 @@ struct rt_msghdr *rtmsg_3to4(struct mbuf *, int *);
int
route_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control)
+ struct mbuf *control, struct proc *p)
{
int error = 0;
struct rawcb *rp = sotorawcb(so);
@@ -141,7 +141,7 @@ route_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
else
error = raw_attach(so, (int)(long)nam);
} else
- error = raw_usrreq(so, req, m, nam, control);
+ error = raw_usrreq(so, req, m, nam, control, p);
rp = sotorawcb(so);
if (req == PRU_ATTACH && rp) {
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c
index ad69036f1c5..64584522347 100644
--- a/sys/netinet/in_pcb.c
+++ b/sys/netinet/in_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.c,v 1.98 2008/05/15 19:40:38 markus Exp $ */
+/* $OpenBSD: in_pcb.c,v 1.99 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */
/*
@@ -232,23 +232,23 @@ in_pcballoc(so, v)
}
int
-in_pcbbind(v, nam)
+in_pcbbind(v, nam, p)
void *v;
struct mbuf *nam;
+ struct proc *p;
{
struct inpcb *inp = v;
struct socket *so = inp->inp_socket;
struct inpcbtable *table = inp->inp_table;
u_int16_t *lastport = &inp->inp_table->inpt_lastport;
struct sockaddr_in *sin;
- struct proc *p = curproc; /* XXX */
u_int16_t lport = 0;
int wild = 0, reuseport = (so->so_options & SO_REUSEPORT);
int error;
#ifdef INET6
if (sotopf(so) == PF_INET6)
- return in6_pcbbind(inp, nam);
+ return in6_pcbbind(inp, nam, p);
#endif /* INET6 */
if (TAILQ_EMPTY(&in_ifaddr))
@@ -434,7 +434,7 @@ in_pcbconnect(v, nam)
return (EADDRINUSE);
if (inp->inp_laddr.s_addr == INADDR_ANY) {
if (inp->inp_lport == 0 &&
- in_pcbbind(inp, (struct mbuf *)0) == EADDRNOTAVAIL)
+ in_pcbbind(inp, NULL, curproc) == EADDRNOTAVAIL)
return (EADDRNOTAVAIL);
inp->inp_laddr = ifaddr->sin_addr;
}
diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h
index cebbdba4172..194f23585da 100644
--- a/sys/netinet/in_pcb.h
+++ b/sys/netinet/in_pcb.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: in_pcb.h,v 1.62 2008/05/15 19:40:38 markus Exp $ */
+/* $OpenBSD: in_pcb.h,v 1.63 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */
/*
@@ -240,7 +240,7 @@ struct baddynamicports {
void in_losing(struct inpcb *);
int in_pcballoc(struct socket *, void *);
-int in_pcbbind(void *, struct mbuf *);
+int in_pcbbind(void *, struct mbuf *, struct proc *);
int in_pcbconnect(void *, struct mbuf *);
void in_pcbdetach(void *);
void in_pcbdisconnect(void *);
@@ -257,7 +257,7 @@ struct inpcb *
struct inpcb *
in6_pcblookup_listen(struct inpcbtable *,
struct in6_addr *, u_int, int, struct mbuf *);
-int in6_pcbbind(struct inpcb *, struct mbuf *);
+int in6_pcbbind(struct inpcb *, struct mbuf *, struct proc *);
int in6_pcbconnect(struct inpcb *, struct mbuf *);
int in6_setsockaddr(struct inpcb *, struct mbuf *);
int in6_setpeeraddr(struct inpcb *, struct mbuf *);
diff --git a/sys/netinet/ip_var.h b/sys/netinet/ip_var.h
index b6ea372229f..bc72a08ff57 100644
--- a/sys/netinet/ip_var.h
+++ b/sys/netinet/ip_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ip_var.h,v 1.37 2007/09/18 18:56:02 markus Exp $ */
+/* $OpenBSD: ip_var.h,v 1.38 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: ip_var.h,v 1.16 1996/02/13 23:43:20 christos Exp $ */
/*
@@ -192,6 +192,6 @@ void rip_init(void);
void rip_input(struct mbuf *, ...);
int rip_output(struct mbuf *, ...);
int rip_usrreq(struct socket *,
- int, struct mbuf *, struct mbuf *, struct mbuf *);
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
#endif /* _KERNEL */
#endif /* _NETINET_IP_VAR_H_ */
diff --git a/sys/netinet/raw_ip.c b/sys/netinet/raw_ip.c
index 1b45549be3c..051d260c51d 100644
--- a/sys/netinet/raw_ip.c
+++ b/sys/netinet/raw_ip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: raw_ip.c,v 1.43 2008/05/09 02:52:15 markus Exp $ */
+/* $OpenBSD: raw_ip.c,v 1.44 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: raw_ip.c,v 1.25 1996/02/18 18:58:33 christos Exp $ */
/*
@@ -345,7 +345,7 @@ u_long rip_recvspace = RIPRCVQ;
/*ARGSUSED*/
int
rip_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
- struct mbuf *control)
+ struct mbuf *control, struct proc *p)
{
int error = 0;
struct inpcb *inp = sotoinpcb(so);
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 9752c57b043..c0918876e48 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_usrreq.c,v 1.97 2008/05/15 19:40:38 markus Exp $ */
+/* $OpenBSD: tcp_usrreq.c,v 1.98 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */
/*
@@ -134,7 +134,7 @@ tcp6_usrreq(so, req, m, nam, control, p)
struct proc *p;
{
- return tcp_usrreq(so, req, m, nam, control);
+ return tcp_usrreq(so, req, m, nam, control, p);
}
#endif
@@ -145,10 +145,11 @@ tcp6_usrreq(so, req, m, nam, control, p)
*/
/*ARGSUSED*/
int
-tcp_usrreq(so, req, m, nam, control)
+tcp_usrreq(so, req, m, nam, control, p)
struct socket *so;
int req;
struct mbuf *m, *nam, *control;
+ struct proc *p;
{
struct sockaddr_in *sin;
struct inpcb *inp;
@@ -239,10 +240,10 @@ tcp_usrreq(so, req, m, nam, control)
case PRU_BIND:
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
- error = in6_pcbbind(inp, nam);
+ error = in6_pcbbind(inp, nam, p);
else
#endif
- error = in_pcbbind(inp, nam);
+ error = in_pcbbind(inp, nam, p);
if (error)
break;
break;
@@ -254,10 +255,10 @@ tcp_usrreq(so, req, m, nam, control)
if (inp->inp_lport == 0) {
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
- error = in6_pcbbind(inp, NULL);
+ error = in6_pcbbind(inp, NULL, p);
else
#endif
- error = in_pcbbind(inp, NULL);
+ error = in_pcbbind(inp, NULL, p);
}
/* If the in_pcbbind() above is called, the tp->pf
should still be whatever it was before. */
@@ -291,7 +292,7 @@ tcp_usrreq(so, req, m, nam, control)
}
if (inp->inp_lport == 0) {
- error = in6_pcbbind(inp, NULL);
+ error = in6_pcbbind(inp, NULL, p);
if (error)
break;
}
@@ -307,7 +308,7 @@ tcp_usrreq(so, req, m, nam, control)
}
if (inp->inp_lport == 0) {
- error = in_pcbbind(inp, NULL);
+ error = in_pcbbind(inp, NULL, p);
if (error)
break;
}
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 51cf640a800..c707e1499bd 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcp_var.h,v 1.87 2008/05/06 08:47:36 markus Exp $ */
+/* $OpenBSD: tcp_var.h,v 1.88 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */
/*
@@ -600,7 +600,7 @@ int tcp6_usrreq(struct socket *,
int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
#endif
int tcp_usrreq(struct socket *,
- int, struct mbuf *, struct mbuf *, struct mbuf *);
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
void tcp_xmit_timer(struct tcpcb *, int);
void tcpdropoldhalfopen(struct tcpcb *, u_int16_t);
#ifdef TCP_SACK
diff --git a/sys/netinet/udp_usrreq.c b/sys/netinet/udp_usrreq.c
index 1bcd75bbe20..088d9d50e3f 100644
--- a/sys/netinet/udp_usrreq.c
+++ b/sys/netinet/udp_usrreq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_usrreq.c,v 1.119 2008/05/15 19:40:38 markus Exp $ */
+/* $OpenBSD: udp_usrreq.c,v 1.120 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: udp_usrreq.c,v 1.28 1996/03/16 23:54:03 christos Exp $ */
/*
@@ -1011,16 +1011,17 @@ udp6_usrreq(so, req, m, addr, control, p)
struct proc *p;
{
- return udp_usrreq(so, req, m, addr, control);
+ return udp_usrreq(so, req, m, addr, control, p);
}
#endif
/*ARGSUSED*/
int
-udp_usrreq(so, req, m, addr, control)
+udp_usrreq(so, req, m, addr, control, p)
struct socket *so;
int req;
struct mbuf *m, *addr, *control;
+ struct proc *p;
{
struct inpcb *inp = sotoinpcb(so);
int error = 0;
@@ -1076,10 +1077,10 @@ udp_usrreq(so, req, m, addr, control)
s = splsoftnet();
#ifdef INET6
if (inp->inp_flags & INP_IPV6)
- error = in6_pcbbind(inp, addr);
+ error = in6_pcbbind(inp, addr, p);
else
#endif
- error = in_pcbbind(inp, addr);
+ error = in_pcbbind(inp, addr, p);
splx(s);
break;
diff --git a/sys/netinet/udp_var.h b/sys/netinet/udp_var.h
index 943711bf1e6..eaba606ca7f 100644
--- a/sys/netinet/udp_var.h
+++ b/sys/netinet/udp_var.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: udp_var.h,v 1.17 2007/12/13 20:00:53 reyk Exp $ */
+/* $OpenBSD: udp_var.h,v 1.18 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: udp_var.h,v 1.12 1996/02/13 23:44:41 christos Exp $ */
/*
@@ -118,6 +118,6 @@ int udp6_output(struct inpcb *, struct mbuf *, struct mbuf *,
int udp_output(struct mbuf *, ...);
int udp_sysctl(int *, u_int, void *, size_t *, void *, size_t);
int udp_usrreq(struct socket *,
- int, struct mbuf *, struct mbuf *, struct mbuf *);
+ int, struct mbuf *, struct mbuf *, struct mbuf *, struct proc *);
#endif /* _KERNEL */
#endif /* _NETINET_UDP_VAR_H_ */
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 3e25e487f7d..e9bc2efb6c2 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: in6_pcb.c,v 1.45 2008/05/19 14:58:29 markus Exp $ */
+/* $OpenBSD: in6_pcb.c,v 1.46 2008/05/23 15:51:12 thib Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -162,15 +162,15 @@ u_char inet6ctlerrmap[PRC_NCMDS] = {
* Bind an address (or at least a port) to an PF_INET6 socket.
*/
int
-in6_pcbbind(inp, nam)
+in6_pcbbind(inp, nam, p)
struct inpcb *inp;
struct mbuf *nam;
+ struct proc *p;
{
struct socket *so = inp->inp_socket;
struct inpcbtable *head = inp->inp_table;
struct sockaddr_in6 *sin6;
- struct proc *p = curproc; /* XXX */
u_short lport = 0;
int wild = INPLOOKUP_IPV6, reuseport = (so->so_options & SO_REUSEPORT);
int error;
@@ -465,7 +465,7 @@ in6_pcbconnect(inp, nam)
}
if (IN6_IS_ADDR_UNSPECIFIED(&inp->inp_laddr6)) {
if (inp->inp_lport == 0)
- (void)in6_pcbbind(inp, (struct mbuf *)0);
+ (void)in6_pcbbind(inp, NULL, curproc);
inp->inp_laddr6 = *in6a;
}
inp->inp_faddr6 = sin6->sin6_addr;
diff --git a/sys/nfs/krpc_subr.c b/sys/nfs/krpc_subr.c
index 1cca563d73f..39dfe6ffa59 100644
--- a/sys/nfs/krpc_subr.c
+++ b/sys/nfs/krpc_subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: krpc_subr.c,v 1.14 2007/02/27 19:09:56 deraadt Exp $ */
+/* $OpenBSD: krpc_subr.c,v 1.15 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: krpc_subr.c,v 1.12.4.1 1996/06/07 00:52:26 cgd Exp $ */
/*
@@ -268,7 +268,7 @@ krpc_call(sa, prog, vers, func, data, from_p, retries)
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
sin->sin_port = htons(0);
- error = sobind(so, m);
+ error = sobind(so, m, &proc0);
m_freem(m);
if (error) {
printf("bind failed\n");
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index dc1d0d0441c..0eb9633b4e1 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.58 2008/05/13 17:47:42 thib Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.59 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -187,7 +187,7 @@ nfs_connect(nmp, rep)
sin->sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY;
sin->sin_port = htons(0);
- error = sobind(so, m);
+ error = sobind(so, m, &proc0);
m_freem(m);
if (error)
goto bad;
@@ -1239,10 +1239,10 @@ nfs_timer(arg)
(m = m_copym(rep->r_mreq, 0, M_COPYALL, M_DONTWAIT))){
if ((nmp->nm_flag & NFSMNT_NOCONN) == 0)
error = (*so->so_proto->pr_usrreq)(so, PRU_SEND, m,
- (struct mbuf *)0, (struct mbuf *)0);
+ (struct mbuf *)0, (struct mbuf *)0, curproc);
else
error = (*so->so_proto->pr_usrreq)(so, PRU_SEND, m,
- nmp->nm_nam, (struct mbuf *)0);
+ nmp->nm_nam, (struct mbuf *)0, curproc);
if (error) {
if (NFSIGNORE_SOERROR(nmp->nm_soflags, error))
so->so_error = 0;
diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h
index 821b58cc406..e8242bd0fae 100644
--- a/sys/sys/protosw.h
+++ b/sys/sys/protosw.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: protosw.h,v 1.10 2007/09/12 18:45:14 mk Exp $ */
+/* $OpenBSD: protosw.h,v 1.11 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */
/*-
@@ -79,7 +79,7 @@ struct protosw {
/* user-protocol hook */
/* user request: see list below */
int (*pr_usrreq)(struct socket *, int, struct mbuf *,
- struct mbuf *, struct mbuf *);
+ struct mbuf *, struct mbuf *, struct proc *);
/* utility hooks */
void (*pr_init)(void); /* initialization hook */
diff --git a/sys/sys/socketvar.h b/sys/sys/socketvar.h
index ad4a935f4d2..cdbe4029597 100644
--- a/sys/sys/socketvar.h
+++ b/sys/sys/socketvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: socketvar.h,v 1.40 2007/07/05 09:04:04 dim Exp $ */
+/* $OpenBSD: socketvar.h,v 1.41 2008/05/23 15:51:12 thib Exp $ */
/* $NetBSD: socketvar.h,v 1.18 1996/02/09 18:25:38 christos Exp $ */
/*-
@@ -252,7 +252,7 @@ int soo_kqfilter(struct file *fp, struct knote *kn);
int soo_close(struct file *fp, struct proc *p);
int soo_stat(struct file *, struct stat *, struct proc *);
int uipc_usrreq(struct socket *, int , struct mbuf *,
- struct mbuf *, struct mbuf *);
+ struct mbuf *, struct mbuf *, struct proc *);
void sbappend(struct sockbuf *sb, struct mbuf *m);
void sbappendstream(struct sockbuf *sb, struct mbuf *m);
int sbappendaddr(struct sockbuf *sb, struct sockaddr *asa,
@@ -276,7 +276,7 @@ int sb_lock(struct sockbuf *sb);
void soinit(void);
int soabort(struct socket *so);
int soaccept(struct socket *so, struct mbuf *nam);
-int sobind(struct socket *so, struct mbuf *nam);
+int sobind(struct socket *so, struct mbuf *nam, struct proc *p);
void socantrcvmore(struct socket *so);
void socantsendmore(struct socket *so);
int soclose(struct socket *so);