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