From 114f984d932b1f6810293178a80279f30cd2bd27 Mon Sep 17 00:00:00 2001 From: "Thordur I. Bjornsson" Date: Fri, 23 May 2008 15:51:13 +0000 Subject: 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. --- sys/netinet/in_pcb.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sys/netinet/in_pcb.c') 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; } -- cgit v1.2.3