Skip to content

Commit

Permalink
lockd: Specify address family for source address
Browse files Browse the repository at this point in the history
Make sure an address family is specified for source addresses passed to
nlm_lookup_host().  nlm_lookup_host() will need this when it becomes
capable of dealing with AF_INET6 addresses.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
  • Loading branch information
Chuck Lever authored and J. Bruce Fields committed Sep 29, 2008
1 parent 1b333c5 commit 2860a02
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fs/lockd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,12 @@ struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin,
const char *hostname,
unsigned int hostname_len)
{
struct sockaddr_in ssin = {0};
const struct sockaddr_in source = {
.sin_family = AF_UNSPEC,
};

return nlm_lookup_host(0, sin, proto, version,
hostname, hostname_len, &ssin);
hostname, hostname_len, &source);
}

/*
Expand All @@ -233,12 +235,14 @@ struct nlm_host *
nlmsvc_lookup_host(struct svc_rqst *rqstp,
const char *hostname, unsigned int hostname_len)
{
struct sockaddr_in ssin = {0};
const struct sockaddr_in source = {
.sin_family = AF_INET,
.sin_addr = rqstp->rq_daddr.addr,
};

ssin.sin_addr = rqstp->rq_daddr.addr;
return nlm_lookup_host(1, svc_addr_in(rqstp),
rqstp->rq_prot, rqstp->rq_vers,
hostname, hostname_len, &ssin);
hostname, hostname_len, &source);
}

/*
Expand Down

0 comments on commit 2860a02

Please sign in to comment.