blob: fc881a675eb9295456a40761bf2ebe2f0ad2453a [file] [log] [blame]
Chuck Levera5090502007-03-29 16:48:04 -04001/*
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
Chuck Levercce63cd2007-07-01 12:13:12 -040015#include <linux/module.h>
16
Chuck Levera5090502007-03-29 16:48:04 -040017#include <linux/types.h>
18#include <linux/socket.h>
19#include <linux/kernel.h>
20#include <linux/errno.h>
21
22#include <linux/sunrpc/clnt.h>
23#include <linux/sunrpc/sched.h>
24
25#ifdef RPC_DEBUG
26# define RPCDBG_FACILITY RPCDBG_BIND
27#endif
28
29#define RPCBIND_PROGRAM (100000u)
30#define RPCBIND_PORT (111u)
31
32enum {
33 RPCBPROC_NULL,
34 RPCBPROC_SET,
35 RPCBPROC_UNSET,
36 RPCBPROC_GETPORT,
37 RPCBPROC_GETADDR = 3, /* alias for GETPORT */
38 RPCBPROC_DUMP,
39 RPCBPROC_CALLIT,
40 RPCBPROC_BCAST = 5, /* alias for CALLIT */
41 RPCBPROC_GETTIME,
42 RPCBPROC_UADDR2TADDR,
43 RPCBPROC_TADDR2UADDR,
44 RPCBPROC_GETVERSADDR,
45 RPCBPROC_INDIRECT,
46 RPCBPROC_GETADDRLIST,
47 RPCBPROC_GETSTAT,
48};
49
50#define RPCB_HIGHPROC_2 RPCBPROC_CALLIT
51#define RPCB_HIGHPROC_3 RPCBPROC_TADDR2UADDR
52#define RPCB_HIGHPROC_4 RPCBPROC_GETSTAT
53
54/*
55 * r_addr
56 *
57 * Quoting RFC 3530, section 2.2:
58 *
59 * For TCP over IPv4 and for UDP over IPv4, the format of r_addr is the
60 * US-ASCII string:
61 *
62 * h1.h2.h3.h4.p1.p2
63 *
64 * The prefix, "h1.h2.h3.h4", is the standard textual form for
65 * representing an IPv4 address, which is always four octets long.
66 * Assuming big-endian ordering, h1, h2, h3, and h4, are respectively,
67 * the first through fourth octets each converted to ASCII-decimal.
68 * Assuming big-endian ordering, p1 and p2 are, respectively, the first
69 * and second octets each converted to ASCII-decimal. For example, if a
70 * host, in big-endian order, has an address of 0x0A010307 and there is
71 * a service listening on, in big endian order, port 0x020F (decimal
72 * 527), then the complete universal address is "10.1.3.7.2.15".
73 *
74 * ...
75 *
76 * For TCP over IPv6 and for UDP over IPv6, the format of r_addr is the
77 * US-ASCII string:
78 *
79 * x1:x2:x3:x4:x5:x6:x7:x8.p1.p2
80 *
81 * The suffix "p1.p2" is the service port, and is computed the same way
82 * as with universal addresses for TCP and UDP over IPv4. The prefix,
83 * "x1:x2:x3:x4:x5:x6:x7:x8", is the standard textual form for
84 * representing an IPv6 address as defined in Section 2.2 of [RFC2373].
85 * Additionally, the two alternative forms specified in Section 2.2 of
86 * [RFC2373] are also acceptable.
87 *
88 * XXX: Currently this implementation does not explicitly convert the
89 * stored address to US-ASCII on non-ASCII systems.
90 */
91#define RPCB_MAXADDRLEN (128u)
92
93/*
94 * r_netid
95 *
96 * Quoting RFC 3530, section 2.2:
97 *
98 * For TCP over IPv4 the value of r_netid is the string "tcp". For UDP
99 * over IPv4 the value of r_netid is the string "udp".
100 *
101 * ...
102 *
103 * For TCP over IPv6 the value of r_netid is the string "tcp6". For UDP
104 * over IPv6 the value of r_netid is the string "udp6".
105 */
106#define RPCB_NETID_UDP "\165\144\160" /* "udp" */
107#define RPCB_NETID_TCP "\164\143\160" /* "tcp" */
108#define RPCB_NETID_UDP6 "\165\144\160\066" /* "udp6" */
109#define RPCB_NETID_TCP6 "\164\143\160\066" /* "tcp6" */
110
111#define RPCB_MAXNETIDLEN (4u)
112
113/*
114 * r_owner
115 *
116 * The "owner" is allowed to unset a service in the rpcbind database.
117 * We always use the following (arbitrary) fixed string.
118 */
119#define RPCB_OWNER_STRING "rpcb"
120#define RPCB_MAXOWNERLEN sizeof(RPCB_OWNER_STRING)
121
122static void rpcb_getport_done(struct rpc_task *, void *);
123extern struct rpc_program rpcb_program;
124
125struct rpcbind_args {
126 struct rpc_xprt * r_xprt;
127
128 u32 r_prog;
129 u32 r_vers;
130 u32 r_prot;
131 unsigned short r_port;
132 char * r_netid;
133 char r_addr[RPCB_MAXADDRLEN];
134 char * r_owner;
135};
136
137static struct rpc_procinfo rpcb_procedures2[];
138static struct rpc_procinfo rpcb_procedures3[];
139
140static struct rpcb_info {
141 int rpc_vers;
142 struct rpc_procinfo * rpc_proc;
143} rpcb_next_version[];
144
145static void rpcb_getport_prepare(struct rpc_task *task, void *calldata)
146{
147 struct rpcbind_args *map = calldata;
148 struct rpc_xprt *xprt = map->r_xprt;
149 struct rpc_message msg = {
150 .rpc_proc = rpcb_next_version[xprt->bind_index].rpc_proc,
151 .rpc_argp = map,
152 .rpc_resp = &map->r_port,
153 };
154
155 rpc_call_setup(task, &msg, 0);
156}
157
158static void rpcb_map_release(void *data)
159{
160 struct rpcbind_args *map = data;
161
162 xprt_put(map->r_xprt);
163 kfree(map);
164}
165
166static const struct rpc_call_ops rpcb_getport_ops = {
167 .rpc_call_prepare = rpcb_getport_prepare,
168 .rpc_call_done = rpcb_getport_done,
169 .rpc_release = rpcb_map_release,
170};
171
172static void rpcb_wake_rpcbind_waiters(struct rpc_xprt *xprt, int status)
173{
174 xprt_clear_binding(xprt);
175 rpc_wake_up_status(&xprt->binding, status);
176}
177
178static struct rpc_clnt *rpcb_create(char *hostname, struct sockaddr *srvaddr,
179 int proto, int version, int privileged)
180{
181 struct rpc_create_args args = {
182 .protocol = proto,
183 .address = srvaddr,
184 .addrsize = sizeof(struct sockaddr_in),
185 .servername = hostname,
186 .program = &rpcb_program,
187 .version = version,
188 .authflavor = RPC_AUTH_UNIX,
Chuck Leverf7fb5582007-07-01 12:13:07 -0400189 .flags = (RPC_CLNT_CREATE_NOPING |
190 RPC_CLNT_CREATE_INTR),
Chuck Levera5090502007-03-29 16:48:04 -0400191 };
192
193 ((struct sockaddr_in *)srvaddr)->sin_port = htons(RPCBIND_PORT);
194 if (!privileged)
195 args.flags |= RPC_CLNT_CREATE_NONPRIVPORT;
196 return rpc_create(&args);
197}
198
199/**
200 * rpcb_register - set or unset a port registration with the local rpcbind svc
201 * @prog: RPC program number to bind
202 * @vers: RPC version number to bind
203 * @prot: transport protocol to use to make this request
204 * @port: port value to register
205 * @okay: result code
206 *
207 * port == 0 means unregister, port != 0 means register.
208 *
209 * This routine supports only rpcbind version 2.
210 */
211int rpcb_register(u32 prog, u32 vers, int prot, unsigned short port, int *okay)
212{
213 struct sockaddr_in sin = {
214 .sin_family = AF_INET,
215 .sin_addr.s_addr = htonl(INADDR_LOOPBACK),
216 };
217 struct rpcbind_args map = {
218 .r_prog = prog,
219 .r_vers = vers,
220 .r_prot = prot,
221 .r_port = port,
222 };
223 struct rpc_message msg = {
224 .rpc_proc = &rpcb_procedures2[port ?
225 RPCBPROC_SET : RPCBPROC_UNSET],
226 .rpc_argp = &map,
227 .rpc_resp = okay,
228 };
229 struct rpc_clnt *rpcb_clnt;
230 int error = 0;
231
232 dprintk("RPC: %sregistering (%u, %u, %d, %u) with local "
233 "rpcbind\n", (port ? "" : "un"),
234 prog, vers, prot, port);
235
236 rpcb_clnt = rpcb_create("localhost", (struct sockaddr *) &sin,
237 IPPROTO_UDP, 2, 1);
238 if (IS_ERR(rpcb_clnt))
239 return PTR_ERR(rpcb_clnt);
240
241 error = rpc_call_sync(rpcb_clnt, &msg, 0);
242
Trond Myklebust90c57552007-06-09 19:49:36 -0400243 rpc_shutdown_client(rpcb_clnt);
Chuck Levera5090502007-03-29 16:48:04 -0400244 if (error < 0)
245 printk(KERN_WARNING "RPC: failed to contact local rpcbind "
246 "server (errno %d).\n", -error);
247 dprintk("RPC: registration status %d/%d\n", error, *okay);
248
249 return error;
250}
251
Chuck Levera5090502007-03-29 16:48:04 -0400252/**
Chuck Levercce63cd2007-07-01 12:13:12 -0400253 * rpcb_getport_sync - obtain the port for an RPC service on a given host
Chuck Levera5090502007-03-29 16:48:04 -0400254 * @sin: address of remote peer
255 * @prog: RPC program number to bind
256 * @vers: RPC version number to bind
257 * @prot: transport protocol to use to make this request
258 *
259 * Called from outside the RPC client in a synchronous task context.
Chuck Levercce63cd2007-07-01 12:13:12 -0400260 * Uses default timeout parameters specified by underlying transport.
Chuck Levera5090502007-03-29 16:48:04 -0400261 *
Chuck Levercce63cd2007-07-01 12:13:12 -0400262 * XXX: Needs to support IPv6, and rpcbind versions 3 and 4
Chuck Levera5090502007-03-29 16:48:04 -0400263 */
Chuck Levercce63cd2007-07-01 12:13:12 -0400264int rpcb_getport_sync(struct sockaddr_in *sin, __u32 prog,
265 __u32 vers, int prot)
Chuck Levera5090502007-03-29 16:48:04 -0400266{
267 struct rpcbind_args map = {
268 .r_prog = prog,
269 .r_vers = vers,
270 .r_prot = prot,
271 .r_port = 0,
272 };
273 struct rpc_message msg = {
274 .rpc_proc = &rpcb_procedures2[RPCBPROC_GETPORT],
275 .rpc_argp = &map,
276 .rpc_resp = &map.r_port,
277 };
278 struct rpc_clnt *rpcb_clnt;
279 char hostname[40];
280 int status;
281
Chuck Levercce63cd2007-07-01 12:13:12 -0400282 dprintk("RPC: %s(" NIPQUAD_FMT ", %u, %u, %d)\n",
283 __FUNCTION__, NIPQUAD(sin->sin_addr.s_addr), prog, vers, prot);
Chuck Levera5090502007-03-29 16:48:04 -0400284
Chuck Levercce63cd2007-07-01 12:13:12 -0400285 sprintf(hostname, NIPQUAD_FMT, NIPQUAD(sin->sin_addr.s_addr));
Chuck Levera5090502007-03-29 16:48:04 -0400286 rpcb_clnt = rpcb_create(hostname, (struct sockaddr *)sin, prot, 2, 0);
287 if (IS_ERR(rpcb_clnt))
288 return PTR_ERR(rpcb_clnt);
289
290 status = rpc_call_sync(rpcb_clnt, &msg, 0);
Trond Myklebust90c57552007-06-09 19:49:36 -0400291 rpc_shutdown_client(rpcb_clnt);
Chuck Levera5090502007-03-29 16:48:04 -0400292
293 if (status >= 0) {
294 if (map.r_port != 0)
295 return map.r_port;
296 status = -EACCES;
297 }
298 return status;
299}
Chuck Levercce63cd2007-07-01 12:13:12 -0400300EXPORT_SYMBOL_GPL(rpcb_getport_sync);
Chuck Levera5090502007-03-29 16:48:04 -0400301
302/**
303 * rpcb_getport - obtain the port for a given RPC service on a given host
304 * @task: task that is waiting for portmapper request
305 *
306 * This one can be called for an ongoing RPC request, and can be used in
307 * an async (rpciod) context.
308 */
309void rpcb_getport(struct rpc_task *task)
310{
311 struct rpc_clnt *clnt = task->tk_client;
312 int bind_version;
313 struct rpc_xprt *xprt = task->tk_xprt;
314 struct rpc_clnt *rpcb_clnt;
315 static struct rpcbind_args *map;
316 struct rpc_task *child;
317 struct sockaddr addr;
318 int status;
319
320 dprintk("RPC: %5u rpcb_getport(%s, %u, %u, %d)\n",
321 task->tk_pid, clnt->cl_server,
322 clnt->cl_prog, clnt->cl_vers, xprt->prot);
323
324 /* Autobind on cloned rpc clients is discouraged */
325 BUG_ON(clnt->cl_parent != clnt);
326
327 if (xprt_test_and_set_binding(xprt)) {
328 status = -EACCES; /* tell caller to check again */
329 dprintk("RPC: %5u rpcb_getport waiting for another binder\n",
330 task->tk_pid);
331 goto bailout_nowake;
332 }
333
334 /* Put self on queue before sending rpcbind request, in case
335 * rpcb_getport_done completes before we return from rpc_run_task */
336 rpc_sleep_on(&xprt->binding, task, NULL, NULL);
337
338 /* Someone else may have bound if we slept */
339 if (xprt_bound(xprt)) {
340 status = 0;
341 dprintk("RPC: %5u rpcb_getport already bound\n", task->tk_pid);
342 goto bailout_nofree;
343 }
344
345 if (rpcb_next_version[xprt->bind_index].rpc_proc == NULL) {
346 xprt->bind_index = 0;
347 status = -EACCES; /* tell caller to try again later */
348 dprintk("RPC: %5u rpcb_getport no more getport versions "
349 "available\n", task->tk_pid);
350 goto bailout_nofree;
351 }
352 bind_version = rpcb_next_version[xprt->bind_index].rpc_vers;
353
354 dprintk("RPC: %5u rpcb_getport trying rpcbind version %u\n",
355 task->tk_pid, bind_version);
356
357 map = kzalloc(sizeof(struct rpcbind_args), GFP_ATOMIC);
358 if (!map) {
359 status = -ENOMEM;
360 dprintk("RPC: %5u rpcb_getport no memory available\n",
361 task->tk_pid);
362 goto bailout_nofree;
363 }
364 map->r_prog = clnt->cl_prog;
365 map->r_vers = clnt->cl_vers;
366 map->r_prot = xprt->prot;
367 map->r_port = 0;
368 map->r_xprt = xprt_get(xprt);
369 map->r_netid = (xprt->prot == IPPROTO_TCP) ? RPCB_NETID_TCP :
370 RPCB_NETID_UDP;
371 memcpy(&map->r_addr, rpc_peeraddr2str(clnt, RPC_DISPLAY_ADDR),
372 sizeof(map->r_addr));
373 map->r_owner = RPCB_OWNER_STRING; /* ignored for GETADDR */
374
375 rpc_peeraddr(clnt, (void *)&addr, sizeof(addr));
376 rpcb_clnt = rpcb_create(clnt->cl_server, &addr, xprt->prot, bind_version, 0);
377 if (IS_ERR(rpcb_clnt)) {
378 status = PTR_ERR(rpcb_clnt);
379 dprintk("RPC: %5u rpcb_getport rpcb_create failed, error %ld\n",
380 task->tk_pid, PTR_ERR(rpcb_clnt));
381 goto bailout;
382 }
383
384 child = rpc_run_task(rpcb_clnt, RPC_TASK_ASYNC, &rpcb_getport_ops, map);
Trond Myklebust4c402b42007-06-14 16:40:32 -0400385 rpc_release_client(rpcb_clnt);
Chuck Levera5090502007-03-29 16:48:04 -0400386 if (IS_ERR(child)) {
387 status = -EIO;
388 dprintk("RPC: %5u rpcb_getport rpc_run_task failed\n",
389 task->tk_pid);
390 goto bailout_nofree;
391 }
392 rpc_put_task(child);
393
394 task->tk_xprt->stat.bind_count++;
395 return;
396
397bailout:
398 kfree(map);
399 xprt_put(xprt);
400bailout_nofree:
401 rpcb_wake_rpcbind_waiters(xprt, status);
402bailout_nowake:
403 task->tk_status = status;
404}
405
406/*
407 * Rpcbind child task calls this callback via tk_exit.
408 */
409static void rpcb_getport_done(struct rpc_task *child, void *data)
410{
411 struct rpcbind_args *map = data;
412 struct rpc_xprt *xprt = map->r_xprt;
413 int status = child->tk_status;
414
415 /* rpcbind server doesn't support this rpcbind protocol version */
416 if (status == -EPROTONOSUPPORT)
417 xprt->bind_index++;
418
419 if (status < 0) {
420 /* rpcbind server not available on remote host? */
421 xprt->ops->set_port(xprt, 0);
422 } else if (map->r_port == 0) {
423 /* Requested RPC service wasn't registered on remote host */
424 xprt->ops->set_port(xprt, 0);
425 status = -EACCES;
426 } else {
427 /* Succeeded */
428 xprt->ops->set_port(xprt, map->r_port);
429 xprt_set_bound(xprt);
430 status = 0;
431 }
432
433 dprintk("RPC: %5u rpcb_getport_done(status %d, port %u)\n",
434 child->tk_pid, status, map->r_port);
435
436 rpcb_wake_rpcbind_waiters(xprt, status);
437}
438
439static int rpcb_encode_mapping(struct rpc_rqst *req, __be32 *p,
440 struct rpcbind_args *rpcb)
441{
442 dprintk("RPC: rpcb_encode_mapping(%u, %u, %d, %u)\n",
443 rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port);
444 *p++ = htonl(rpcb->r_prog);
445 *p++ = htonl(rpcb->r_vers);
446 *p++ = htonl(rpcb->r_prot);
447 *p++ = htonl(rpcb->r_port);
448
449 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
450 return 0;
451}
452
453static int rpcb_decode_getport(struct rpc_rqst *req, __be32 *p,
454 unsigned short *portp)
455{
456 *portp = (unsigned short) ntohl(*p++);
457 dprintk("RPC: rpcb_decode_getport result %u\n",
458 *portp);
459 return 0;
460}
461
462static int rpcb_decode_set(struct rpc_rqst *req, __be32 *p,
463 unsigned int *boolp)
464{
465 *boolp = (unsigned int) ntohl(*p++);
466 dprintk("RPC: rpcb_decode_set result %u\n",
467 *boolp);
468 return 0;
469}
470
471static int rpcb_encode_getaddr(struct rpc_rqst *req, __be32 *p,
472 struct rpcbind_args *rpcb)
473{
474 dprintk("RPC: rpcb_encode_getaddr(%u, %u, %s)\n",
475 rpcb->r_prog, rpcb->r_vers, rpcb->r_addr);
476 *p++ = htonl(rpcb->r_prog);
477 *p++ = htonl(rpcb->r_vers);
478
479 p = xdr_encode_string(p, rpcb->r_netid);
480 p = xdr_encode_string(p, rpcb->r_addr);
481 p = xdr_encode_string(p, rpcb->r_owner);
482
483 req->rq_slen = xdr_adjust_iovec(req->rq_svec, p);
484
485 return 0;
486}
487
488static int rpcb_decode_getaddr(struct rpc_rqst *req, __be32 *p,
489 unsigned short *portp)
490{
491 char *addr;
492 int addr_len, c, i, f, first, val;
493
494 *portp = 0;
495 addr_len = (unsigned int) ntohl(*p++);
496 if (addr_len > RPCB_MAXADDRLEN) /* sanity */
497 return -EINVAL;
498
499 dprintk("RPC: rpcb_decode_getaddr returned string: '%s'\n",
500 (char *) p);
501
502 addr = (char *)p;
503 val = 0;
504 first = 1;
505 f = 1;
506 for (i = addr_len - 1; i > 0; i--) {
507 c = addr[i];
508 if (c >= '0' && c <= '9') {
509 val += (c - '0') * f;
510 f *= 10;
511 } else if (c == '.') {
512 if (first) {
513 *portp = val;
514 val = first = 0;
515 f = 1;
516 } else {
517 *portp |= (val << 8);
518 break;
519 }
520 }
521 }
522
523 dprintk("RPC: rpcb_decode_getaddr port=%u\n", *portp);
524 return 0;
525}
526
527#define RPCB_program_sz (1u)
528#define RPCB_version_sz (1u)
529#define RPCB_protocol_sz (1u)
530#define RPCB_port_sz (1u)
531#define RPCB_boolean_sz (1u)
532
533#define RPCB_netid_sz (1+XDR_QUADLEN(RPCB_MAXNETIDLEN))
534#define RPCB_addr_sz (1+XDR_QUADLEN(RPCB_MAXADDRLEN))
535#define RPCB_ownerstring_sz (1+XDR_QUADLEN(RPCB_MAXOWNERLEN))
536
537#define RPCB_mappingargs_sz RPCB_program_sz+RPCB_version_sz+ \
538 RPCB_protocol_sz+RPCB_port_sz
539#define RPCB_getaddrargs_sz RPCB_program_sz+RPCB_version_sz+ \
540 RPCB_netid_sz+RPCB_addr_sz+ \
541 RPCB_ownerstring_sz
542
543#define RPCB_setres_sz RPCB_boolean_sz
544#define RPCB_getportres_sz RPCB_port_sz
545
546/*
547 * Note that RFC 1833 does not put any size restrictions on the
548 * address string returned by the remote rpcbind database.
549 */
550#define RPCB_getaddrres_sz RPCB_addr_sz
551
552#define PROC(proc, argtype, restype) \
553 [RPCBPROC_##proc] = { \
554 .p_proc = RPCBPROC_##proc, \
555 .p_encode = (kxdrproc_t) rpcb_encode_##argtype, \
556 .p_decode = (kxdrproc_t) rpcb_decode_##restype, \
557 .p_arglen = RPCB_##argtype##args_sz, \
558 .p_replen = RPCB_##restype##res_sz, \
559 .p_statidx = RPCBPROC_##proc, \
560 .p_timer = 0, \
561 .p_name = #proc, \
562 }
563
564/*
565 * Not all rpcbind procedures described in RFC 1833 are implemented
566 * since the Linux kernel RPC code requires only these.
567 */
568static struct rpc_procinfo rpcb_procedures2[] = {
569 PROC(SET, mapping, set),
570 PROC(UNSET, mapping, set),
571 PROC(GETADDR, mapping, getport),
572};
573
574static struct rpc_procinfo rpcb_procedures3[] = {
575 PROC(SET, mapping, set),
576 PROC(UNSET, mapping, set),
577 PROC(GETADDR, getaddr, getaddr),
578};
579
580static struct rpc_procinfo rpcb_procedures4[] = {
581 PROC(SET, mapping, set),
582 PROC(UNSET, mapping, set),
583 PROC(GETVERSADDR, getaddr, getaddr),
584};
585
586static struct rpcb_info rpcb_next_version[] = {
587#ifdef CONFIG_SUNRPC_BIND34
588 { 4, &rpcb_procedures4[RPCBPROC_GETVERSADDR] },
589 { 3, &rpcb_procedures3[RPCBPROC_GETADDR] },
590#endif
591 { 2, &rpcb_procedures2[RPCBPROC_GETPORT] },
592 { 0, NULL },
593};
594
595static struct rpc_version rpcb_version2 = {
596 .number = 2,
597 .nrprocs = RPCB_HIGHPROC_2,
598 .procs = rpcb_procedures2
599};
600
601static struct rpc_version rpcb_version3 = {
602 .number = 3,
603 .nrprocs = RPCB_HIGHPROC_3,
604 .procs = rpcb_procedures3
605};
606
607static struct rpc_version rpcb_version4 = {
608 .number = 4,
609 .nrprocs = RPCB_HIGHPROC_4,
610 .procs = rpcb_procedures4
611};
612
613static struct rpc_version *rpcb_version[] = {
614 NULL,
615 NULL,
616 &rpcb_version2,
617 &rpcb_version3,
618 &rpcb_version4
619};
620
621static struct rpc_stat rpcb_stats;
622
623struct rpc_program rpcb_program = {
624 .name = "rpcbind",
625 .number = RPCBIND_PROGRAM,
626 .nrvers = ARRAY_SIZE(rpcb_version),
627 .version = rpcb_version,
628 .stats = &rpcb_stats,
629};