cifs: match even the scope id for ipv6 addresses
authorShyam Prasad N <sprasad@microsoft.com>
Tue, 27 Dec 2022 14:04:29 +0000 (14:04 +0000)
committerSteve French <stfrench@microsoft.com>
Thu, 2 Mar 2023 00:18:24 +0000 (18:18 -0600)
match_address function matches the scope id for ipv6 addresses,
but cifs_match_ipaddr (which is another function used for comparison)
does not use scope id. Doing so with this change.

Signed-off-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/cifs/connect.c

index ec020d8..5dabd8d 100644 (file)
@@ -1294,7 +1294,8 @@ cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs)
        case AF_INET6: {
                struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *)srcaddr;
                struct sockaddr_in6 *vaddr6 = (struct sockaddr_in6 *)rhs;
-               return ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr);
+               return (ipv6_addr_equal(&saddr6->sin6_addr, &vaddr6->sin6_addr)
+                       && saddr6->sin6_scope_id == vaddr6->sin6_scope_id);
        }
        default:
                WARN_ON(1);