From: Chuck Lever <chuck.lever@oracle.com>
To: neilb@suse.de
Cc: nfs@lists.sourceforge.net
Subject: [PATCH 07/13] SUNRPC: Provide room in svc_rqst for larger addresses
Date: Mon, 13 Nov 2006 07:58:19 -0500 [thread overview]
Message-ID: <20061113125819.4435.84338.stgit@localhost.localdomain> (raw)
In-Reply-To: <20061113125640.4435.11957.stgit@localhost.localdomain>
Expand the rq_addr field to allow it to contain larger addresses.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
---
fs/lockd/host.c | 4 ++--
fs/lockd/svc4proc.c | 7 +++++--
fs/lockd/svcproc.c | 7 +++++--
fs/nfs/callback.c | 2 +-
fs/nfs/callback_xdr.c | 4 ++--
fs/nfsd/nfs4state.c | 18 +++++++++---------
fs/nfsd/nfscache.c | 2 +-
include/linux/sunrpc/svc.h | 2 +-
net/sunrpc/svcauth_unix.c | 3 ++-
net/sunrpc/svcsock.c | 14 ++++++++------
10 files changed, 36 insertions(+), 27 deletions(-)
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index fb24a97..ca625dd 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -55,9 +55,9 @@ struct nlm_host *
nlmsvc_lookup_host(struct svc_rqst *rqstp,
const char *hostname, int hostname_len)
{
- return nlm_lookup_host(1, &rqstp->rq_addr,
+ return nlm_lookup_host(1, (struct sockaddr_in *) &rqstp->rq_addr,
rqstp->rq_prot, rqstp->rq_vers,
- hostname, hostname_len);
+ hostname, hostname_len);
}
/*
diff --git a/fs/lockd/svc4proc.c b/fs/lockd/svc4proc.c
index d724eac..15fa167 100644
--- a/fs/lockd/svc4proc.c
+++ b/fs/lockd/svc4proc.c
@@ -224,7 +224,8 @@ nlm4svc_proc_granted(struct svc_rqst *rq
resp->cookie = argp->cookie;
dprintk("lockd: GRANTED called\n");
- resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
+ resp->status = nlmclnt_grant((struct sockaddr_in *) &rqstp->rq_addr,
+ &argp->lock);
dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
return rpc_success;
}
@@ -421,7 +422,9 @@ static __be32
nlm4svc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
void *resp)
{
- struct sockaddr_in saddr = rqstp->rq_addr;
+ struct sockaddr_in saddr;
+
+ memcpy(&saddr, &rqstp->rq_addr, sizeof(saddr));
dprintk("lockd: SM_NOTIFY called\n");
if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
diff --git a/fs/lockd/svcproc.c b/fs/lockd/svcproc.c
index f590304..0cc9ab1 100644
--- a/fs/lockd/svcproc.c
+++ b/fs/lockd/svcproc.c
@@ -253,7 +253,8 @@ nlmsvc_proc_granted(struct svc_rqst *rqs
resp->cookie = argp->cookie;
dprintk("lockd: GRANTED called\n");
- resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
+ resp->status = nlmclnt_grant((struct sockaddr_in *) &rqstp->rq_addr,
+ &argp->lock);
dprintk("lockd: GRANTED status %d\n", ntohl(resp->status));
return rpc_success;
}
@@ -452,7 +453,9 @@ static __be32
nlmsvc_proc_sm_notify(struct svc_rqst *rqstp, struct nlm_reboot *argp,
void *resp)
{
- struct sockaddr_in saddr = rqstp->rq_addr;
+ struct sockaddr_in saddr;
+
+ memcpy(&saddr, &rqstp->rq_addr, sizeof(saddr));
dprintk("lockd: SM_NOTIFY called\n");
if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index d277ff9..c6be8ac 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -166,7 +166,7 @@ void nfs_callback_down(void)
static int nfs_callback_authenticate(struct svc_rqst *rqstp)
{
- struct sockaddr_in *addr = &rqstp->rq_addr;
+ struct sockaddr_in *addr = (struct sockaddr_in *) &rqstp->rq_addr;
struct nfs_client *clp;
char buf[RPC_MAX_ADDRBUFLEN];
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index f8ea1f5..70ae2ef 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -176,7 +176,7 @@ static __be32 decode_getattr_args(struct
status = decode_fh(xdr, &args->fh);
if (unlikely(status != 0))
goto out;
- args->addr = &rqstp->rq_addr;
+ args->addr = (struct sockaddr_in *) &rqstp->rq_addr;
status = decode_bitmap(xdr, args->bitmap);
out:
dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
@@ -188,7 +188,7 @@ static __be32 decode_recall_args(struct
__be32 *p;
__be32 status;
- args->addr = &rqstp->rq_addr;
+ args->addr = (struct sockaddr_in *) &rqstp->rq_addr;
status = decode_stateid(xdr, &args->stateid);
if (unlikely(status != 0))
goto out;
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 293b649..f6af541 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -713,7 +713,7 @@ out_err:
__be32
nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_setclientid *setclid)
{
- __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
+ struct sockaddr_in *sin = (struct sockaddr_in *) &rqstp->rq_addr;
struct xdr_netobj clname = {
.len = setclid->se_namelen,
.data = setclid->se_name,
@@ -748,7 +748,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp
*/
status = nfserr_clid_inuse;
if (!cmp_creds(&conf->cl_cred, &rqstp->rq_cred)
- || conf->cl_addr != ip_addr) {
+ || conf->cl_addr != sin->sin_addr.s_addr) {
printk("NFSD: setclientid: string in use by client"
"(clientid %08x/%08x)\n",
conf->cl_clientid.cl_boot, conf->cl_clientid.cl_id);
@@ -768,7 +768,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp
if (new == NULL)
goto out;
copy_verf(new, &clverifier);
- new->cl_addr = ip_addr;
+ new->cl_addr = sin->sin_addr.s_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new);
gen_confirm(new);
@@ -800,7 +800,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp
if (new == NULL)
goto out;
copy_verf(new,&conf->cl_verifier);
- new->cl_addr = ip_addr;
+ new->cl_addr = sin->sin_addr.s_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred);
copy_clid(new, conf);
gen_confirm(new);
@@ -819,7 +819,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp
if (new == NULL)
goto out;
copy_verf(new,&clverifier);
- new->cl_addr = ip_addr;
+ new->cl_addr = sin->sin_addr.s_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new);
gen_confirm(new);
@@ -846,7 +846,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp
if (new == NULL)
goto out;
copy_verf(new,&clverifier);
- new->cl_addr = ip_addr;
+ new->cl_addr = sin->sin_addr.s_addr;
copy_cred(&new->cl_cred,&rqstp->rq_cred);
gen_clid(new);
gen_confirm(new);
@@ -878,7 +878,7 @@ out:
__be32
nfsd4_setclientid_confirm(struct svc_rqst *rqstp, struct nfsd4_setclientid_confirm *setclientid_confirm)
{
- __be32 ip_addr = rqstp->rq_addr.sin_addr.s_addr;
+ struct sockaddr_in *sin = (struct sockaddr_in *) &rqstp->rq_addr;
struct nfs4_client *conf, *unconf;
nfs4_verifier confirm = setclientid_confirm->sc_confirm;
clientid_t * clid = &setclientid_confirm->sc_clientid;
@@ -897,9 +897,9 @@ nfsd4_setclientid_confirm(struct svc_rqs
unconf = find_unconfirmed_client(clid);
status = nfserr_clid_inuse;
- if (conf && conf->cl_addr != ip_addr)
+ if (conf && conf->cl_addr != sin->sin_addr.s_addr)
goto out;
- if (unconf && unconf->cl_addr != ip_addr)
+ if (unconf && unconf->cl_addr != sin->sin_addr.s_addr)
goto out;
if ((conf && unconf) &&
diff --git a/fs/nfsd/nfscache.c b/fs/nfsd/nfscache.c
index 6100bbe..b2da4f9 100644
--- a/fs/nfsd/nfscache.c
+++ b/fs/nfsd/nfscache.c
@@ -186,7 +186,7 @@ nfsd_cache_lookup(struct svc_rqst *rqstp
rp->c_state = RC_INPROG;
rp->c_xid = xid;
rp->c_proc = proc;
- rp->c_addr = rqstp->rq_addr;
+ memcpy(&rp->c_addr, &rqstp->rq_addr, sizeof(rp->c_addr));
rp->c_prot = proto;
rp->c_vers = vers;
rp->c_timestamp = jiffies;
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h
index 8720aa5..7aa11f2 100644
--- a/include/linux/sunrpc/svc.h
+++ b/include/linux/sunrpc/svc.h
@@ -197,7 +197,7 @@ struct svc_rqst {
struct list_head rq_list; /* idle list */
struct list_head rq_all; /* all threads list */
struct svc_sock * rq_sock; /* socket */
- struct sockaddr_in rq_addr; /* peer address */
+ struct sockaddr_storage rq_addr; /* peer address */
int rq_addrlen;
struct svc_serv * rq_server; /* RPC service definition */
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c
index e1bd933..21d392a 100644
--- a/net/sunrpc/svcauth_unix.c
+++ b/net/sunrpc/svcauth_unix.c
@@ -417,6 +417,7 @@ svcauth_unix_info_release(void *info)
static int
svcauth_unix_set_client(struct svc_rqst *rqstp)
{
+ struct sockaddr_in *sin = (struct sockaddr_in *) &rqstp->rq_addr;
struct ip_map *ipm;
rqstp->rq_client = NULL;
@@ -426,7 +427,7 @@ svcauth_unix_set_client(struct svc_rqst
ipm = ip_map_cached_get(rqstp);
if (ipm == NULL)
ipm = ip_map_lookup(rqstp->rq_server->sv_program->pg_class,
- rqstp->rq_addr.sin_addr);
+ sin->sin_addr);
if (ipm == NULL)
return SVC_DENIED;
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index d93b7cb..2e6e3e4 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -435,7 +435,7 @@ svc_sendto(struct svc_rqst *rqstp, struc
/* set the source and destination */
struct msghdr msg;
msg.msg_name = &rqstp->rq_addr;
- msg.msg_namelen = sizeof(rqstp->rq_addr);
+ msg.msg_namelen = rqstp->rq_addrlen;
msg.msg_iov = NULL;
msg.msg_iovlen = 0;
msg.msg_flags = MSG_MORE;
@@ -658,6 +658,7 @@ svc_write_space(struct sock *sk)
static int
svc_udp_recvfrom(struct svc_rqst *rqstp)
{
+ struct sockaddr_in *sin = (struct sockaddr_in *) &rqstp->rq_addr;
struct svc_sock *svsk = rqstp->rq_sock;
struct svc_serv *serv = svsk->sk_server;
struct sk_buff *skb;
@@ -713,9 +714,9 @@ svc_udp_recvfrom(struct svc_rqst *rqstp)
rqstp->rq_prot = IPPROTO_UDP;
/* Get sender address */
- rqstp->rq_addr.sin_family = AF_INET;
- rqstp->rq_addr.sin_port = skb->h.uh->source;
- rqstp->rq_addr.sin_addr.s_addr = skb->nh.iph->saddr;
+ sin->sin_family = AF_INET;
+ sin->sin_port = skb->h.uh->source;
+ sin->sin_addr.s_addr = skb->nh.iph->saddr;
rqstp->rq_daddr = skb->nh.iph->daddr;
if (skb_is_nonlinear(skb)) {
@@ -1245,7 +1246,8 @@ svc_sock_update_bufs(struct svc_serv *se
int
svc_recv(struct svc_rqst *rqstp, long timeout)
{
- struct svc_sock *svsk =NULL;
+ struct svc_sock *svsk = NULL;
+ struct sockaddr_in *sin = (struct sockaddr_in *) &rqstp->rq_addr;
struct svc_serv *serv = rqstp->rq_server;
struct svc_pool *pool = rqstp->rq_pool;
int len, i;
@@ -1340,7 +1342,7 @@ svc_recv(struct svc_rqst *rqstp, long ti
svsk->sk_lastrecv = get_seconds();
clear_bit(SK_OLD, &svsk->sk_flags);
- rqstp->rq_secure = ntohs(rqstp->rq_addr.sin_port) < 1024;
+ rqstp->rq_secure = ntohs(sin->sin_port) < 1024;
rqstp->rq_chandle.defer = svc_defer;
if (serv->sv_stats)
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NFS maillist - NFS@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nfs
next prev parent reply other threads:[~2006-11-13 15:24 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-13 12:56 [PATCH 00/13] repost RPC server patches for IPv6 support Chuck Lever
2006-11-13 12:57 ` [PATCH 01/13] SUNRPC: update internal API: separate pmap register and temp sockets Chuck Lever
2006-11-13 12:57 ` [PATCH 02/13] SUNRPC: allow creating an RPC service without registering with portmapper Chuck Lever
2006-11-13 21:32 ` Trond Myklebust
2006-11-13 21:50 ` Chuck Lever
2006-11-13 12:58 ` [PATCH 03/13] SUNRPC: Cache remote peer's address in svc_sock Chuck Lever
2006-11-13 12:58 ` [PATCH 04/13] SUNRPC: Don't set msg_name and msg_namelen when calling sock_recvmsg Chuck Lever
2006-11-13 12:58 ` [PATCH 05/13] SUNRPC: Use sockaddr_storage to store address in svc_deferred_req Chuck Lever
2006-11-13 12:58 ` [PATCH 06/13] SUNRPC: Add a function to format the address in an svc_rqst for printing Chuck Lever
2006-11-13 12:58 ` Chuck Lever [this message]
2006-11-13 12:58 ` [PATCH 08/13] SUNRPC: Make rq_daddr field address-version independent Chuck Lever
2006-11-13 12:58 ` [PATCH 09/13] SUNRPC: teach svc_sendto() to deal with IPv6 addresses Chuck Lever
2006-11-13 12:58 ` [PATCH 10/13] SUNRPC: add a "generic" function to see if the peer uses a secure port Chuck Lever
2006-11-13 12:58 ` [PATCH 11/13] SUNRPC: Support IPv6 addresses in svc_tcp_accept Chuck Lever
2006-11-13 12:58 ` [PATCH 12/13] SUNRPC: support IPv6 addresses in RPC server's UDP receive path Chuck Lever
2006-11-13 12:58 ` [PATCH 13/13] SUNRPC: fix up svc_create_socket() to take a sockaddr struct + length Chuck Lever
2006-11-13 15:40 ` [PATCH 00/13] repost RPC server patches for IPv6 support Olaf Kirch
-- strict thread matches above, loose matches on Subject: below --
2007-01-18 23:48 [PATCH 00/13] RPC server pre-requisites for IPv6 Chuck Lever
2007-01-18 23:50 ` [PATCH 07/13] SUNRPC: Provide room in svc_rqst for larger addresses Chuck Lever
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061113125819.4435.84338.stgit@localhost.localdomain \
--to=chuck.lever@oracle.com \
--cc=chucklever@gmail.com \
--cc=neilb@suse.de \
--cc=nfs@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox