diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2007-02-12 03:53:34 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-12 12:48:36 -0500 |
commit | 27459f0940e16c68e080f5fc7e85aa9eb3f74528 (patch) | |
tree | f13cd1f2005dda2b6115e2afbc49e1271b0d374b /fs/nfsd | |
parent | 2442222283918c2d1c20ae651d95fe168757938b (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/nfsd')
-rw-r--r-- | fs/nfsd/nfs4state.c | 18 | ||||
-rw-r--r-- | fs/nfsd/nfscache.c | 2 |
2 files changed, 10 insertions, 10 deletions
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 | |||
714 | nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, | 714 | nfsd4_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; |