]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
NFS: Adjust nfs_clone_mount structure to store "struct sockaddr *"
authorChuck Lever <chuck.lever@oracle.com>
Mon, 10 Dec 2007 19:59:06 +0000 (14:59 -0500)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Wed, 30 Jan 2008 07:05:56 +0000 (02:05 -0500)
Change the addr field in the nfs_clone_mount structure to store a "struct
sockaddr *" to support non-IPv4 addresses in the NFS client.

Note this is mostly a cosmetic change, and does not actually allow
referrals using IPv6 addresses.  The existing referral code assumes that
the server returns a string that represents an IPv4 address.  This code
needs to support hostnames and IPv6 addresses as well as IPv4 addresses,
thus it will need to be reorganized completely (to handle DNS resolution
in user space).

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
fs/nfs/client.c
fs/nfs/internal.h
fs/nfs/nfs4namespace.c

index 11380601fc784cbad9066aae9262043ecba2b2e4..ba114faf195fda8b542bf7ec58624be3b0f3fc4b 100644 (file)
@@ -1094,8 +1094,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
        /* Get a client representation.
         * Note: NFSv4 always uses TCP, */
        error = nfs4_set_client(server, data->hostname,
-                               (struct sockaddr *)data->addr,
-                               sizeof(*data->addr),
+                               data->addr,
+                               data->addrlen,
                                parent_client->cl_ipaddr,
                                data->authflavor,
                                parent_server->client->cl_xprt->prot,
index c8458b16801820a436aff461528e38f2c08ab4c7..75dd4e252cae5031213a9e9aea0e26275892f83b 100644 (file)
@@ -21,7 +21,8 @@ struct nfs_clone_mount {
        struct nfs_fattr *fattr;
        char *hostname;
        char *mnt_path;
-       struct sockaddr_in *addr;
+       struct sockaddr *addr;
+       size_t addrlen;
        rpc_authflavor_t authflavor;
 };
 
index bd1b1617905d635bd6ba586fccbaa1bcbbbcc89a..5f9ba41ed5bfa6b175ef38f1f54bcb4986b26b29 100644 (file)
@@ -172,7 +172,10 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
 
                s = 0;
                while (s < location->nservers) {
-                       struct sockaddr_in addr = {};
+                       struct sockaddr_in addr = {
+                               .sin_family     = AF_INET,
+                               .sin_port       = htons(NFS_PORT),
+                       };
 
                        if (location->servers[s].len <= 0 ||
                            valid_ipaddr4(location->servers[s].data) < 0) {
@@ -181,10 +184,9 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
                        }
 
                        mountdata.hostname = location->servers[s].data;
-                       addr.sin_addr.s_addr = in_aton(mountdata.hostname);
-                       addr.sin_family = AF_INET;
-                       addr.sin_port = htons(NFS_PORT);
-                       mountdata.addr = &addr;
+                       addr.sin_addr.s_addr = in_aton(mountdata.hostname),
+                       mountdata.addr = (struct sockaddr *)&addr;
+                       mountdata.addrlen = sizeof(addr);
 
                        snprintf(page, PAGE_SIZE, "%s:%s",
                                        mountdata.hostname,