[PATCH 23/25] NFS: Add AF_INET6 support to nfs_try_mount()

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Chuck Lever
Date: Tuesday, November 13, 2007 - 11:33 am

Update nfs_try_mount() to support AF_INET6 family addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
---

 fs/nfs/super.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 3ea4a4f..2abef88 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1048,7 +1048,7 @@ out_unknown:
 static int nfs_try_mount(struct nfs_parsed_mount_data *args,
 			 struct nfs_fh *root_fh)
 {
-	struct sockaddr_in sin;
+	struct sockaddr *sap = (struct sockaddr *)&args->mount_server.address;
 	int status;
 	char *hostname;
 
@@ -1067,24 +1067,25 @@ static int nfs_try_mount(struct nfs_parsed_mount_data *args,
 	/*
 	 * Construct the mount server's address.
 	 */
-	if (args->mount_server.addrlen != 0)
-		memcpy(&sin, &args->mount_server.address, sizeof(sin));
-	else
-		memcpy(&sin, &args->nfs_server.address, sizeof(sin));
+	if (args->mount_server.addrlen == 0) {
+		memcpy(&args->mount_server.address,
+		       &args->nfs_server.address,
+		       args->nfs_server.addrlen);
+		args->mount_server.addrlen = args->nfs_server.addrlen;
+	}
 
 	/*
 	 * autobind will be used if mount_server.port == 0
 	 */
-	if (nfs_set_address_port((struct sockaddr *)&sin,
-					args->mount_server.port))
+	if (nfs_set_address_port(sap, args->mount_server.port))
 		return -EAFNOSUPPORT;
 
 	/*
 	 * Now ask the mount server to map our export path
 	 * to a file handle.
 	 */
-	status = nfs_mount((struct sockaddr *) &sin,
-			   sizeof(sin),
+	status = nfs_mount(sap,
+			   args->mount_server.addrlen,
 			   hostname,
 			   args->nfs_server.export_path,
 			   args->mount_server.version,

-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 23/25] NFS: Add AF_INET6 support to nfs_try_mount(), Chuck Lever, (Tue Nov 13, 11:33 am)