Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27459f09 authored by Chuck Lever's avatar Chuck Lever Committed by Linus Torvalds
Browse files

[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: default avatarChuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 24422222
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ 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, svc_addr_in(rqstp),
			       rqstp->rq_prot, rqstp->rq_vers,
			       hostname, hostname_len);
}
+4 −2
Original line number Diff line number Diff line
@@ -224,7 +224,7 @@ nlm4svc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
	resp->cookie = argp->cookie;

	dprintk("lockd: GRANTED       called\n");
	resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
	resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock);
	dprintk("lockd: GRANTED       status %d\n", ntohl(resp->status));
	return rpc_success;
}
@@ -421,7 +421,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, svc_addr_in(rqstp), sizeof(saddr));

	dprintk("lockd: SM_NOTIFY     called\n");
	if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
+4 −2
Original line number Diff line number Diff line
@@ -253,7 +253,7 @@ nlmsvc_proc_granted(struct svc_rqst *rqstp, struct nlm_args *argp,
	resp->cookie = argp->cookie;

	dprintk("lockd: GRANTED       called\n");
	resp->status = nlmclnt_grant(&rqstp->rq_addr, &argp->lock);
	resp->status = nlmclnt_grant(svc_addr_in(rqstp), &argp->lock);
	dprintk("lockd: GRANTED       status %d\n", ntohl(resp->status));
	return rpc_success;
}
@@ -452,7 +452,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, svc_addr_in(rqstp), sizeof(saddr));

	dprintk("lockd: SM_NOTIFY     called\n");
	if (saddr.sin_addr.s_addr != htonl(INADDR_LOOPBACK)
+1 −1
Original line number Diff line number Diff line
@@ -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 = svc_addr_in(rqstp);
	struct nfs_client *clp;
	char buf[RPC_MAX_ADDRBUFLEN];

+2 −2
Original line number Diff line number Diff line
@@ -176,7 +176,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
	status = decode_fh(xdr, &args->fh);
	if (unlikely(status != 0))
		goto out;
	args->addr = &rqstp->rq_addr;
	args->addr = svc_addr_in(rqstp);
	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 svc_rqst *rqstp, struct xdr_stream *xdr,
	__be32 *p;
	__be32 status;

	args->addr = &rqstp->rq_addr;
	args->addr = svc_addr_in(rqstp);
	status = decode_stateid(xdr, &args->stateid);
	if (unlikely(status != 0))
		goto out;
Loading