Commit 79691836 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

lockd: Remove src_sap and src_len from nlm_lookup_host_info struct

Clean up.

The contents of the src_sap field is not used in nlm_alloc_host().
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 20258898
...@@ -53,8 +53,6 @@ struct nlm_lookup_host_info { ...@@ -53,8 +53,6 @@ struct nlm_lookup_host_info {
const u32 version; /* NLM version to search for */ const u32 version; /* NLM version to search for */
const char *hostname; /* remote's hostname */ const char *hostname; /* remote's hostname */
const size_t hostname_len; /* it's length */ const size_t hostname_len; /* it's length */
const struct sockaddr *src_sap; /* our address (optional) */
const size_t src_len; /* it's length */
const int noresvport; /* use non-priv port */ const int noresvport; /* use non-priv port */
}; };
...@@ -324,6 +322,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, ...@@ -324,6 +322,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
struct sockaddr_in6 sin6 = { struct sockaddr_in6 sin6 = {
.sin6_family = AF_INET6, .sin6_family = AF_INET6,
}; };
struct sockaddr *src_sap;
size_t src_len = rqstp->rq_addrlen;
struct nlm_lookup_host_info ni = { struct nlm_lookup_host_info ni = {
.server = 1, .server = 1,
.sap = svc_addr(rqstp), .sap = svc_addr(rqstp),
...@@ -332,7 +332,6 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, ...@@ -332,7 +332,6 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
.version = rqstp->rq_vers, .version = rqstp->rq_vers,
.hostname = hostname, .hostname = hostname,
.hostname_len = hostname_len, .hostname_len = hostname_len,
.src_len = rqstp->rq_addrlen,
}; };
dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__, dprintk("lockd: %s(host='%*s', vers=%u, proto=%s)\n", __func__,
...@@ -344,11 +343,11 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, ...@@ -344,11 +343,11 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
switch (ni.sap->sa_family) { switch (ni.sap->sa_family) {
case AF_INET: case AF_INET:
sin.sin_addr.s_addr = rqstp->rq_daddr.addr.s_addr; sin.sin_addr.s_addr = rqstp->rq_daddr.addr.s_addr;
ni.src_sap = (struct sockaddr *)&sin; src_sap = (struct sockaddr *)&sin;
break; break;
case AF_INET6: case AF_INET6:
ipv6_addr_copy(&sin6.sin6_addr, &rqstp->rq_daddr.addr6); ipv6_addr_copy(&sin6.sin6_addr, &rqstp->rq_daddr.addr6);
ni.src_sap = (struct sockaddr *)&sin6; src_sap = (struct sockaddr *)&sin6;
break; break;
default: default:
dprintk("lockd: %s failed; unrecognized address family\n", dprintk("lockd: %s failed; unrecognized address family\n",
...@@ -372,7 +371,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, ...@@ -372,7 +371,7 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
continue; continue;
if (host->h_version != ni.version) if (host->h_version != ni.version)
continue; continue;
if (!rpc_cmp_addr(nlm_srcaddr(host), ni.src_sap)) if (!rpc_cmp_addr(nlm_srcaddr(host), src_sap))
continue; continue;
/* Move to head of hash chain. */ /* Move to head of hash chain. */
...@@ -389,8 +388,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp, ...@@ -389,8 +388,8 @@ struct nlm_host *nlmsvc_lookup_host(const struct svc_rqst *rqstp,
if (unlikely(host == NULL)) if (unlikely(host == NULL))
goto out; goto out;
memcpy(nlm_srcaddr(host), ni.src_sap, ni.src_len); memcpy(nlm_srcaddr(host), src_sap, src_len);
host->h_srcaddrlen = ni.src_len; host->h_srcaddrlen = src_len;
hlist_add_head(&host->h_hash, chain); hlist_add_head(&host->h_hash, chain);
nrhosts++; nrhosts++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment