aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-09-03 14:35:46 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-09-29 18:13:39 -0400
commit90151e6e4d00a3150d03d52170c246734b274622 (patch)
treebb0c7b1ab2b08ca86e87a30e0da0779a14a9b94d
parentb4ed58fd34d4def88bda59f9cc566ec9fca6a096 (diff)
lockd: Use sockaddr_storage for h_saddr field
To store larger addresses in the nlm_host structure, make h_saddr a sockaddr_storage. And let's call it something more self-explanatory: "saddr" could easily be mistaken for "server address". Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r--fs/lockd/host.c12
-rw-r--r--fs/lockd/svcsubs.c2
-rw-r--r--include/linux/lockd/lockd.h14
3 files changed, 19 insertions, 9 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 8c7022eeae65..3ce2702d0368 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -129,7 +129,7 @@ static struct nlm_host *nlm_lookup_host(int server,
129 continue; 129 continue;
130 if (host->h_server != server) 130 if (host->h_server != server)
131 continue; 131 continue;
132 if (!nlm_cmp_addr(&host->h_saddr, ssin)) 132 if (!nlm_cmp_addr(nlm_srcaddr_in(host), ssin))
133 continue; 133 continue;
134 134
135 /* Move to head of hash chain. */ 135 /* Move to head of hash chain. */
@@ -168,7 +168,7 @@ static struct nlm_host *nlm_lookup_host(int server,
168 memcpy(nlm_addr(host), sin, sizeof(*sin)); 168 memcpy(nlm_addr(host), sin, sizeof(*sin));
169 host->h_addrlen = sizeof(*sin); 169 host->h_addrlen = sizeof(*sin);
170 nlm_clear_port(nlm_addr(host)); 170 nlm_clear_port(nlm_addr(host));
171 host->h_saddr = *ssin; 171 memcpy(nlm_srcaddr(host), ssin, sizeof(*ssin));
172 host->h_version = version; 172 host->h_version = version;
173 host->h_proto = proto; 173 host->h_proto = proto;
174 host->h_rpcclnt = NULL; 174 host->h_rpcclnt = NULL;
@@ -192,8 +192,8 @@ static struct nlm_host *nlm_lookup_host(int server,
192 192
193 nlm_display_address((struct sockaddr *)&host->h_addr, 193 nlm_display_address((struct sockaddr *)&host->h_addr,
194 host->h_addrbuf, sizeof(host->h_addrbuf)); 194 host->h_addrbuf, sizeof(host->h_addrbuf));
195 nlm_display_address((struct sockaddr *)&host->h_saddr, 195 nlm_display_address((struct sockaddr *)&host->h_srcaddr,
196 host->h_saddrbuf, sizeof(host->h_saddrbuf)); 196 host->h_srcaddrbuf, sizeof(host->h_srcaddrbuf));
197 197
198 dprintk("lockd: nlm_lookup_host created host %s\n", 198 dprintk("lockd: nlm_lookup_host created host %s\n",
199 host->h_name); 199 host->h_name);
@@ -267,7 +267,7 @@ nlm_bind_host(struct nlm_host *host)
267 struct rpc_clnt *clnt; 267 struct rpc_clnt *clnt;
268 268
269 dprintk("lockd: nlm_bind_host %s (%s), my addr=%s\n", 269 dprintk("lockd: nlm_bind_host %s (%s), my addr=%s\n",
270 host->h_name, host->h_addrbuf, host->h_saddrbuf); 270 host->h_name, host->h_addrbuf, host->h_srcaddrbuf);
271 271
272 /* Lock host handle */ 272 /* Lock host handle */
273 mutex_lock(&host->h_mutex); 273 mutex_lock(&host->h_mutex);
@@ -294,7 +294,7 @@ nlm_bind_host(struct nlm_host *host)
294 .protocol = host->h_proto, 294 .protocol = host->h_proto,
295 .address = nlm_addr(host), 295 .address = nlm_addr(host),
296 .addrsize = host->h_addrlen, 296 .addrsize = host->h_addrlen,
297 .saddress = (struct sockaddr *)&host->h_saddr, 297 .saddress = nlm_srcaddr(host),
298 .timeout = &timeparms, 298 .timeout = &timeparms,
299 .servername = host->h_name, 299 .servername = host->h_name,
300 .program = &nlm_program, 300 .program = &nlm_program,
diff --git a/fs/lockd/svcsubs.c b/fs/lockd/svcsubs.c
index 198b4e55b373..d3d1330d7c27 100644
--- a/fs/lockd/svcsubs.c
+++ b/fs/lockd/svcsubs.c
@@ -418,7 +418,7 @@ EXPORT_SYMBOL_GPL(nlmsvc_unlock_all_by_sb);
418static int 418static int
419nlmsvc_match_ip(void *datap, struct nlm_host *host) 419nlmsvc_match_ip(void *datap, struct nlm_host *host)
420{ 420{
421 return nlm_cmp_addr(&host->h_saddr, datap); 421 return nlm_cmp_addr(nlm_srcaddr_in(host), datap);
422} 422}
423 423
424/** 424/**
diff --git a/include/linux/lockd/lockd.h b/include/linux/lockd/lockd.h
index 41d7a8e61cea..964e6c93830f 100644
--- a/include/linux/lockd/lockd.h
+++ b/include/linux/lockd/lockd.h
@@ -40,7 +40,7 @@ struct nlm_host {
40 struct hlist_node h_hash; /* doubly linked list */ 40 struct hlist_node h_hash; /* doubly linked list */
41 struct sockaddr_storage h_addr; /* peer address */ 41 struct sockaddr_storage h_addr; /* peer address */
42 size_t h_addrlen; 42 size_t h_addrlen;
43 struct sockaddr_in h_saddr; /* our address (optional) */ 43 struct sockaddr_storage h_srcaddr; /* our address (optional) */
44 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */ 44 struct rpc_clnt * h_rpcclnt; /* RPC client to talk to peer */
45 char * h_name; /* remote hostname */ 45 char * h_name; /* remote hostname */
46 u32 h_version; /* interface version */ 46 u32 h_version; /* interface version */
@@ -64,7 +64,7 @@ struct nlm_host {
64 struct nsm_handle * h_nsmhandle; /* NSM status handle */ 64 struct nsm_handle * h_nsmhandle; /* NSM status handle */
65 65
66 char h_addrbuf[48], /* address eyecatchers */ 66 char h_addrbuf[48], /* address eyecatchers */
67 h_saddrbuf[48]; 67 h_srcaddrbuf[48];
68}; 68};
69 69
70struct nsm_handle { 70struct nsm_handle {
@@ -90,6 +90,16 @@ static inline struct sockaddr *nlm_addr(const struct nlm_host *host)
90 return (struct sockaddr *)&host->h_addr; 90 return (struct sockaddr *)&host->h_addr;
91} 91}
92 92
93static inline struct sockaddr_in *nlm_srcaddr_in(const struct nlm_host *host)
94{
95 return (struct sockaddr_in *)&host->h_srcaddr;
96}
97
98static inline struct sockaddr *nlm_srcaddr(const struct nlm_host *host)
99{
100 return (struct sockaddr *)&host->h_srcaddr;
101}
102
93/* 103/*
94 * Map an fl_owner_t into a unique 32-bit "pid" 104 * Map an fl_owner_t into a unique 32-bit "pid"
95 */ 105 */