nfs: fix dead code of ipv6_addr_scope
Subsystems (4)
PATCH v2 1/1 nfs: fix dead code of ipv6_addr_scope
This patch corrects the check on a linklocal address.
Currently this can't be work, because ipv6_addr_scope returns a int with a mask of IPV6_ADDR_SCOPE_MASK (0x00f0U) and IPV6_ADDR_SCOPE_LINKLOCAL is 0x02. So the condition is always false.
---
- change check on linklocal address from (ipv6_addr_src_scope(&a6->sin6_addr) == IPV6_ADDR_SCOPE_LINKLOCAL) to (ipv6_addr_scope(&a6->sin6_addr) & IPV6_ADDR_LINKLOCAL) which is a little bit faster.
- change commit msg.
fs/nfs/nfs4filelayoutdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfs/nfs4filelayoutdev.c +1 -2
@@ -95,8 +95,7 @@ same_sockaddr(struct sockaddr *addr1, struct sockaddr *addr2) b6 = (struct sockaddr_in6 *)addr2;/* LINKLOCAL addresses must have matching scope_id */ -if (ipv6_addr_scope (&a6->sin6_addr) == -IPV6_ADDR_SCOPE_LINKLOCAL && +if (ipv6_addr_scope (&a6->sin6_addr) &IPV6_ADDR_LINKLOCAL && a6->sin6_scope_id != b6->sin6_scope_id)return false;
Signature · 1 line
1.8.5.2
Quoted 7 lines · Alexander Aring
This patch corrects the check on a linklocal address.
Currently this can't be work, because
ipv6_addr_scopereturns a int with a mask ofIPV6_ADDR_SCOPE_MASK(0x00f0U) andIPV6_ADDR_SCOPE_LINKLOCALis0x02. So the condition is always false.Signed-off-by Alexander Aring <[email protected]>
Quoted 6 lines · Alexander Aring
This patch corrects the check on a linklocal address.
Currently this can't be work, because
ipv6_addr_scopereturns a int with a mask ofIPV6_ADDR_SCOPE_MASK(0x00f0U) andIPV6_ADDR_SCOPE_LINKLOCALis0x02. So the condition is always false.
Quoted 7 lines
Signed-off-by Alexander Aring <[email protected]>---
- change check on linklocal address from (ipv6_addr_src_scope(&a6->sin6_addr)==IPV6_ADDR_SCOPE_LINKLOCAL) to (ipv6_addr_scope(&a6->sin6_addr)&IPV6_ADDR_LINKLOCAL) which is a little bit faster.
- change commit msg.
<formletter>
This is not the correct way to submit patches for inclusion in the stable kernel tree. Please read Documentation/stable_kernel_rules.txt for how to do this properly.
</formletter>