net: replace remaining __FUNCTION__ occurrences
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / sunrpc / rpcb_clnt.c
CommitLineData
a509050b
CL
1/*
2 * In-kernel rpcbind client supporting versions 2, 3, and 4 of the rpcbind
3 * protocol
4 *
5 * Based on RFC 1833: "Binding Protocols for ONC RPC Version 2" and
6 * RFC 3530: "Network File System (NFS) version 4 Protocol"
7 *
8 * Original: Gilles Quillard, Bull Open Source, 2005 <gilles.quillard@bull.net>
9 * Updated: Chuck Lever, Oracle Corporation, 2007 <chuck.lever@oracle.com>
10 *
11 * Descended from net/sunrpc/pmap_clnt.c,
12 * Copyright (C) 1996, Olaf Kirch <okir@monad.swb.de>
13 */
14
cce63cd6
CL
15#include <linux/module.h>
16
a509050b
CL
17#include <linux/types.h>
18#include <linux/socket.h>
d5b64430
CL
19#include <linux/in.h>
20#include <linux/in6.h>
a509050b
CL
21#include <linux/kernel.h>
22#include <linux/errno.h>
23
24#include <linux/sunrpc/clnt.h>
25#include <linux/sunrpc/sched.h>
0896a725 26#include <linux/sunrpc/xprtsock.h>
a509050b
CL
27
28#ifdef RPC_DEBUG
29# define RPCDBG_FACILITY RPCDBG_BIND
30#endif
31
32#define RPCBIND_PROGRAM (100000u)
33#define RPCBIND_PORT (111u)
34
35enum {
36 RPCBPROC_NULL,
37 RPCBPROC_SET,
38 RPCBPROC_UNSET,
39 RPCBPROC_GETPORT,
40 RPCBPROC_GETADDR = 3, /* alias for GETPORT */
41 RPCBPROC_DUMP,
42 RPCBPROC_CALLIT,
43 RPCBPROC_BCAST = 5, /* alias for CALLIT */
44 RPCBPROC_GETTIME,
45 RPCBPROC_UADDR2TADDR,
46 RPCBPROC_TADDR2UADDR,
47 RPCBPROC_GETVERSADDR,
48 RPCBPROC_INDIRECT,
49 RPCBPROC_GETADDRLIST,
50 RPCBPROC_GETSTAT,
51};
52
53#define RPCB_HIGHPROC_2 RPCBPROC_CALLIT
54#define RPCB_HIGHPROC_3 RPCBPROC_TADDR2UADDR
55#define RPCB_HIGHPROC_4 RPCBPROC_GETSTAT
56
a509050b
CL
57/*
58 * r_owner
59 *
60 * The "owner" is allowed to unset a service in the rpcbind database.
61 * We always use the following (arbitrary) fixed string.
62 */
63#define RPCB_OWNER_STRING "rpcb"
64#define RPCB_MAXOWNERLEN sizeof(RPCB_OWNER_STRING)
65
66static void rpcb_getport_done(struct rpc_task *, void *);
7f4adeff 67static struct rpc_program rpcb_program;
a509050b
CL
68
69struct rpcbind_args {
70 struct rpc_xprt * r_xprt;
71
72 u32 r_prog;
73 u32 r_vers;
74 u32 r_prot;
75 unsigned short r_port;
86d61d86
TM
76 const char * r_netid;
77 const char * r_addr;
78 const char * r_owner;
a509050b
CL
79};
80
81static struct rpc_procinfo rpcb_procedures2[];
82static struct rpc_procinfo rpcb_procedures3[];
83
d5b64430 84struct rpcb_info {
a509050b
CL
85 int rpc_vers;
86 struct rpc_procinfo * rpc_proc;
d5b64430
CL
87};
88
89static struct rpcb_info rpcb_next_version[];
90static struct rpcb_info rpcb_next_version6[];
a509050b 91
a509050b
CL
92static void rpcb_map_release(void *data)
93{
94 struct rpcbind_args *map = data;
95
96 xprt_put(map->r_xprt);
97 kfree(map);
98}
99
100static const struct rpc_call_ops rpcb_getport_ops = {
a509050b
CL
101 .rpc_call_done = rpcb_getport_done,
102 .rpc_release = rpcb_map_release,
103};
104
105static void rpcb_wake_rpcbind_waiters(struct rpc_xprt *xprt, int status)
106{
107 xprt_clear_binding(xprt);
108 rpc_wake_up_status(&xprt->binding, status);
109}
110
111static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
0a48f5d7 112 size_t salen, int proto, u32 version,
9f6ad26d 113 int privileged)
a509050b
CL
114{
115 struct rpc_create_args args = {
116 .protocol = proto,
117 .address = srvaddr,
9f6ad26d 118 .addrsize = salen,
a509050b
CL
119 .servername = hostname,
120 .program = &rpcb_program,
121 .version = version,
122 .authflavor = RPC_AUTH_UNIX,
150030b7 123 .flags = RPC_CLNT_CREATE_NOPING,
a509050b
CL
124 };
125
d5b64430
CL
126 switch (srvaddr->sa_family) {
127 case AF_INET:
128 ((struct sockaddr_in *)srvaddr)->sin_port = htons(RPCBIND_PORT);
129 break;
130 case AF_INET6:
131 ((struct sockaddr_in6 *)srvaddr)->sin6_port = htons(RPCBIND_PORT);
132 break;
133 default:
134 return NULL;
135 }
136
a509050b
CL
137 if (!privileged)
138 args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
139 return rpc_create(&args);
140}
141
142/**
143 * rpcb_register - set or unset a port registration with the local rpcbind svc
144 * @prog: RPC program number to bind
145 * @vers: RPC version number to bind
146 * @prot: transport protocol to use to make this request
147 * @port: port value to register
148 * @okay: result code
149 *
150 * port == 0 means unregister, port != 0 means register.
151 *
152 * This routine supports only rpcbind version 2.
153 */
154int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
155{
156 struct sockaddr_in sin = {
157 .sin_family = AF_INET,
158 .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
159 };
160 struct rpcbind_args map = {
161 .r_prog = prog,
162 .r_vers = vers,
163 .r_prot = prot,
164 .r_port = port,
165 };
166 struct rpc_message msg = {
167 .rpc_proc = &rpcb_procedures2[port ?
168 RPCBPROC_SET : RPCBPROC_UNSET],
169 .rpc_argp = &map,
170 .rpc_resp = okay,
171 };
172 struct rpc_clnt *rpcb_clnt;
173 int error = 0;
174
175 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
176 "rpcbind\n", (port ? "" : "un"),
177 prog, vers, prot, port);
178
179 rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
9f6ad26d 180 sizeof(sin), XPRT_TRANSPORT_UDP, 2, 1);
a509050b
CL
181 if (IS_ERR(rpcb_clnt))
182 return PTR_ERR(rpcb_clnt);
183
184 error = rpc_call_sync(rpcb_clnt, &msg, 0);
185
90c5755f 186 rpc_shutdown_client(rpcb_clnt);
a509050b
CL
187 if (error < 0)
188 printk(KERN_WARNING "RPC: failed to contact local rpcbind "
189 "server (errno %d).\n", -error);
190 dprintk("RPC: registration status %d/%d\n", error, *okay);
191
192 return error;
193}
194
a509050b 195/**
cce63cd6 196 * rpcb_getport_sync - obtain the port for an RPC service on a given host
a509050b
CL
197 * @sin: address of remote peer
198 * @prog: RPC program number to bind
199 * @vers: RPC version number to bind
200 * @prot: transport protocol to use to make this request
201 *
67d60213
CL
202 * Return value is the requested advertised port number,
203 * or a negative errno value.
204 *
a509050b 205 * Called from outside the RPC client in a synchronous task context.
cce63cd6 206 * Uses default timeout parameters specified by underlying transport.
a509050b 207 *
67d60213 208 * XXX: Needs to support IPv6
a509050b 209 */
f1ec08cb 210int rpcb_getport_sync(struct sockaddr_in *sin, u32 prog, u32 vers, int prot)
a509050b
CL
211{
212 struct rpcbind_args map = {
213 .r_prog = prog,
214 .r_vers = vers,
215 .r_prot = prot,
216 .r_port = 0,
217 };
218 struct rpc_message msg = {
219 .rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT],
220 .rpc_argp = &map,
221 .rpc_resp = &map.r_port,
222 };
223 struct rpc_clnt *rpcb_clnt;
a509050b
CL
224 int status;
225
cce63cd6 226 dprintk("RPC: %s(" NIPQUAD_FMT ", %u, %u, %d)\n",
0dc47877 227 __func__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
a509050b 228
b91e101f 229 rpcb_clnt = rpcb_create(NULL, (struct sockaddr *)sin,
afc88112 230 sizeof(*sin), prot, 2, 0);
a509050b
CL
231 if (IS_ERR(rpcb_clnt))
232 return PTR_ERR(rpcb_clnt);
233
234 status = rpc_call_sync(rpcb_clnt, &msg, 0);
90c5755f 235 rpc_shutdown_client(rpcb_clnt);
a509050b
CL
236
237 if (status >= 0) {
238 if (map.r_port != 0)
239 return map.r_port;
240 status = -EACCES;
241 }
242 return status;
243}
cce63cd6 244EXPORT_SYMBOL_GPL(rpcb_getport_sync);
a509050b 245
5138fde0
TM
246static struct rpc_task *rpcb_call_async(struct rpc_clnt *rpcb_clnt, struct rpcbind_args *map, int version)
247{
248 struct rpc_message msg = {
249 .rpc_proc = rpcb_next_version[version].rpc_proc,
250 .rpc_argp = map,
251 .rpc_resp = &map->r_port,
252 };
253 struct rpc_task_setup task_setup_data = {
254 .rpc_client = rpcb_clnt,
255 .rpc_message = &msg,
256 .callback_ops = &rpcb_getport_ops,
257 .callback_data = map,
258 .flags = RPC_TASK_ASYNC,
259 };
260
261 return rpc_run_task(&task_setup_data);
262}
263
a509050b 264/**
45160d62 265 * rpcb_getport_async - obtain the port for a given RPC service on a given host
a509050b
CL
266 * @task: task that is waiting for portmapper request
267 *
268 * This one can be called for an ongoing RPC request, and can be used in
269 * an async (rpciod) context.
270 */
45160d62 271void rpcb_getport_async(struct rpc_task *task)
a509050b
CL
272{
273 struct rpc_clnt *clnt = task->tk_client;
0a48f5d7 274 u32 bind_version;
a509050b
CL
275 struct rpc_xprt *xprt = task->tk_xprt;
276 struct rpc_clnt *rpcb_clnt;
277 static struct rpcbind_args *map;
278 struct rpc_task *child;
9f6ad26d
CL
279 struct sockaddr_storage addr;
280 struct sockaddr *sap = (struct sockaddr *)&addr;
281 size_t salen;
a509050b 282 int status;
d5b64430 283 struct rpcb_info *info;
a509050b 284
45160d62 285 dprintk("RPC: %5u %s(%s, %u, %u, %d)\n",
0dc47877 286 task->tk_pid, __func__,
45160d62 287 clnt->cl_server, clnt->cl_prog, clnt->cl_vers, xprt->prot);
a509050b
CL
288
289 /* Autobind on cloned rpc clients is discouraged */
290 BUG_ON(clnt->cl_parent != clnt);
291
292 if (xprt_test_and_set_binding(xprt)) {
2429cbf6 293 status = -EAGAIN; /* tell caller to check again */
45160d62 294 dprintk("RPC: %5u %s: waiting for another binder\n",
0dc47877 295 task->tk_pid, __func__);
a509050b
CL
296 goto bailout_nowake;
297 }
298
299 /* Put self on queue before sending rpcbind request, in case
300 * rpcb_getport_done completes before we return from rpc_run_task */
301 rpc_sleep_on(&xprt->binding, task, NULL, NULL);
302
303 /* Someone else may have bound if we slept */
304 if (xprt_bound(xprt)) {
305 status = 0;
45160d62 306 dprintk("RPC: %5u %s: already bound\n",
0dc47877 307 task->tk_pid, __func__);
a509050b
CL
308 goto bailout_nofree;
309 }
310
9f6ad26d 311 salen = rpc_peeraddr(clnt, sap, sizeof(addr));
d5b64430
CL
312
313 /* Don't ever use rpcbind v2 for AF_INET6 requests */
9f6ad26d 314 switch (sap->sa_family) {
d5b64430
CL
315 case AF_INET:
316 info = rpcb_next_version;
317 break;
318 case AF_INET6:
319 info = rpcb_next_version6;
320 break;
321 default:
322 status = -EAFNOSUPPORT;
323 dprintk("RPC: %5u %s: bad address family\n",
0dc47877 324 task->tk_pid, __func__);
d5b64430
CL
325 goto bailout_nofree;
326 }
327 if (info[xprt->bind_index].rpc_proc == NULL) {
a509050b 328 xprt->bind_index = 0;
906462af 329 status = -EPFNOSUPPORT;
45160d62 330 dprintk("RPC: %5u %s: no more getport versions available\n",
0dc47877 331 task->tk_pid, __func__);
a509050b
CL
332 goto bailout_nofree;
333 }
d5b64430 334 bind_version = info[xprt->bind_index].rpc_vers;
a509050b 335
45160d62 336 dprintk("RPC: %5u %s: trying rpcbind version %u\n",
0dc47877 337 task->tk_pid, __func__, bind_version);
a509050b 338
9f6ad26d 339 rpcb_clnt = rpcb_create(clnt->cl_server, sap, salen, xprt->prot,
143b6c40
CL
340 bind_version, 0);
341 if (IS_ERR(rpcb_clnt)) {
342 status = PTR_ERR(rpcb_clnt);
343 dprintk("RPC: %5u %s: rpcb_create failed, error %ld\n",
0dc47877 344 task->tk_pid, __func__, PTR_ERR(rpcb_clnt));
143b6c40
CL
345 goto bailout_nofree;
346 }
347
a509050b
CL
348 map = kzalloc(sizeof(struct rpcbind_args), GFP_ATOMIC);
349 if (!map) {
350 status = -ENOMEM;
45160d62 351 dprintk("RPC: %5u %s: no memory available\n",
0dc47877 352 task->tk_pid, __func__);
a509050b
CL
353 goto bailout_nofree;
354 }
355 map->r_prog = clnt->cl_prog;
356 map->r_vers = clnt->cl_vers;
357 map->r_prot = xprt->prot;
358 map->r_port = 0;
359 map->r_xprt = xprt_get(xprt);
86d61d86
TM
360 map->r_netid = rpc_peeraddr2str(clnt, RPC_DISPLAY_NETID);
361 map->r_addr = rpc_peeraddr2str(rpcb_clnt, RPC_DISPLAY_UNIVERSAL_ADDR);
a509050b
CL
362 map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */
363
5138fde0 364 child = rpcb_call_async(rpcb_clnt, map, xprt->bind_index);
4c402b40 365 rpc_release_client(rpcb_clnt);
a509050b
CL
366 if (IS_ERR(child)) {
367 status = -EIO;
45160d62 368 dprintk("RPC: %5u %s: rpc_run_task failed\n",
0dc47877 369 task->tk_pid, __func__);
143b6c40 370 goto bailout;
a509050b
CL
371 }
372 rpc_put_task(child);
373
374 task->tk_xprt->stat.bind_count++;
375 return;
376
377bailout:
378 kfree(map);
379 xprt_put(xprt);
380bailout_nofree:
381 rpcb_wake_rpcbind_waiters(xprt, status);
382bailout_nowake:
383 task->tk_status = status;
384}
12444809 385EXPORT_SYMBOL_GPL(rpcb_getport_async);
a509050b
CL
386
387/*
388 * Rpcbind child task calls this callback via tk_exit.
389 */
390static void rpcb_getport_done(struct rpc_task *child, void *data)
391{
392 struct rpcbind_args *map = data;
393 struct rpc_xprt *xprt = map->r_xprt;
394 int status = child->tk_status;
395
4784cb51
CL
396 /* Garbage reply: retry with a lesser rpcbind version */
397 if (status == -EIO)
398 status = -EPROTONOSUPPORT;
399
a509050b
CL
400 /* rpcbind server doesn't support this rpcbind protocol version */
401 if (status == -EPROTONOSUPPORT)
402 xprt->bind_index++;
403
404 if (status < 0) {
405 /* rpcbind server not available on remote host? */
406 xprt->ops->set_port(xprt, 0);
407 } else if (map->r_port == 0) {
408 /* Requested RPC service wasn't registered on remote host */
409 xprt->ops->set_port(xprt, 0);
410 status = -EACCES;
411 } else {
412 /* Succeeded */
413 xprt->ops->set_port(xprt, map->r_port);
414 xprt_set_bound(xprt);
415 status = 0;
416 }
417
418 dprintk("RPC: %5u rpcb_getport_done(status %d, port %u)\n",
419 child->tk_pid, status, map->r_port);
420
421 rpcb_wake_rpcbind_waiters(xprt, status);
422}
423
424static int rpcb_encode_mapping(struct rpc_rqst *req, __be32 *p,
425 struct rpcbind_args *rpcb)
426{
427 dprintk("RPC: rpcb_encode_mapping(%u, %u, %d, %u)\n",
428 rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port);
429 *p++ = htonl(rpcb->r_prog);
430 *p++ = htonl(rpcb->r_vers);
431 *p++ = htonl(rpcb->r_prot);
432 *p++ = htonl(rpcb->r_port);
433
434 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
435 return 0;
436}
437
438static int rpcb_decode_getport(struct rpc_rqst *req, __be32 *p,
439 unsigned short *portp)
440{
441 *portp = (unsigned short) ntohl(*p++);
442 dprintk("RPC: rpcb_decode_getport result %u\n",
443 *portp);
444 return 0;
445}
446
447static int rpcb_decode_set(struct rpc_rqst *req, __be32 *p,
448 unsigned int *boolp)
449{
450 *boolp = (unsigned int) ntohl(*p++);
451 dprintk("RPC: rpcb_decode_set result %u\n",
452 *boolp);
453 return 0;
454}
455
456static int rpcb_encode_getaddr(struct rpc_rqst *req, __be32 *p,
457 struct rpcbind_args *rpcb)
458{
459 dprintk("RPC: rpcb_encode_getaddr(%u, %u, %s)\n",
460 rpcb->r_prog, rpcb->r_vers, rpcb->r_addr);
461 *p++ = htonl(rpcb->r_prog);
462 *p++ = htonl(rpcb->r_vers);
463
464 p = xdr_encode_string(p, rpcb->r_netid);
465 p = xdr_encode_string(p, rpcb->r_addr);
466 p = xdr_encode_string(p, rpcb->r_owner);
467
468 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
469
470 return 0;
471}
472
473static int rpcb_decode_getaddr(struct rpc_rqst *req, __be32 *p,
474 unsigned short *portp)
475{
476 char *addr;
adc24df8
CL
477 u32 addr_len;
478 int c, i, f, first, val;
a509050b
CL
479
480 *portp = 0;
adc24df8 481 addr_len = ntohl(*p++);
a509050b 482
e65fe397
CL
483 /*
484 * Simple sanity check. The smallest possible universal
485 * address is an IPv4 address string containing 11 bytes.
486 */
0fb2b7e9 487 if (addr_len < 11 || addr_len > RPCBIND_MAXUADDRLEN)
e65fe397
CL
488 goto out_err;
489
490 /*
491 * Start at the end and walk backwards until the first dot
492 * is encountered. When the second dot is found, we have
493 * both parts of the port number.
494 */
a509050b
CL
495 addr = (char *)p;
496 val = 0;
497 first = 1;
498 f = 1;
499 for (i = addr_len - 1; i > 0; i--) {
500 c = addr[i];
501 if (c >= '0' && c <= '9') {
502 val += (c - '0') * f;
503 f *= 10;
504 } else if (c == '.') {
505 if (first) {
506 *portp = val;
507 val = first = 0;
508 f = 1;
509 } else {
510 *portp |= (val << 8);
511 break;
512 }
513 }
514 }
515
e65fe397
CL
516 /*
517 * Simple sanity check. If we never saw a dot in the reply,
518 * then this was probably just garbage.
519 */
520 if (first)
521 goto out_err;
522
a509050b
CL
523 dprintk("RPC: rpcb_decode_getaddr port=%u\n", *portp);
524 return 0;
e65fe397
CL
525
526out_err:
527 dprintk("RPC: rpcbind server returned malformed reply\n");
528 return -EIO;
a509050b
CL
529}
530
531#define RPCB_program_sz (1u)
532#define RPCB_version_sz (1u)
533#define RPCB_protocol_sz (1u)
534#define RPCB_port_sz (1u)
535#define RPCB_boolean_sz (1u)
536
4f40ee4a 537#define RPCB_netid_sz (1+XDR_QUADLEN(RPCBIND_MAXNETIDLEN))
0fb2b7e9 538#define RPCB_addr_sz (1+XDR_QUADLEN(RPCBIND_MAXUADDRLEN))
a509050b
CL
539#define RPCB_ownerstring_sz (1+XDR_QUADLEN(RPCB_MAXOWNERLEN))
540
541#define RPCB_mappingargs_sz RPCB_program_sz+RPCB_version_sz+ \
542 RPCB_protocol_sz+RPCB_port_sz
543#define RPCB_getaddrargs_sz RPCB_program_sz+RPCB_version_sz+ \
544 RPCB_netid_sz+RPCB_addr_sz+ \
545 RPCB_ownerstring_sz
546
547#define RPCB_setres_sz RPCB_boolean_sz
548#define RPCB_getportres_sz RPCB_port_sz
549
550/*
551 * Note that RFC 1833 does not put any size restrictions on the
552 * address string returned by the remote rpcbind database.
553 */
554#define RPCB_getaddrres_sz RPCB_addr_sz
555
556#define PROC(proc, argtype, restype) \
557 [RPCBPROC_##proc] = { \
558 .p_proc = RPCBPROC_##proc, \
559 .p_encode = (kxdrproc_t) rpcb_encode_##argtype, \
560 .p_decode = (kxdrproc_t) rpcb_decode_##restype, \
561 .p_arglen = RPCB_##argtype##args_sz, \
562 .p_replen = RPCB_##restype##res_sz, \
563 .p_statidx = RPCBPROC_##proc, \
564 .p_timer = 0, \
565 .p_name = #proc, \
566 }
567
568/*
569 * Not all rpcbind procedures described in RFC 1833 are implemented
570 * since the Linux kernel RPC code requires only these.
571 */
572static struct rpc_procinfo rpcb_procedures2[] = {
573 PROC(SET, mapping, set),
574 PROC(UNSET, mapping, set),
575 PROC(GETADDR, mapping, getport),
576};
577
578static struct rpc_procinfo rpcb_procedures3[] = {
579 PROC(SET, mapping, set),
580 PROC(UNSET, mapping, set),
581 PROC(GETADDR, getaddr, getaddr),
582};
583
584static struct rpc_procinfo rpcb_procedures4[] = {
585 PROC(SET, mapping, set),
586 PROC(UNSET, mapping, set),
587 PROC(GETVERSADDR, getaddr, getaddr),
588};
589
590static struct rpcb_info rpcb_next_version[] = {
591#ifdef CONFIG_SUNRPC_BIND34
592 { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] },
593 { 3, &rpcb_procedures3[RPCBPROC_GETADDR] },
594#endif
595 { 2, &rpcb_procedures2[RPCBPROC_GETPORT] },
596 { 0, NULL },
597};
598
d5b64430
CL
599static struct rpcb_info rpcb_next_version6[] = {
600#ifdef CONFIG_SUNRPC_BIND34
601 { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] },
602 { 3, &rpcb_procedures3[RPCBPROC_GETADDR] },
603#endif
604 { 0, NULL },
605};
606
a509050b
CL
607static struct rpc_version rpcb_version2 = {
608 .number = 2,
609 .nrprocs = RPCB_HIGHPROC_2,
610 .procs = rpcb_procedures2
611};
612
613static struct rpc_version rpcb_version3 = {
614 .number = 3,
615 .nrprocs = RPCB_HIGHPROC_3,
616 .procs = rpcb_procedures3
617};
618
619static struct rpc_version rpcb_version4 = {
620 .number = 4,
621 .nrprocs = RPCB_HIGHPROC_4,
622 .procs = rpcb_procedures4
623};
624
625static struct rpc_version *rpcb_version[] = {
626 NULL,
627 NULL,
628 &rpcb_version2,
629 &rpcb_version3,
630 &rpcb_version4
631};
632
633static struct rpc_stat rpcb_stats;
634
7f4adeff 635static struct rpc_program rpcb_program = {
a509050b
CL
636 .name = "rpcbind",
637 .number = RPCBIND_PROGRAM,
638 .nrvers = ARRAY_SIZE(rpcb_version),
639 .version = rpcb_version,
640 .stats = &rpcb_stats,
641};