diff options
Diffstat (limited to 'fs/nfs/nfs4namespace.c')
-rw-r--r-- | fs/nfs/nfs4namespace.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/fs/nfs/nfs4namespace.c b/fs/nfs/nfs4namespace.c index 2a2a0a7143ad..fa3408f20112 100644 --- a/fs/nfs/nfs4namespace.c +++ b/fs/nfs/nfs4namespace.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/inet.h> | 17 | #include <linux/inet.h> |
18 | #include "internal.h" | 18 | #include "internal.h" |
19 | #include "nfs4_fs.h" | 19 | #include "nfs4_fs.h" |
20 | #include "dns_resolve.h" | ||
20 | 21 | ||
21 | #define NFSDBG_FACILITY NFSDBG_VFS | 22 | #define NFSDBG_FACILITY NFSDBG_VFS |
22 | 23 | ||
@@ -95,6 +96,20 @@ static int nfs4_validate_fspath(const struct vfsmount *mnt_parent, | |||
95 | return 0; | 96 | return 0; |
96 | } | 97 | } |
97 | 98 | ||
99 | static size_t nfs_parse_server_name(char *string, size_t len, | ||
100 | struct sockaddr *sa, size_t salen) | ||
101 | { | ||
102 | ssize_t ret; | ||
103 | |||
104 | ret = rpc_pton(string, len, sa, salen); | ||
105 | if (ret == 0) { | ||
106 | ret = nfs_dns_resolve_name(string, len, sa, salen); | ||
107 | if (ret < 0) | ||
108 | ret = 0; | ||
109 | } | ||
110 | return ret; | ||
111 | } | ||
112 | |||
98 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | 113 | static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, |
99 | char *page, char *page2, | 114 | char *page, char *page2, |
100 | const struct nfs4_fs_location *location) | 115 | const struct nfs4_fs_location *location) |
@@ -106,7 +121,7 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | |||
106 | 121 | ||
107 | mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); | 122 | mnt_path = nfs4_pathname_string(&location->rootpath, page2, PAGE_SIZE); |
108 | if (IS_ERR(mnt_path)) | 123 | if (IS_ERR(mnt_path)) |
109 | return mnt; | 124 | return ERR_CAST(mnt_path); |
110 | mountdata->mnt_path = mnt_path; | 125 | mountdata->mnt_path = mnt_path; |
111 | maxbuflen = mnt_path - 1 - page2; | 126 | maxbuflen = mnt_path - 1 - page2; |
112 | 127 | ||
@@ -117,15 +132,16 @@ static struct vfsmount *try_location(struct nfs_clone_mount *mountdata, | |||
117 | if (buf->len <= 0 || buf->len >= maxbuflen) | 132 | if (buf->len <= 0 || buf->len >= maxbuflen) |
118 | continue; | 133 | continue; |
119 | 134 | ||
120 | mountdata->addr = (struct sockaddr *)&addr; | ||
121 | |||
122 | if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len)) | 135 | if (memchr(buf->data, IPV6_SCOPE_DELIMITER, buf->len)) |
123 | continue; | 136 | continue; |
124 | nfs_parse_ip_address(buf->data, buf->len, | 137 | |
125 | mountdata->addr, &mountdata->addrlen); | 138 | mountdata->addrlen = nfs_parse_server_name(buf->data, buf->len, |
126 | if (mountdata->addr->sa_family == AF_UNSPEC) | 139 | (struct sockaddr *)&addr, sizeof(addr)); |
140 | if (mountdata->addrlen == 0) | ||
127 | continue; | 141 | continue; |
128 | nfs_set_port(mountdata->addr, NFS_PORT); | 142 | |
143 | mountdata->addr = (struct sockaddr *)&addr; | ||
144 | rpc_set_port(mountdata->addr, NFS_PORT); | ||
129 | 145 | ||
130 | memcpy(page2, buf->data, buf->len); | 146 | memcpy(page2, buf->data, buf->len); |
131 | page2[buf->len] = '\0'; | 147 | page2[buf->len] = '\0'; |