Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Jun 2009 09:25:57 -0700
From:      Zachary Loafman <zml@FreeBSD.org>
To:        Martin <nakal@web.de>
Cc:        freebsd-current@freebsd.org
Subject:   Re: RPCPROG_MNT: RPC: Timed out / receiving NFS error when trying to mount NFS file system after make world
Message-ID:  <20090617162557.GA16254@isilon.com>
In-Reply-To: <Pine.GSO.4.63.0906171130290.13367@muncher.cs.uoguelph.ca>
References:  <4A2504AA.1020406@zedat.fu-berlin.de> <20090603235227.GB15659@hades.panopticon> <Pine.GSO.4.63.0906051107540.24102@muncher.cs.uoguelph.ca> <20090615173315.1cdb39e1@zelda.local> <Pine.GSO.4.63.0906151617390.8894@muncher.cs.uoguelph.ca> <20090616000758.714912e6@zelda.local> <Pine.GSO.4.63.0906161515370.23973@muncher.cs.uoguelph.ca> <20090616215803.4a3aa748@zelda.local> <Pine.GSO.4.63.0906171130290.13367@muncher.cs.uoguelph.ca>

next in thread | previous in thread | raw e-mail | index | archive | help

--DocE+STaALJfprDB
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Wed, Jun 17, 2009 at 11:35:19AM -0400, Rick Macklem wrote:
> One that might be worth trying is a pre-r192913 svc_dg.c. I'll email
> you a copy of that, in case you don't have an easy way to get one.

This was my rev, and may have some subtle issues on 8.0 (it was
originally a 6.x based patch). I've attached a lib/libc/rpc/svc_dg.c
patch from Rachel Hestilow that may fix your issue. Martin, can you test
it in your environment? I'll get it approved / checked in soon.

-- 
Zach Loafman | Staff Engineer | Isilon Systems

--DocE+STaALJfprDB
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="20090616-bug-55392.diff"

Index: svc_dg.c
===================================================================
--- svc_dg.c	(revision 120171)
+++ svc_dg.c	(working copy)
@@ -222,20 +222,25 @@ svc_dg_recvfrom(int fd, char *buf, int b
 	if (!have_lin)
 		return rlen;
 
 	lin->sin_family = AF_INET;
 	lin->sin_port = 0;
 	*laddrlen = sizeof(struct sockaddr_in);
 
 	return rlen;
 }
 
+/*
+ * Wrapper that acts like recvfrom. Captures the local address for
+ * incoming packets so that it can be sent out later using
+ * IP_SENDSRCADDR. 
+ */
 static bool_t
 svc_dg_recv(xprt, msg)
 	SVCXPRT *xprt;
 	struct rpc_msg *msg;
 {
 	struct svc_dg_data *su = su_data(xprt);
 	XDR *xdrs = &(su->su_xdrs);
 	char *reply;
 	struct sockaddr_storage ss;
 	socklen_t alen;
@@ -273,41 +278,45 @@ again:
 	if (su->su_cache != NULL) {
 		if (cache_get(xprt, msg, &reply, &replylen)) {
 			(void)_sendto(xprt->xp_fd, reply, replylen, 0,
 			    (struct sockaddr *)(void *)&ss, alen);
 			return (FALSE);
 		}
 	}
 	return (TRUE);
 }
 
+/*
+ * Wrapper for sendto. If laddr is set to a specific address,
+ * it will be sent out as a source address using IP_SENDSRCADDR.
+ */
 static int
 svc_dg_sendto(int fd, char *buf, int buflen,
     const struct sockaddr *raddr, socklen_t raddrlen,
     const struct sockaddr *laddr, socklen_t laddrlen)
 {
 	struct msghdr msg;
 	struct iovec msg_iov[1];
 	struct sockaddr_in *laddr_in = (struct sockaddr_in *)laddr;
 	struct in_addr *lin = &laddr_in->sin_addr;
 	char tmp[CMSG_SPACE(sizeof(*lin))];
 	struct cmsghdr *cmsg;
 	
 	memset((char *)&msg, 0, sizeof(msg));
 	msg_iov[0].iov_base = buf;
 	msg_iov[0].iov_len = buflen;
 	msg.msg_iov = msg_iov;
 	msg.msg_iovlen = 1;
 	msg.msg_namelen = raddrlen;
 	msg.msg_name = (char *)raddr;
 
-	if (laddr->sa_family == AF_INET) {
+	if (laddr->sa_family == AF_INET && lin->s_addr != INADDR_ANY) {
 		msg.msg_control = (caddr_t)tmp;
 		msg.msg_controllen = CMSG_LEN(sizeof(*lin));
 		cmsg = CMSG_FIRSTHDR(&msg);
 		cmsg->cmsg_len = CMSG_LEN(sizeof(*lin));
 		cmsg->cmsg_level = IPPROTO_IP;
 		cmsg->cmsg_type = IP_SENDSRCADDR;
 		memcpy(CMSG_DATA(cmsg), lin, sizeof(*lin));
 	}
 
 	return _sendmsg(fd, &msg, 0);

--DocE+STaALJfprDB--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20090617162557.GA16254>