diff options
author | Paulo Alcantara <pc@cjr.nz> | 2022-10-05 00:41:36 +0300 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2022-12-19 17:03:11 +0300 |
commit | 6d740164d8903e6a0e98c30f80fac6af19ce0a21 (patch) | |
tree | 9861e8bfcac455a3a51dba53cc4208351c44837b /fs/cifs/dfs.c | |
parent | 2301bc103ac4acb6d6b6e5860eeed448c4ba2df0 (diff) | |
download | linux-6d740164d8903e6a0e98c30f80fac6af19ce0a21.tar.xz |
cifs: set resolved ip in sockaddr
All callers from dns_resolve_server_name_to_ip() used to convert the
ip addr string back to sockaddr, so do that inside
dns_resolve_server_name_to_ip() and avoid duplicating code.
Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/dfs.c')
-rw-r--r-- | fs/cifs/dfs.c | 24 |
1 files changed, 1 insertions, 23 deletions
diff --git a/fs/cifs/dfs.c b/fs/cifs/dfs.c index 0b15d7e9f818..ce21438cadec 100644 --- a/fs/cifs/dfs.c +++ b/fs/cifs/dfs.c @@ -9,28 +9,6 @@ #include "fs_context.h" #include "dfs.h" -/* Resolve UNC server name and set destination ip address in fs context */ -static int resolve_unc(const char *path, struct smb3_fs_context *ctx) -{ - int rc; - char *ip = NULL; - - rc = dns_resolve_server_name_to_ip(path, &ip, NULL); - if (rc < 0) { - cifs_dbg(FYI, "%s: failed to resolve UNC server name: %d\n", __func__, rc); - return rc; - } - - if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr, ip, strlen(ip))) { - cifs_dbg(VFS, "%s: could not determinate destination address\n", __func__); - rc = -EHOSTUNREACH; - } else - rc = 0; - - kfree(ip); - return rc; -} - /** * dfs_parse_target_referral - set fs context for dfs target referral * @@ -68,7 +46,7 @@ int dfs_parse_target_referral(const char *full_path, const struct dfs_info3_para if (rc) goto out; - rc = resolve_unc(path, ctx); + rc = dns_resolve_server_name_to_ip(path, (struct sockaddr *)&ctx->dstaddr, NULL); out: kfree(path); |