lockd: Teach nlm_cmp_addr() to support AF_INET6 addresses

Update the nlm_cmp_addr() helper to support AF_INET6 as well as AF_INET
addresses.  New version takes two "struct sockaddr *" arguments instead of
"struct sockaddr_in *" arguments.

Signed-off-by: Chuck Lever <[email protected]>
Signed-off-by: J. Bruce Fields <[email protected]>
This commit is contained in:
Chuck Lever 2008-09-03 14:36:01 -04:00 • committed by J. Bruce Fields
commit 781b61a6f4
4 changed files with 38 additions and 9 deletions

View file

@ -166,7 +166,8 @@ __be32 nlmclnt_grant(const struct sockaddr_in *addr, const struct nlm_lock *lock
*/
if (fl_blocked->fl_u.nfs_fl.owner->pid != lock->svid)
continue;
if (!nlm_cmp_addr(nlm_addr_in(block->b_host), addr))
if (!nlm_cmp_addr(nlm_addr(block->b_host),
(struct sockaddr *)addr))
continue;
if (nfs_compare_fh(NFS_FH(fl_blocked->fl_file->f_path.dentry->d_inode) ,fh) != 0)
continue;

View file

@ -116,7 +116,7 @@ static struct nlm_host *nlm_lookup_host(int server,
*/
chain = &nlm_hosts[hash];
hlist_for_each_entry(host, pos, chain, h_hash) {
if (!nlm_cmp_addr(nlm_addr_in(host), sin))
if (!nlm_cmp_addr(nlm_addr(host), (struct sockaddr *)sin))
continue;
/* See if we have an NSM handle for this client */
@ -129,7 +129,7 @@ static struct nlm_host *nlm_lookup_host(int server,
continue;
if (host->h_server != server)
continue;
if (!nlm_cmp_addr(nlm_srcaddr_in(host), ssin))
if (!nlm_cmp_addr(nlm_srcaddr(host), (struct sockaddr *)ssin))
continue;
/* Move to head of hash chain. */
@ -551,7 +551,7 @@ retry:
if (strlen(pos->sm_name) != hostname_len
|| memcmp(pos->sm_name, hostname, hostname_len))
continue;
} else if (!nlm_cmp_addr(nsm_addr_in(pos), sin))
} else if (!nlm_cmp_addr(nsm_addr(pos), (struct sockaddr *)sin))
continue;
atomic_inc(&pos->sm_count);
kfree(nsm);

View file

@ -418,7 +418,7 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);
static int
nlmsvc_match_ip(void *datap, struct nlm_host *host)
{
return nlm_cmp_addr(nlm_srcaddr_in(host), datap);
return nlm_cmp_addr(nlm_srcaddr(host), datap);
}
/**