summaryrefslogtreecommitdiff
path: root/include/linux/lockd
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-12-11 17:56:52 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-01-06 11:53:56 -0500
commit57ef692588bc225853ca3267ca5b7cea2b07e058 (patch)
treed643d6d9d503288078b989aa37abc89cf1d78a6b /include/linux/lockd
parentd1208f70738c91f13b4eadb1b7a694082e439da2 (diff)
downloadlinux-3.10-57ef692588bc225853ca3267ca5b7cea2b07e058.tar.gz
linux-3.10-57ef692588bc225853ca3267ca5b7cea2b07e058.tar.bz2
linux-3.10-57ef692588bc225853ca3267ca5b7cea2b07e058.zip
NLM: Rewrite IPv4 privileged requester's check
Clean up. For consistency, rewrite the IPv4 check to match the same style as the new IPv6 check. Note that ipv4_is_loopback() is somewhat broader in its interpretation of what is a loopback address than simply "127.0.0.1". Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'include/linux/lockd')
-rw-r--r--include/linux/lockd/lockd.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 80d7e8a8257..aa6fe7026de 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -291,8 +291,11 @@ static inline struct inode *nlmsvc_file_inode(struct nlm_file *file)
static inline int __nlm_privileged_request4(const struct sockaddr *sap)
{
const struct sockaddr_in *sin = (struct sockaddr_in *)sap;
- return (sin->sin_addr.s_addr == htonl(INADDR_LOOPBACK)) &&
- (ntohs(sin->sin_port) < 1024);
+
+ if (ntohs(sin->sin_port) > 1023)
+ return 0;
+
+ return ipv4_is_loopback(sin->sin_addr.s_addr);
}
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)