Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 69191
b: refs/heads/master
c: d5b6443
h: refs/heads/master
i:
  69189: 9d6a813
  69187: eb1ef0b
  69183: 211715b
v: v3
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Oct 9, 2007
1 parent 8df3086 commit 900d2d6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b6473fba4e832ee1d15737bc38779501c349a61
refs/heads/master: d5b6443014940eb83788161c69b17cb7a1ffaaed
51 changes: 45 additions & 6 deletions trunk/net/sunrpc/rpcb_clnt.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

#include <linux/types.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/in6.h>
#include <linux/kernel.h>
#include <linux/errno.h>

Expand Down Expand Up @@ -137,10 +139,13 @@ struct rpcbind_args {
static struct rpc_procinfo rpcb_procedures2[];
static struct rpc_procinfo rpcb_procedures3[];

static struct rpcb_info {
struct rpcb_info {
int rpc_vers;
struct rpc_procinfo * rpc_proc;
} rpcb_next_version[];
};

static struct rpcb_info rpcb_next_version[];
static struct rpcb_info rpcb_next_version6[];

static void rpcb_getport_prepare(struct rpc_task *task, void *calldata)
{
Expand Down Expand Up @@ -190,7 +195,17 @@ static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
RPC_CLNT_CREATE_INTR),
};

((struct sockaddr_in *)srvaddr)->sin_port = htons(RPCBIND_PORT);
switch (srvaddr->sa_family) {
case AF_INET:
((struct sockaddr_in *)srvaddr)->sin_port = htons(RPCBIND_PORT);
break;
case AF_INET6:
((struct sockaddr_in6 *)srvaddr)->sin6_port = htons(RPCBIND_PORT);
break;
default:
return NULL;
}

if (!privileged)
args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
return rpc_create(&args);
Expand Down Expand Up @@ -316,6 +331,7 @@ void rpcb_getport_async(struct rpc_task *task)
struct rpc_task *child;
struct sockaddr addr;
int status;
struct rpcb_info *info;

dprintk("RPC: %5u %s(%s, %u, %u, %d)\n",
task->tk_pid, __FUNCTION__,
Expand Down Expand Up @@ -343,14 +359,30 @@ void rpcb_getport_async(struct rpc_task *task)
goto bailout_nofree;
}

if (rpcb_next_version[xprt->bind_index].rpc_proc == NULL) {
rpc_peeraddr(clnt, (void *)&addr, sizeof(addr));

/* Don't ever use rpcbind v2 for AF_INET6 requests */
switch (addr.sa_family) {
case AF_INET:
info = rpcb_next_version;
break;
case AF_INET6:
info = rpcb_next_version6;
break;
default:
status = -EAFNOSUPPORT;
dprintk("RPC: %5u %s: bad address family\n",
task->tk_pid, __FUNCTION__);
goto bailout_nofree;
}
if (info[xprt->bind_index].rpc_proc == NULL) {
xprt->bind_index = 0;
status = -EACCES; /* tell caller to try again later */
dprintk("RPC: %5u %s: no more getport versions available\n",
task->tk_pid, __FUNCTION__);
goto bailout_nofree;
}
bind_version = rpcb_next_version[xprt->bind_index].rpc_vers;
bind_version = info[xprt->bind_index].rpc_vers;

dprintk("RPC: %5u %s: trying rpcbind version %u\n",
task->tk_pid, __FUNCTION__, bind_version);
Expand All @@ -373,7 +405,6 @@ void rpcb_getport_async(struct rpc_task *task)
sizeof(map->r_addr));
map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */

rpc_peeraddr(clnt, (void *)&addr, sizeof(addr));
rpcb_clnt = rpcb_create(clnt->cl_server, &addr, xprt->prot, bind_version, 0);
if (IS_ERR(rpcb_clnt)) {
status = PTR_ERR(rpcb_clnt);
Expand Down Expand Up @@ -594,6 +625,14 @@ static struct rpcb_info rpcb_next_version[] = {
{ 0, NULL },
};

static struct rpcb_info rpcb_next_version6[] = {
#ifdef CONFIG_SUNRPC_BIND34
{ 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] },
{ 3, &rpcb_procedures3[RPCBPROC_GETADDR] },
#endif
{ 0, NULL },
};

static struct rpc_version rpcb_version2 = {
.number = 2,
.nrprocs = RPCB_HIGHPROC_2,
Expand Down

0 comments on commit 900d2d6

Please sign in to comment.