summaryrefslogtreecommitdiff
path: root/fs/cifs/connect.c
diff options
context:
space:
mode:
authorPaulo Alcantara <pc@cjr.nz>2020-05-19 15:38:28 -0300
committerSteve French <stfrench@microsoft.com>2020-06-01 00:10:18 -0500
commite4af35fa55b072190711c11e2bfff8326d313948 (patch)
tree9defc68db1e5f5b7de5581b63ec0efb67eb5422f /fs/cifs/connect.c
parentaaa3aef34d3ab9499a5c7633823429f7a24e6dff (diff)
cifs: handle hostnames that resolve to same ip in failover
In order to support reconnect to hostnames that resolve to same ip address, besides relying on the currently set hostname to match DFS targets, attempt to resolve the targets and then match their addresses with the reconnected server ip address. For instance, if we have two hostnames "FOO" and "BAR", and both resolve to the same ip address, we would be able to handle failover in DFS paths like \\FOO\dfs\link1 -> [ \BAZ\share2 (*), \BAR\share1 ] \\FOO\dfs\link2 -> [ \BAZ\share2 (*), \FOO\share1 ] so when "BAZ" is no longer accessible, link1 and link2 would get reconnected despite having different target hostnames. Signed-off-by: Paulo Alcantara (SUSE) <pc@cjr.nz> Reviewed-by: Aurelien Aptel <aaptel@suse.com> Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r--fs/cifs/connect.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index aa1173f3fb12..ea3189a6ae10 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2496,8 +2496,8 @@ cifs_parse_mount_err:
* specified, or if srcaddr is specified and
* matches the IP address of the rhs argument.
*/
-static bool
-srcip_matches(struct sockaddr *srcaddr, struct sockaddr *rhs)
+bool
+cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs)
{
switch (srcaddr->sa_family) {
case AF_UNSPEC:
@@ -2588,7 +2588,7 @@ match_address(struct TCP_Server_Info *server, struct sockaddr *addr,
return false; /* don't expect to be here */
}
- if (!srcip_matches(srcaddr, (struct sockaddr *)&server->srcaddr))
+ if (!cifs_match_ipaddr(srcaddr, (struct sockaddr *)&server->srcaddr))
return false;
return true;