NLM: AF_UNSPEC addresses are all equal
Subsystems (2)
PATCH 1/1 NLM: AF_UNSPEC addresses are all equal
The nlm_cmp_addr() function, which compares two IP addresses, is sometimes used to check AF_UNSPEC addresses. If both addresses are AF_UNSPEC, then it should consider them equal -- the contents of an AF_UNSPEC address, other than the address family, are inconsequential.
This is important because the loop in nlm_lookup_host() always compares the h_srcaddr field to the incoming source address. For client nlm_host entries, both are always AF_UNSPEC, and should allow the entry match to succeed. If it always fails, then we create a fresh nlm_host entry every time we mount the same server, even if all other items in the existing entry (protocol, NLM version, host address) match.
These extra entries will eventually expire once the server is unmounted, so the impact of this bug, introduced in 2.6.28 with commit 781b61a6, should be minor.
---
Bruce-
Another minor lockd IPv6 bug fix for 2.6.28.
Alternate fix for this problem is to change nlm_lookup_host() so that it compares the srcaddrs only when h_server is set.
include/linux/lockd/lockd.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/lockd/lockd.h +2 -0
@@ -344,6 +344,8 @@ static inline int nlm_cmp_addr(const struct sockaddr *sap1, {if (sap1->sa_family == sap2->sa_family) {switch (sap1->sa_family) { +case AF_UNSPEC : +return 1 ;case AF_INET :return __nlm_cmp_addr4 (sap1, sap2);case AF_INET6 :
A message that is not in the archive (sent off-list or not yet received): 20081122165521.3765.1127.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org
Hi Bruce-
Quoted 18 lines · Chuck Lever
The
nlm_cmp_addr()function, which compares two IP addresses, is sometimes used to checkAF_UNSPECaddresses. If both addresses areAF_UNSPEC, then it should consider them equal -- the contents of anAF_UNSPECaddress, other than the address family, are inconsequential.This is important because the loop in
nlm_lookup_host()always compares theh_srcaddrfield to the incoming source address. For clientnlm_hostentries, both are alwaysAF_UNSPEC, and should allow the entry match to succeed. If it always fails, then we create a freshnlm_hostentry every time we mount the same server, even if all other items in the existing entry (protocol, NLM version, host address) match.These extra entries will eventually expire once the server is unmounted, so the impact of this bug, introduced in 2.6.28 with commit
781b61a6, should be minor.
Quoted 8 lines
Signed-off-by Chuck Lever <[email protected]>---
Bruce-Another minor lockd IPv6 bug fix for 2.6.28.
Alternate fix for this problem is to change
nlm_lookup_host()so that it compares the srcaddrs only whenh_serveris set.
I now have a patch that does this instead, and it seems to make more sense to me.
Quoted 18 lines
include/linux/lockd/lockd.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)include/linux/lockd/lockd.h +2
-0@@ -344,6 +344,8 @@ static inline int nlm_cmp_addr(const struct sockaddr *sap1, {if (sap1->sa_family == sap2->sa_family) {switch (sap1->sa_family) { +case AF_UNSPEC : +return 1 ;case AF_INET :return __nlm_cmp_addr4 (sap1, sap2);case
AF_INET6:
Signature · 2 lines
Chuck Lever chuck[dot]lever[at]oracle[dot]com
Quoted 25 lines · Chuck Lever
Hi Bruce-
Quoted 22 lines · Chuck Lever
The
nlm_cmp_addr()function, which compares two IP addresses, is sometimes used to checkAF_UNSPECaddresses. If both addresses areAF_UNSPEC, then it should consider them equal -- the contents of anAF_UNSPECaddress, other than the address family, are inconsequential.This is important because the loop in
nlm_lookup_host()always compares theh_srcaddrfield to the incoming source address. For clientnlm_hostentries, both are alwaysAF_UNSPEC, and should allow the entry match to succeed. If it always fails, then we create a freshnlm_hostentry every time we mount the same server, even if all other items in the existing entry (protocol, NLM version, host address) match.These extra entries will eventually expire once the server is unmounted, so the impact of this bug, introduced in 2.6.28 with commit
781b61a6, should be minor.Signed-off-by Chuck Lever <[email protected]>---
Bruce-
Quoted 7 lines
Quoted 4 lines
Another minor lockd IPv6 bug fix for 2.6.28.
Alternate fix for this problem is to change
nlm_lookup_host()so that it compares the srcaddrs only whenh_serveris set.I now have a patch that does this instead, and it seems to make more sense to me.
OK. (I don't think you've sent it yet?)
--b.
Quoted 23 lines
Quoted 19 lines
include/linux/lockd/lockd.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)include/linux/lockd/lockd.h +2
-0@@ -344,6 +344,8 @@ static inline int nlm_cmp_addr(const struct sockaddr *sap1, {if (sap1->sa_family == sap2->sa_family) {switch (sap1->sa_family) { +case AF_UNSPEC : +return 1 ;case AF_INET :return __nlm_cmp_addr4 (sap1, sap2);case
AF_INET6:Signature · 2 lines
Chuck Lever chuck[dot]lever[at]oracle[dot]com
Quoted 28 lines · bfields
Quoted 27 lines · Chuck Lever
Hi Bruce-
Quoted 24 lines · Chuck Lever
The
nlm_cmp_addr()function, which compares two IP addresses, is sometimes used to checkAF_UNSPECaddresses. If both addresses areAF_UNSPEC, then it should consider them equal -- the contents of anAF_UNSPECaddress, other than the address family, are inconsequential.This is important because the loop in
nlm_lookup_host()always compares theh_srcaddrfield to the incoming source address. For clientnlm_hostentries, both are alwaysAF_UNSPEC, and should allow the entry match to succeed. If it always fails, then we create a freshnlm_hostentry every time we mount the same server, even if all other items in the existing entry (protocol, NLM version, host address) match.These extra entries will eventually expire once the server is unmounted, so the impact of this bug, introduced in 2.6.28 with commit
781b61a6, should be minor.Signed-off-by Chuck Lever <[email protected]>---
Bruce-Another minor lockd IPv6 bug fix for 2.6.28.
Quoted 7 lines
Quoted 5 lines
Quoted 2 lines
Alternate fix for this problem is to change
nlm_lookup_host()so that it compares the srcaddrs only whenh_serveris set.I now have a patch that does this instead, and it seems to make more sense to me.
OK. (I don't think you've sent it yet?)
Just found it, never mind!
--b.