diff options
Diffstat (limited to 'net/sunrpc/rpcb_clnt.c')
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 56 |
1 files changed, 3 insertions, 53 deletions
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index 1ef2d417af4e..fa6d7ca2c851 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -212,8 +212,9 @@ static int rpcb_create_local(void) | |||
212 | */ | 212 | */ |
213 | clnt4 = rpc_bind_new_program(clnt, &rpcb_program, RPCBVERS_4); | 213 | clnt4 = rpc_bind_new_program(clnt, &rpcb_program, RPCBVERS_4); |
214 | if (IS_ERR(clnt4)) { | 214 | if (IS_ERR(clnt4)) { |
215 | dprintk("RPC: failed to create local rpcbind v4 " | 215 | dprintk("RPC: failed to bind second program to " |
216 | "cleint (errno %ld).\n", PTR_ERR(clnt4)); | 216 | "rpcbind v4 client (errno %ld).\n", |
217 | PTR_ERR(clnt4)); | ||
217 | clnt4 = NULL; | 218 | clnt4 = NULL; |
218 | } | 219 | } |
219 | 220 | ||
@@ -477,57 +478,6 @@ int rpcb_v4_register(const u32 program, const u32 version, | |||
477 | return -EAFNOSUPPORT; | 478 | return -EAFNOSUPPORT; |
478 | } | 479 | } |
479 | 480 | ||
480 | /** | ||
481 | * rpcb_getport_sync - obtain the port for an RPC service on a given host | ||
482 | * @sin: address of remote peer | ||
483 | * @prog: RPC program number to bind | ||
484 | * @vers: RPC version number to bind | ||
485 | * @prot: transport protocol to use to make this request | ||
486 | * | ||
487 | * Return value is the requested advertised port number, | ||
488 | * or a negative errno value. | ||
489 | * | ||
490 | * Called from outside the RPC client in a synchronous task context. | ||
491 | * Uses default timeout parameters specified by underlying transport. | ||
492 | * | ||
493 | * XXX: Needs to support IPv6 | ||
494 | */ | ||
495 | int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot) | ||
496 | { | ||
497 | struct rpcbind_args map = { | ||
498 | .r_prog = prog, | ||
499 | .r_vers = vers, | ||
500 | .r_prot = prot, | ||
501 | .r_port = 0, | ||
502 | }; | ||
503 | struct rpc_message msg = { | ||
504 | .rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT], | ||
505 | .rpc_argp = &map, | ||
506 | .rpc_resp = &map, | ||
507 | }; | ||
508 | struct rpc_clnt *rpcb_clnt; | ||
509 | int status; | ||
510 | |||
511 | dprintk("RPC: %s(%pI4, %u, %u, %d)\n", | ||
512 | __func__, &sin->sin_addr.s_addr, prog, vers, prot); | ||
513 | |||
514 | rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin, | ||
515 | sizeof(*sin), prot, RPCBVERS_2); | ||
516 | if (IS_ERR(rpcb_clnt)) | ||
517 | return PTR_ERR(rpcb_clnt); | ||
518 | |||
519 | status = rpc_call_sync(rpcb_clnt, &msg, 0); | ||
520 | rpc_shutdown_client(rpcb_clnt); | ||
521 | |||
522 | if (status >= 0) { | ||
523 | if (map.r_port != 0) | ||
524 | return map.r_port; | ||
525 | status = -EACCES; | ||
526 | } | ||
527 | return status; | ||
528 | } | ||
529 | EXPORT_SYMBOL_GPL(rpcb_getport_sync); | ||
530 | |||
531 | static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, struct rpc_procinfo *proc) | 481 | static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, struct rpc_procinfo *proc) |
532 | { | 482 | { |
533 | struct rpc_message msg = { | 483 | struct rpc_message msg = { |