提交 6677d095 编写于 作者: C Chuck Lever 提交者: Trond Myklebust

NFS: Adjust nfs_clone_mount structure to store "struct sockaddr *"

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: NChuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: NTrond Myklebust <Trond.Myklebust@netapp.com>
上级 dcecae0f
...@@ -1094,8 +1094,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data, ...@@ -1094,8 +1094,8 @@ struct nfs_server *nfs4_create_referral_server(struct nfs_clone_mount *data,
/* Get a client representation. /* Get a client representation.
* Note: NFSv4 always uses TCP, */ * Note: NFSv4 always uses TCP, */
error = nfs4_set_client(server, data->hostname, error = nfs4_set_client(server, data->hostname,
(struct sockaddr *)data->addr, data->addr,
sizeof(*data->addr), data->addrlen,
parent_client->cl_ipaddr, parent_client->cl_ipaddr,
data->authflavor, data->authflavor,
parent_server->client->cl_xprt->prot, parent_server->client->cl_xprt->prot,
......
...@@ -21,7 +21,8 @@ struct nfs_clone_mount { ...@@ -21,7 +21,8 @@ struct nfs_clone_mount {
struct nfs_fattr *fattr; struct nfs_fattr *fattr;
char *hostname; char *hostname;
char *mnt_path; char *mnt_path;
struct sockaddr_in *addr; struct sockaddr *addr;
size_t addrlen;
rpc_authflavor_t authflavor; rpc_authflavor_t authflavor;
}; };
......
...@@ -172,7 +172,10 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent, ...@@ -172,7 +172,10 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
s = 0; s = 0;
while (s < location->nservers) { 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 || if (location->servers[s].len <= 0 ||
valid_ipaddr4(location->servers[s].data) < 0) { valid_ipaddr4(location->servers[s].data) < 0) {
...@@ -181,10 +184,9 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent, ...@@ -181,10 +184,9 @@ static struct vfsmount *nfs_follow_referral(const struct vfsmount *mnt_parent,
} }
mountdata.hostname = location->servers[s].data; mountdata.hostname = location->servers[s].data;
addr.sin_addr.s_addr = in_aton(mountdata.hostname); addr.sin_addr.s_addr = in_aton(mountdata.hostname),
addr.sin_family = AF_INET; mountdata.addr = (struct sockaddr *)&addr;
addr.sin_port = htons(NFS_PORT); mountdata.addrlen = sizeof(addr);
mountdata.addr = &addr;
snprintf(page, PAGE_SIZE, "%s:%s", snprintf(page, PAGE_SIZE, "%s:%s",
mountdata.hostname, mountdata.hostname,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册