diff options
author | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-05-23 15:51:13 +0000 |
---|---|---|
committer | Thordur I. Bjornsson <thib@cvs.openbsd.org> | 2008-05-23 15:51:13 +0000 |
commit | 114f984d932b1f6810293178a80279f30cd2bd27 (patch) | |
tree | 1a1f583d1f42425cfd75dad816a48f3121aff8d0 /sys/net | |
parent | b9a20684fa94a5082c8e1df0b6f92099a2f7cb63 (diff) |
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.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/if.c | 6 | ||||
-rw-r--r-- | sys/net/pfkey.c | 20 | ||||
-rw-r--r-- | sys/net/raw_cb.h | 4 | ||||
-rw-r--r-- | sys/net/raw_usrreq.c | 5 | ||||
-rw-r--r-- | sys/net/route.h | 4 | ||||
-rw-r--r-- | sys/net/rtsock.c | 6 |
6 files changed, 23 insertions, 22 deletions
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) { |