Commit ff052645 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

NFS: Change nfs_find_client() to take "struct sockaddr *"

Adjust arguments and callers of nfs_find_client() to pass a
"struct sockaddr *" instead of "struct sockaddr_in *" to support non-IPv4
addresses.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Cc: Aurelien Charbon <aurelien.charbon@ext.bull.net>

Trond: Also fix up protocol version number argument in nfs_find_client() to
use the correct u32 type.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c1d35866
...@@ -164,12 +164,11 @@ void nfs_callback_down(void) ...@@ -164,12 +164,11 @@ void nfs_callback_down(void)
static int nfs_callback_authenticate(struct svc_rqst *rqstp) static int nfs_callback_authenticate(struct svc_rqst *rqstp)
{ {
struct sockaddr_in *addr = svc_addr_in(rqstp);
struct nfs_client *clp; struct nfs_client *clp;
char buf[RPC_MAX_ADDRBUFLEN]; char buf[RPC_MAX_ADDRBUFLEN];
/* Don't talk to strangers */ /* Don't talk to strangers */
clp = nfs_find_client(addr, 4); clp = nfs_find_client(svc_addr(rqstp), 4);
if (clp == NULL) if (clp == NULL)
return SVC_DROP; return SVC_DROP;
......
...@@ -25,7 +25,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres * ...@@ -25,7 +25,7 @@ __be32 nfs4_callback_getattr(struct cb_getattrargs *args, struct cb_getattrres *
res->bitmap[0] = res->bitmap[1] = 0; res->bitmap[0] = res->bitmap[1] = 0;
res->status = htonl(NFS4ERR_BADHANDLE); res->status = htonl(NFS4ERR_BADHANDLE);
clp = nfs_find_client((struct sockaddr_in *)args->addr, 4); clp = nfs_find_client(args->addr, 4);
if (clp == NULL) if (clp == NULL)
goto out; goto out;
...@@ -68,7 +68,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy) ...@@ -68,7 +68,7 @@ __be32 nfs4_callback_recall(struct cb_recallargs *args, void *dummy)
__be32 res; __be32 res;
res = htonl(NFS4ERR_BADHANDLE); res = htonl(NFS4ERR_BADHANDLE);
clp = nfs_find_client((struct sockaddr_in *)args->addr, 4); clp = nfs_find_client(args->addr, 4);
if (clp == NULL) if (clp == NULL)
goto out; goto out;
......
...@@ -242,7 +242,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1, ...@@ -242,7 +242,7 @@ static int nfs_sockaddr_match_ipaddr(const struct sockaddr *sa1,
* Find a client by IP address and protocol version * Find a client by IP address and protocol version
* - returns NULL if no such client * - returns NULL if no such client
*/ */
struct nfs_client *_nfs_find_client(const struct sockaddr *addr, int nfsversion) struct nfs_client *nfs_find_client(const struct sockaddr *addr, u32 nfsversion)
{ {
struct nfs_client *clp; struct nfs_client *clp;
...@@ -272,11 +272,6 @@ struct nfs_client *_nfs_find_client(const struct sockaddr *addr, int nfsversion) ...@@ -272,11 +272,6 @@ struct nfs_client *_nfs_find_client(const struct sockaddr *addr, int nfsversion)
return NULL; return NULL;
} }
struct nfs_client *nfs_find_client(const struct sockaddr_in *addr, int nfsversion)
{
return _nfs_find_client((const struct sockaddr *)addr, nfsversion);
}
/* /*
* Find an nfs_client on the list that matches the initialisation data * Find an nfs_client on the list that matches the initialisation data
* that is supplied. * that is supplied.
......
...@@ -60,7 +60,7 @@ struct nfs_parsed_mount_data { ...@@ -60,7 +60,7 @@ struct nfs_parsed_mount_data {
extern struct rpc_program nfs_program; extern struct rpc_program nfs_program;
extern void nfs_put_client(struct nfs_client *); extern void nfs_put_client(struct nfs_client *);
extern struct nfs_client *nfs_find_client(const struct sockaddr_in *, int); extern struct nfs_client *nfs_find_client(const struct sockaddr *, u32);
extern struct nfs_server *nfs_create_server( extern struct nfs_server *nfs_create_server(
const struct nfs_parsed_mount_data *, const struct nfs_parsed_mount_data *,
struct nfs_fh *); struct nfs_fh *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment