Re: NFSD IPv6 support for 2.6.29

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Nov 17, 2008, at Nov 17, 2008, 12:52 PM, Le Rouzic wrote:
Chuck Lever a écrit :

On Nov 10, 2008, at 12:15 AM, Varun Chandramohan wrote:

Chuck Lever wrote:

Hi Aime, Varun-

Bruce asked me to collect server-side IPv6 patches for upstream.
I've collected the patches that have been posted on the list, and
added some fixes of my own.

Can you have a look at

http://git.linux-nfs.org/?p=cel/cel-2.6.git;a=summary

tag cel-ipv6-10292008

These have been build tested, but I haven't done any run-time
testing yet.

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com


Hi Chuck,

             I just realized that i forgot to update you about the
test result of your tree. I found NFSv4 over ipv6 working well. So
it can be pulled into the mainline soon.

Hi
I have tested the "tag cel-ipv6-10292008" and some robustness tests
started simultaneously (connectathon, fsx, iozone, fss_stress, ffsb) have
been running fine during several hours in IPV6 and IPV4.
I used the my nfs-utils package based on nfs-utils.1.1.2
(http://nfsv4.bullopensource.org/)

Thanks for the review and testing.

Nevertheless I may have missed something during the last mails about IPV6
but I don't find in your tree changes about IPV6 in fs/nfsd/nfsctl.c

I join the patch I submitted for that.

write_getfs() and write_getfd() use a fixed size field in the down call that is too small for IPv6 addresses. That field is defined as a "struct sockaddr", but that type is meant only to be used for a pointer (as in "struct sockaddr *"). It happens to be the same size as a sockaddr_in, but it is much smaller than an IPv6 address.

The modern preferred interface is /proc/fs/nfsd/filehandle. See the comments I added in fs/nfsd/nfsctl.c that describe the whole NFSD interface. As far as I can tell, no changes are needed in write_filehandle() to support IPv6.

--
-----------------------------------------------------------------
Company : Bull, Architect of an Open World TM (www.bull.com)
Name    : Aime Le Rouzic
Mail    : Bull - BP 208 - 38432 Echirolles Cedex - France
E-Mail  : aime.le-rouzic@xxxxxxxx
Phone   : 33 (4) 76.29.75.51
Fax     : 33 (4) 76.29.75.18
-----------------------------------------------------------------


NFSV4 IPV6: Adds AF_INET6 domain processing when AF_INET processing only available in nfsd/nfsctl.c

---

fs/nfsd/nfsctl.c     |   41 +++++++++++++++++++++++++++++++----------

Signed-off-by: Aime Le Rouzic <aime.le-rouzic@xxxxxxxx>
---
diff -Nru rpcbindv4/fs/nfsd/nfsctl.c ipv6overrpcbindv4/fs/nfsd/ nfsctl.c
--- rpcbindv4/fs/nfsd/nfsctl.c	2008-09-15 14:50:09.000000000 +0200
+++ ipv6overrpcbindv4/fs/nfsd/nfsctl.c 2008-09-15 15:18:24.000000000 +0200
@@ -230,6 +230,7 @@
{
	struct nfsctl_fsparm *data;
	struct sockaddr_in *sin;
+	struct sockaddr_in6 *sin6;
	struct auth_domain *clp;
	int err = 0;
	struct knfsd_fh *res;
@@ -239,9 +240,19 @@
		return -EINVAL;
	data = (struct nfsctl_fsparm*)buf;
	err = -EPROTONOSUPPORT;
-	if (data->gd_addr.sa_family != AF_INET)
+	switch (data->gd_addr.sa_family) {
+	case AF_INET:
+		sin = (struct sockaddr_in *)&data->gd_addr;
+		ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
+		break;
+	case AF_INET6:
+		sin6 = (struct sockaddr_in6 *)&data->gd_addr;
+		ipv6_addr_copy(&in6, &sin6->sin6_addr);
+		break;
+	default:
		goto out;
-	sin = (struct sockaddr_in *)&data->gd_addr;
+	}
+
	if (data->gd_maxlen > NFS3_FHSIZE)
		data->gd_maxlen = NFS3_FHSIZE;

@@ -249,8 +260,6 @@

	exp_readlock();

-	ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
-
	clp = auth_unix_lookup(&in6);
	if (!clp)
		err = -EPERM;
@@ -269,6 +278,7 @@
{
	struct nfsctl_fdparm *data;
	struct sockaddr_in *sin;
+	struct sockaddr_in6 *sin6;
	struct auth_domain *clp;
	int err = 0;
	struct knfsd_fh fh;
@@ -279,20 +289,31 @@
		return -EINVAL;
	data = (struct nfsctl_fdparm*)buf;
	err = -EPROTONOSUPPORT;
-	if (data->gd_addr.sa_family != AF_INET)
+	if (data->gd_addr.sa_family != AF_INET &&
+	    data->gd_addr.sa_family != AF_INET6)
		goto out;
+
	err = -EINVAL;
	if (data->gd_version < 2 || data->gd_version > NFSSVC_MAXVERS)
		goto out;

	res = buf;
-	sin = (struct sockaddr_in *)&data->gd_addr;
	exp_readlock();

-	ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
+	switch (data->gd_addr.sa_family) {
+	case AF_INET:
+		sin = (struct sockaddr_in *)&data->gd_addr;
+		ipv6_addr_set_v4mapped(sin->sin_addr.s_addr, &in6);
+		break;
+	case AF_INET6:
+		sin6 = (struct sockaddr_in6 *)&data->gd_addr;
+		ipv6_addr_copy(&in6, &sin6->sin6_addr);
+		break;
+	default:
+		goto out;
+	}

-	clp = auth_unix_lookup(&in6);
-	if (!clp)
+	if (!(clp = auth_unix_lookup(&in6)))
		err = -EPERM;
	else {
		err = exp_rootfh(clp, data->gd_path, &fh, NFS_FHSIZE);
@@ -305,7 +326,7 @@
		memcpy(res, &fh.fh_base, fh.fh_size);
		err = NFS_FHSIZE;
	}
- out:
+out:
	return err;
}

--
Chuck Lever
chuck[dot]lever[at]oracle[dot]com--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux