aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2007-02-12 03:53:34 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-12 12:48:36 -0500
commit27459f0940e16c68e080f5fc7e85aa9eb3f74528 (patch)
treef13cd1f2005dda2b6115e2afbc49e1271b0d374b /fs
parent2442222283918c2d1c20ae651d95fe168757938b (diff)
[PATCH] knfsd: SUNRPC: Provide room in svc_rqst for larger addresses
Expand the rq_addr field to allow it to contain larger addresses. Specifically, we replace a 'sockaddr_in' with a 'sockaddr_storage', then everywhere the 'sockaddr_in' was referenced, we use instead an accessor function (svc_addr_in) which safely casts the _storage to _in. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net> Signed-off-by: Neil Brown <neilb@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/lockd/host.c2
-rw-r--r--fs/lockd/svc4proc.c6
-rw-r--r--fs/lockd/svcproc.c6
-rw-r--r--fs/nfs/callback.c2
-rw-r--r--fs/nfs/callback_xdr.c4
-rw-r--r--fs/nfsd/nfs4state.c18
-rw-r--r--fs/nfsd/nfscache.c2
7 files changed, 22 insertions, 18 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 3d4610c2a266..22d403208973 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -192,7 +192,7 @@ struct nlm_host *
192nlmsvc_lookup_host(struct svc_rqst *rqstp, 192nlmsvc_lookup_host(struct svc_rqst *rqstp,
193 const char *hostname, int hostname_len) 193 const char *hostname, int hostname_len)
194{ 194{
195 return nlm_lookup_host(1, &rqstp->rq_addr, 195 return nlm_lookup_host(1, svc_addr_in(rqstp),
196 rqstp->rq_prot, rqstp->rq_vers, 196 rqstp->rq_prot, rqstp->rq_vers,
197 hostname, hostname_len); 197 hostname, hostname_len);
198} 198}
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index 9b591bc18341..47a66aa5d55b 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -224,7 +224,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
224 resp->cookie = argp->cookie; 224 resp->cookie = argp->cookie;
225 225
226 dprintk("lockd: GRANTED called\n"); 226 dprintk("lockd: GRANTED called\n");
227 resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock); 227 resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock);
228 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 228 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
229 return rpc_success; 229 return rpc_success;
230} 230}
@@ -421,7 +421,9 @@ static __be32
421nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 421nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
422 void *resp) 422 void *resp)
423{ 423{
424 struct sockaddr_in saddr = rqstp->rq_addr; 424 struct sockaddr_in saddr;
425
426 memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr));
425 427
426 dprintk("lockd: SM_NOTIFY called\n"); 428 dprintk("lockd: SM_NOTIFY called\n");
427 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) 429 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index f590304d93bf..31cb48425733 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -253,7 +253,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
253 resp->cookie = argp->cookie; 253 resp->cookie = argp->cookie;
254 254
255 dprintk("lockd: GRANTED called\n"); 255 dprintk("lockd: GRANTED called\n");
256 resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock); 256 resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock);
257 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status)); 257 dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
258 return rpc_success; 258 return rpc_success;
259} 259}
@@ -452,7 +452,9 @@ static __be32
452nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp, 452nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
453 void *resp) 453 void *resp)
454{ 454{
455 struct sockaddr_in saddr = rqstp->rq_addr; 455 struct sockaddr_in saddr;
456
457 memcpy(&saddr, svc_addr_in(rqstp), sizeof(saddr));
456 458
457 dprintk("lockd: SM_NOTIFY called\n"); 459 dprintk("lockd: SM_NOTIFY called\n");
458 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK) 460 if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 8c790af85984..75f309c8741a 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -166,7 +166,7 @@ void nfs_callback_down(void)
166 166
167static int nfs_callback_authenticate(struct svc_rqst *rqstp) 167static int nfs_callback_authenticate(struct svc_rqst *rqstp)
168{ 168{
169 struct sockaddr_in *addr = &rqstp->rq_addr; 169 struct sockaddr_in *addr = svc_addr_in(rqstp);
170 struct nfs_client *clp; 170 struct nfs_client *clp;
171 char buf[RPC_MAX_ADDRBUFLEN]; 171 char buf[RPC_MAX_ADDRBUFLEN];
172 172
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index f8ea1f51f590..849a2029975d 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -176,7 +176,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
176 status = decode_fh(xdr, &args->fh); 176 status = decode_fh(xdr, &args->fh);
177 if (unlikely(status != 0)) 177 if (unlikely(status != 0))
178 goto out; 178 goto out;
179 args->addr = &rqstp->rq_addr; 179 args->addr = svc_addr_in(rqstp);
180 status = decode_bitmap(xdr, args->bitmap); 180 status = decode_bitmap(xdr, args->bitmap);
181out: 181out:
182 dprintk("%s: exit with status = %d\n", __FUNCTION__, status); 182 dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
@@ -188,7 +188,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr,
188 __be32 *p; 188 __be32 *p;
189 __be32 status; 189 __be32 status;
190 190
191 args->addr = &rqstp->rq_addr; 191 args->addr = svc_addr_in(rqstp);
192 status = decode_stateid(xdr, &args->stateid); 192 status = decode_stateid(xdr, &args->stateid);
193 if (unlikely(status != 0)) 193 if (unlikely(status != 0))
194 goto out; 194 goto out;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 9de89df961f4..9e4067999209 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -714,7 +714,7 @@ __be32
714nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 714nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
715 struct nfsd4_setclientid *setclid) 715 struct nfsd4_setclientid *setclid)
716{ 716{
717 __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; 717 struct sockaddr_in *sin = svc_addr_in(rqstp);
718 struct xdr_netobj clname = { 718 struct xdr_netobj clname = {
719 .len = setclid->se_namelen, 719 .len = setclid->se_namelen,
720 .data = setclid->se_name, 720 .data = setclid->se_name,
@@ -749,7 +749,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
749 */ 749 */
750 status = nfserr_clid_inuse; 750 status = nfserr_clid_inuse;
751 if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred) 751 if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred)
752 || conf->cl_addr != ip_addr) { 752 || conf->cl_addr != sin->sin_addr.s_addr) {
753 printk("NFSD: setclientid: string in use by client" 753 printk("NFSD: setclientid: string in use by client"
754 "(clientid %08x/%08x)\n", 754 "(clientid %08x/%08x)\n",
755 conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id); 755 conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id);
@@ -769,7 +769,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
769 if (new == NULL) 769 if (new == NULL)
770 goto out; 770 goto out;
771 copy_verf(new, &clverifier); 771 copy_verf(new, &clverifier);
772 new->cl_addr = ip_addr; 772 new->cl_addr = sin->sin_addr.s_addr;
773 copy_cred(&new->cl_cred,&rqstp->rq_cred); 773 copy_cred(&new->cl_cred,&rqstp->rq_cred);
774 gen_clid(new); 774 gen_clid(new);
775 gen_confirm(new); 775 gen_confirm(new);
@@ -801,7 +801,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
801 if (new == NULL) 801 if (new == NULL)
802 goto out; 802 goto out;
803 copy_verf(new,&conf->cl_verifier); 803 copy_verf(new,&conf->cl_verifier);
804 new->cl_addr = ip_addr; 804 new->cl_addr = sin->sin_addr.s_addr;
805 copy_cred(&new->cl_cred,&rqstp->rq_cred); 805 copy_cred(&new->cl_cred,&rqstp->rq_cred);
806 copy_clid(new, conf); 806 copy_clid(new, conf);
807 gen_confirm(new); 807 gen_confirm(new);
@@ -820,7 +820,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
820 if (new == NULL) 820 if (new == NULL)
821 goto out; 821 goto out;
822 copy_verf(new,&clverifier); 822 copy_verf(new,&clverifier);
823 new->cl_addr = ip_addr; 823 new->cl_addr = sin->sin_addr.s_addr;
824 copy_cred(&new->cl_cred,&rqstp->rq_cred); 824 copy_cred(&new->cl_cred,&rqstp->rq_cred);
825 gen_clid(new); 825 gen_clid(new);
826 gen_confirm(new); 826 gen_confirm(new);
@@ -847,7 +847,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
847 if (new == NULL) 847 if (new == NULL)
848 goto out; 848 goto out;
849 copy_verf(new,&clverifier); 849 copy_verf(new,&clverifier);
850 new->cl_addr = ip_addr; 850 new->cl_addr = sin->sin_addr.s_addr;
851 copy_cred(&new->cl_cred,&rqstp->rq_cred); 851 copy_cred(&new->cl_cred,&rqstp->rq_cred);
852 gen_clid(new); 852 gen_clid(new);
853 gen_confirm(new); 853 gen_confirm(new);
@@ -881,7 +881,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
881 struct nfsd4_compound_state *cstate, 881 struct nfsd4_compound_state *cstate,
882 struct nfsd4_setclientid_confirm *setclientid_confirm) 882 struct nfsd4_setclientid_confirm *setclientid_confirm)
883{ 883{
884 __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr; 884 struct sockaddr_in *sin = svc_addr_in(rqstp);
885 struct nfs4_client *conf, *unconf; 885 struct nfs4_client *conf, *unconf;
886 nfs4_verifier confirm = setclientid_confirm->sc_confirm; 886 nfs4_verifier confirm = setclientid_confirm->sc_confirm;
887 clientid_t * clid = &setclientid_confirm->sc_clientid; 887 clientid_t * clid = &setclientid_confirm->sc_clientid;
@@ -900,9 +900,9 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
900 unconf = find_unconfirmed_client(clid); 900 unconf = find_unconfirmed_client(clid);
901 901
902 status = nfserr_clid_inuse; 902 status = nfserr_clid_inuse;
903 if (conf && conf->cl_addr != ip_addr) 903 if (conf && conf->cl_addr != sin->sin_addr.s_addr)
904 goto out; 904 goto out;
905 if (unconf && unconf->cl_addr != ip_addr) 905 if (unconf && unconf->cl_addr != sin->sin_addr.s_addr)
906 goto out; 906 goto out;
907 907
908 if ((conf && unconf) && 908 if ((conf && unconf) &&
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index f90d70475854..578f2c9d56be 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -185,7 +185,7 @@ nfsd_cache_lookup(struct svc_rqst *rqstp, int type)
185 rp->c_state = RC_INPROG; 185 rp->c_state = RC_INPROG;
186 rp->c_xid = xid; 186 rp->c_xid = xid;
187 rp->c_proc = proc; 187 rp->c_proc = proc;
188 rp->c_addr = rqstp->rq_addr; 188 memcpy(&rp->c_addr, svc_addr_in(rqstp), sizeof(rp->c_addr));
189 rp->c_prot = proto; 189 rp->c_prot = proto;
190 rp->c_vers = vers; 190 rp->c_vers = vers;
191 rp->c_timestamp = jiffies; 191 rp->c_timestamp = jiffies;