svc_udp.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /* @(#)svc_udp.c 2.2 88/07/29 4.0 RPCSRC */
  2. /*
  3. * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  4. * unrestricted use provided that this legend is included on all tape
  5. * media and as a part of the software program in whole or part. Users
  6. * may copy or modify Sun RPC without charge, but are not authorized
  7. * to license or distribute it to anyone else except as part of a product or
  8. * program developed by the user.
  9. *
  10. * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  11. * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  12. * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  13. *
  14. * Sun RPC is provided with no support and without any obligation on the
  15. * part of Sun Microsystems, Inc. to assist in its use, correction,
  16. * modification or enhancement.
  17. *
  18. * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  19. * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  20. * OR ANY PART THEREOF.
  21. *
  22. * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  23. * or profits or other special, indirect and consequential damages, even if
  24. * Sun has been advised of the possibility of such damages.
  25. *
  26. * Sun Microsystems, Inc.
  27. * 2550 Garcia Avenue
  28. * Mountain View, California 94043
  29. */
  30. #if 0
  31. static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
  32. #endif
  33. /*
  34. * svc_udp.c,
  35. * Server side for UDP/IP based RPC. (Does some caching in the hopes of
  36. * achieving execute-at-most-once semantics.)
  37. *
  38. * Copyright (C) 1984, Sun Microsystems, Inc.
  39. */
  40. #define xprt_register __xprt_register
  41. #define xdrmem_create __xdrmem_create
  42. #define xdr_callmsg __xdr_callmsg
  43. #define xdr_replymsg __xdr_replymsg
  44. #define __FORCE_GLIBC
  45. #define _GNU_SOURCE
  46. #include <features.h>
  47. #include <stdio.h>
  48. #include <unistd.h>
  49. #include <string.h>
  50. #include <rpc/rpc.h>
  51. #include <sys/socket.h>
  52. #include <errno.h>
  53. #ifdef IP_PKTINFO
  54. #include <sys/uio.h>
  55. #endif
  56. #ifdef USE_IN_LIBIO
  57. # include <wchar.h>
  58. # include <libio/iolibio.h>
  59. # define fputs(s, f) _IO_fputs (s, f)
  60. #endif
  61. #define rpc_buffer(xprt) ((xprt)->xp_p1)
  62. #ifndef MAX
  63. #define MAX(a, b) ((a > b) ? a : b)
  64. #endif
  65. static bool_t svcudp_recv (SVCXPRT *, struct rpc_msg *);
  66. static bool_t svcudp_reply (SVCXPRT *, struct rpc_msg *);
  67. static enum xprt_stat svcudp_stat (SVCXPRT *);
  68. static bool_t svcudp_getargs (SVCXPRT *, xdrproc_t, caddr_t);
  69. static bool_t svcudp_freeargs (SVCXPRT *, xdrproc_t, caddr_t);
  70. static void svcudp_destroy (SVCXPRT *);
  71. static const struct xp_ops svcudp_op =
  72. {
  73. svcudp_recv,
  74. svcudp_stat,
  75. svcudp_getargs,
  76. svcudp_reply,
  77. svcudp_freeargs,
  78. svcudp_destroy
  79. };
  80. static int cache_get (SVCXPRT *, struct rpc_msg *, char **replyp,
  81. u_long *replylenp);
  82. static void cache_set (SVCXPRT *xprt, u_long replylen);
  83. /*
  84. * kept in xprt->xp_p2
  85. */
  86. struct svcudp_data
  87. {
  88. u_int su_iosz; /* byte size of send.recv buffer */
  89. u_long su_xid; /* transaction id */
  90. XDR su_xdrs; /* XDR handle */
  91. char su_verfbody[MAX_AUTH_BYTES]; /* verifier body */
  92. char *su_cache; /* cached data, NULL if no cache */
  93. };
  94. #define su_data(xprt) ((struct svcudp_data *)(xprt->xp_p2))
  95. /*
  96. * Usage:
  97. * xprt = svcudp_create(sock);
  98. *
  99. * If sock<0 then a socket is created, else sock is used.
  100. * If the socket, sock is not bound to a port then svcudp_create
  101. * binds it to an arbitrary port. In any (successful) case,
  102. * xprt->xp_sock is the registered socket number and xprt->xp_port is the
  103. * associated port number.
  104. * Once *xprt is initialized, it is registered as a transporter;
  105. * see (svc.h, xprt_register).
  106. * The routines returns NULL if a problem occurred.
  107. */
  108. SVCXPRT attribute_hidden *
  109. __svcudp_bufcreate (int sock, u_int sendsz, u_int recvsz)
  110. {
  111. bool_t madesock = FALSE;
  112. SVCXPRT *xprt;
  113. struct svcudp_data *su;
  114. struct sockaddr_in addr;
  115. socklen_t len = sizeof (struct sockaddr_in);
  116. int pad;
  117. void *buf;
  118. if (sock == RPC_ANYSOCK)
  119. {
  120. if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
  121. {
  122. __perror (_("svcudp_create: socket creation problem"));
  123. return (SVCXPRT *) NULL;
  124. }
  125. madesock = TRUE;
  126. }
  127. __memset ((char *) &addr, 0, sizeof (addr));
  128. addr.sin_family = AF_INET;
  129. if (bindresvport (sock, &addr))
  130. {
  131. addr.sin_port = 0;
  132. (void) bind (sock, (struct sockaddr *) &addr, len);
  133. }
  134. if (getsockname (sock, (struct sockaddr *) &addr, &len) != 0)
  135. {
  136. __perror (_("svcudp_create - cannot getsockname"));
  137. if (madesock)
  138. (void) __close (sock);
  139. return (SVCXPRT *) NULL;
  140. }
  141. xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
  142. su = (struct svcudp_data *) mem_alloc (sizeof (*su));
  143. buf = mem_alloc (((MAX (sendsz, recvsz) + 3) / 4) * 4);
  144. if (xprt == NULL || su == NULL || buf == NULL)
  145. {
  146. #ifdef USE_IN_LIBIO
  147. if (_IO_fwide (stderr, 0) > 0)
  148. (void) __fwprintf (stderr, L"%s", _("svcudp_create: out of memory\n"));
  149. else
  150. #endif
  151. (void) fputs (_("svcudp_create: out of memory\n"), stderr);
  152. mem_free (xprt, sizeof (SVCXPRT));
  153. mem_free (su, sizeof (*su));
  154. mem_free (buf, ((MAX (sendsz, recvsz) + 3) / 4) * 4);
  155. return NULL;
  156. }
  157. su->su_iosz = ((MAX (sendsz, recvsz) + 3) / 4) * 4;
  158. rpc_buffer (xprt) = buf;
  159. xdrmem_create (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz, XDR_DECODE);
  160. su->su_cache = NULL;
  161. xprt->xp_p2 = (caddr_t) su;
  162. xprt->xp_verf.oa_base = su->su_verfbody;
  163. xprt->xp_ops = &svcudp_op;
  164. xprt->xp_port = ntohs (addr.sin_port);
  165. xprt->xp_sock = sock;
  166. #ifdef IP_PKTINFO
  167. if ((sizeof (struct iovec) + sizeof (struct msghdr)
  168. + sizeof(struct cmsghdr) + sizeof (struct in_pktinfo))
  169. > sizeof (xprt->xp_pad))
  170. {
  171. # ifdef USE_IN_LIBIO
  172. if (_IO_fwide (stderr, 0) > 0)
  173. (void) __fwprintf (stderr, L"%s",
  174. _("svcudp_create: xp_pad is too small for IP_PKTINFO\n"));
  175. else
  176. # endif
  177. (void) fputs (_("svcudp_create: xp_pad is too small for IP_PKTINFO\n"),
  178. stderr);
  179. return NULL;
  180. }
  181. pad = 1;
  182. if (setsockopt (sock, SOL_IP, IP_PKTINFO, (void *) &pad,
  183. sizeof (pad)) == 0)
  184. /* Set the padding to all 1s. */
  185. pad = 0xff;
  186. else
  187. #endif
  188. /* Clear the padding. */
  189. pad = 0;
  190. __memset (&xprt->xp_pad [0], pad, sizeof (xprt->xp_pad));
  191. xprt_register (xprt);
  192. return xprt;
  193. }
  194. strong_alias(__svcudp_bufcreate,svcudp_bufcreate)
  195. SVCXPRT attribute_hidden *
  196. __svcudp_create (int sock)
  197. {
  198. return __svcudp_bufcreate (sock, UDPMSGSIZE, UDPMSGSIZE);
  199. }
  200. strong_alias(__svcudp_create,svcudp_create)
  201. static enum xprt_stat
  202. svcudp_stat (xprt)
  203. SVCXPRT *xprt;
  204. {
  205. return XPRT_IDLE;
  206. }
  207. static bool_t
  208. svcudp_recv (xprt, msg)
  209. SVCXPRT *xprt;
  210. struct rpc_msg *msg;
  211. {
  212. struct svcudp_data *su = su_data (xprt);
  213. XDR *xdrs = &(su->su_xdrs);
  214. int rlen;
  215. char *reply;
  216. u_long replylen;
  217. socklen_t len;
  218. /* It is very tricky when you have IP aliases. We want to make sure
  219. that we are sending the packet from the IP address where the
  220. incoming packet is addressed to. H.J. */
  221. #ifdef IP_PKTINFO
  222. struct iovec *iovp;
  223. struct msghdr *mesgp;
  224. #endif
  225. again:
  226. /* FIXME -- should xp_addrlen be a size_t? */
  227. len = (socklen_t) sizeof(struct sockaddr_in);
  228. #ifdef IP_PKTINFO
  229. iovp = (struct iovec *) &xprt->xp_pad [0];
  230. mesgp = (struct msghdr *) &xprt->xp_pad [sizeof (struct iovec)];
  231. if (mesgp->msg_iovlen)
  232. {
  233. iovp->iov_base = rpc_buffer (xprt);
  234. iovp->iov_len = su->su_iosz;
  235. mesgp->msg_iov = iovp;
  236. mesgp->msg_iovlen = 1;
  237. mesgp->msg_name = &(xprt->xp_raddr);
  238. mesgp->msg_namelen = len;
  239. mesgp->msg_control = &xprt->xp_pad [sizeof (struct iovec)
  240. + sizeof (struct msghdr)];
  241. mesgp->msg_controllen = sizeof(xprt->xp_pad)
  242. - sizeof (struct iovec) - sizeof (struct msghdr);
  243. rlen = recvmsg (xprt->xp_sock, mesgp, 0);
  244. if (rlen >= 0)
  245. len = mesgp->msg_namelen;
  246. }
  247. else
  248. #endif
  249. rlen = recvfrom (xprt->xp_sock, rpc_buffer (xprt),
  250. (int) su->su_iosz, 0,
  251. (struct sockaddr *) &(xprt->xp_raddr), &len);
  252. xprt->xp_addrlen = len;
  253. if (rlen == -1 && errno == EINTR)
  254. goto again;
  255. if (rlen < 16) /* < 4 32-bit ints? */
  256. return FALSE;
  257. xdrs->x_op = XDR_DECODE;
  258. XDR_SETPOS (xdrs, 0);
  259. if (!xdr_callmsg (xdrs, msg))
  260. return FALSE;
  261. su->su_xid = msg->rm_xid;
  262. if (su->su_cache != NULL)
  263. {
  264. if (cache_get (xprt, msg, &reply, &replylen))
  265. {
  266. #ifdef IP_PKTINFO
  267. if (mesgp->msg_iovlen)
  268. {
  269. iovp->iov_base = reply;
  270. iovp->iov_len = replylen;
  271. (void) sendmsg (xprt->xp_sock, mesgp, 0);
  272. }
  273. else
  274. #endif
  275. (void) sendto (xprt->xp_sock, reply, (int) replylen, 0,
  276. (struct sockaddr *) &xprt->xp_raddr, len);
  277. return TRUE;
  278. }
  279. }
  280. return TRUE;
  281. }
  282. static bool_t
  283. svcudp_reply (xprt, msg)
  284. SVCXPRT *xprt;
  285. struct rpc_msg *msg;
  286. {
  287. struct svcudp_data *su = su_data (xprt);
  288. XDR *xdrs = &(su->su_xdrs);
  289. int slen, sent;
  290. bool_t stat = FALSE;
  291. #ifdef IP_PKTINFO
  292. struct iovec *iovp;
  293. struct msghdr *mesgp;
  294. #endif
  295. xdrs->x_op = XDR_ENCODE;
  296. XDR_SETPOS (xdrs, 0);
  297. msg->rm_xid = su->su_xid;
  298. if (xdr_replymsg (xdrs, msg))
  299. {
  300. slen = (int) XDR_GETPOS (xdrs);
  301. #ifdef IP_PKTINFO
  302. mesgp = (struct msghdr *) &xprt->xp_pad [sizeof (struct iovec)];
  303. if (mesgp->msg_iovlen)
  304. {
  305. iovp = (struct iovec *) &xprt->xp_pad [0];
  306. iovp->iov_base = rpc_buffer (xprt);
  307. iovp->iov_len = slen;
  308. sent = sendmsg (xprt->xp_sock, mesgp, 0);
  309. }
  310. else
  311. #endif
  312. sent = sendto (xprt->xp_sock, rpc_buffer (xprt), slen, 0,
  313. (struct sockaddr *) &(xprt->xp_raddr),
  314. xprt->xp_addrlen);
  315. if (sent == slen)
  316. {
  317. stat = TRUE;
  318. if (su->su_cache && slen >= 0)
  319. {
  320. cache_set (xprt, (u_long) slen);
  321. }
  322. }
  323. }
  324. return stat;
  325. }
  326. static bool_t
  327. svcudp_getargs (xprt, xdr_args, args_ptr)
  328. SVCXPRT *xprt;
  329. xdrproc_t xdr_args;
  330. caddr_t args_ptr;
  331. {
  332. return (*xdr_args) (&(su_data (xprt)->su_xdrs), args_ptr);
  333. }
  334. static bool_t
  335. svcudp_freeargs (xprt, xdr_args, args_ptr)
  336. SVCXPRT *xprt;
  337. xdrproc_t xdr_args;
  338. caddr_t args_ptr;
  339. {
  340. XDR *xdrs = &(su_data (xprt)->su_xdrs);
  341. xdrs->x_op = XDR_FREE;
  342. return (*xdr_args) (xdrs, args_ptr);
  343. }
  344. static void
  345. svcudp_destroy (xprt)
  346. SVCXPRT *xprt;
  347. {
  348. struct svcudp_data *su = su_data (xprt);
  349. xprt_unregister (xprt);
  350. (void) __close (xprt->xp_sock);
  351. XDR_DESTROY (&(su->su_xdrs));
  352. mem_free (rpc_buffer (xprt), su->su_iosz);
  353. mem_free ((caddr_t) su, sizeof (struct svcudp_data));
  354. mem_free ((caddr_t) xprt, sizeof (SVCXPRT));
  355. }
  356. /***********this could be a separate file*********************/
  357. /*
  358. * Fifo cache for udp server
  359. * Copies pointers to reply buffers into fifo cache
  360. * Buffers are sent again if retransmissions are detected.
  361. */
  362. #define SPARSENESS 4 /* 75% sparse */
  363. #ifdef USE_IN_LIBIO
  364. # define CACHE_PERROR(msg) \
  365. if (_IO_fwide (stderr, 0) > 0) \
  366. (void) __fwprintf(stderr, L"%s\n", msg); \
  367. else \
  368. (void) fprintf(stderr, "%s\n", msg)
  369. #else
  370. # define CACHE_PERROR(msg) \
  371. (void) fprintf(stderr,"%s\n", msg)
  372. #endif
  373. #define ALLOC(type, size) \
  374. (type *) mem_alloc((unsigned) (sizeof(type) * (size)))
  375. #define BZERO(addr, type, size) \
  376. __memset((char *) addr, 0, sizeof(type) * (int) (size))
  377. /*
  378. * An entry in the cache
  379. */
  380. typedef struct cache_node *cache_ptr;
  381. struct cache_node
  382. {
  383. /*
  384. * Index into cache is xid, proc, vers, prog and address
  385. */
  386. u_long cache_xid;
  387. u_long cache_proc;
  388. u_long cache_vers;
  389. u_long cache_prog;
  390. struct sockaddr_in cache_addr;
  391. /*
  392. * The cached reply and length
  393. */
  394. char *cache_reply;
  395. u_long cache_replylen;
  396. /*
  397. * Next node on the list, if there is a collision
  398. */
  399. cache_ptr cache_next;
  400. };
  401. /*
  402. * The entire cache
  403. */
  404. struct udp_cache
  405. {
  406. u_long uc_size; /* size of cache */
  407. cache_ptr *uc_entries; /* hash table of entries in cache */
  408. cache_ptr *uc_fifo; /* fifo list of entries in cache */
  409. u_long uc_nextvictim; /* points to next victim in fifo list */
  410. u_long uc_prog; /* saved program number */
  411. u_long uc_vers; /* saved version number */
  412. u_long uc_proc; /* saved procedure number */
  413. struct sockaddr_in uc_addr; /* saved caller's address */
  414. };
  415. /*
  416. * the hashing function
  417. */
  418. #define CACHE_LOC(transp, xid) \
  419. (xid % (SPARSENESS*((struct udp_cache *) su_data(transp)->su_cache)->uc_size))
  420. /*
  421. * Enable use of the cache.
  422. * Note: there is no disable.
  423. */
  424. int
  425. svcudp_enablecache (SVCXPRT *transp, u_long size)
  426. {
  427. struct svcudp_data *su = su_data (transp);
  428. struct udp_cache *uc;
  429. if (su->su_cache != NULL)
  430. {
  431. CACHE_PERROR (_("enablecache: cache already enabled"));
  432. return 0;
  433. }
  434. uc = ALLOC (struct udp_cache, 1);
  435. if (uc == NULL)
  436. {
  437. CACHE_PERROR (_("enablecache: could not allocate cache"));
  438. return 0;
  439. }
  440. uc->uc_size = size;
  441. uc->uc_nextvictim = 0;
  442. uc->uc_entries = ALLOC (cache_ptr, size * SPARSENESS);
  443. if (uc->uc_entries == NULL)
  444. {
  445. CACHE_PERROR (_("enablecache: could not allocate cache data"));
  446. return 0;
  447. }
  448. BZERO (uc->uc_entries, cache_ptr, size * SPARSENESS);
  449. uc->uc_fifo = ALLOC (cache_ptr, size);
  450. if (uc->uc_fifo == NULL)
  451. {
  452. CACHE_PERROR (_("enablecache: could not allocate cache fifo"));
  453. return 0;
  454. }
  455. BZERO (uc->uc_fifo, cache_ptr, size);
  456. su->su_cache = (char *) uc;
  457. return 1;
  458. }
  459. /*
  460. * Set an entry in the cache
  461. */
  462. static void
  463. cache_set (SVCXPRT *xprt, u_long replylen)
  464. {
  465. cache_ptr victim;
  466. cache_ptr *vicp;
  467. struct svcudp_data *su = su_data (xprt);
  468. struct udp_cache *uc = (struct udp_cache *) su->su_cache;
  469. u_int loc;
  470. char *newbuf;
  471. /*
  472. * Find space for the new entry, either by
  473. * reusing an old entry, or by mallocing a new one
  474. */
  475. victim = uc->uc_fifo[uc->uc_nextvictim];
  476. if (victim != NULL)
  477. {
  478. loc = CACHE_LOC (xprt, victim->cache_xid);
  479. for (vicp = &uc->uc_entries[loc];
  480. *vicp != NULL && *vicp != victim;
  481. vicp = &(*vicp)->cache_next)
  482. ;
  483. if (*vicp == NULL)
  484. {
  485. CACHE_PERROR (_("cache_set: victim not found"));
  486. return;
  487. }
  488. *vicp = victim->cache_next; /* remote from cache */
  489. newbuf = victim->cache_reply;
  490. }
  491. else
  492. {
  493. victim = ALLOC (struct cache_node, 1);
  494. if (victim == NULL)
  495. {
  496. CACHE_PERROR (_("cache_set: victim alloc failed"));
  497. return;
  498. }
  499. newbuf = mem_alloc (su->su_iosz);
  500. if (newbuf == NULL)
  501. {
  502. CACHE_PERROR (_("cache_set: could not allocate new rpc_buffer"));
  503. return;
  504. }
  505. }
  506. /*
  507. * Store it away
  508. */
  509. victim->cache_replylen = replylen;
  510. victim->cache_reply = rpc_buffer (xprt);
  511. rpc_buffer (xprt) = newbuf;
  512. xdrmem_create (&(su->su_xdrs), rpc_buffer (xprt), su->su_iosz, XDR_ENCODE);
  513. victim->cache_xid = su->su_xid;
  514. victim->cache_proc = uc->uc_proc;
  515. victim->cache_vers = uc->uc_vers;
  516. victim->cache_prog = uc->uc_prog;
  517. victim->cache_addr = uc->uc_addr;
  518. loc = CACHE_LOC (xprt, victim->cache_xid);
  519. victim->cache_next = uc->uc_entries[loc];
  520. uc->uc_entries[loc] = victim;
  521. uc->uc_fifo[uc->uc_nextvictim++] = victim;
  522. uc->uc_nextvictim %= uc->uc_size;
  523. }
  524. /*
  525. * Try to get an entry from the cache
  526. * return 1 if found, 0 if not found
  527. */
  528. static int
  529. cache_get (xprt, msg, replyp, replylenp)
  530. SVCXPRT *xprt;
  531. struct rpc_msg *msg;
  532. char **replyp;
  533. u_long *replylenp;
  534. {
  535. u_int loc;
  536. cache_ptr ent;
  537. struct svcudp_data *su = su_data (xprt);
  538. struct udp_cache *uc = (struct udp_cache *) su->su_cache;
  539. #define EQADDR(a1, a2) (__memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
  540. loc = CACHE_LOC (xprt, su->su_xid);
  541. for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next)
  542. {
  543. if (ent->cache_xid == su->su_xid &&
  544. ent->cache_proc == uc->uc_proc &&
  545. ent->cache_vers == uc->uc_vers &&
  546. ent->cache_prog == uc->uc_prog &&
  547. EQADDR (ent->cache_addr, uc->uc_addr))
  548. {
  549. *replyp = ent->cache_reply;
  550. *replylenp = ent->cache_replylen;
  551. return 1;
  552. }
  553. }
  554. /*
  555. * Failed to find entry
  556. * Remember a few things so we can do a set later
  557. */
  558. uc->uc_proc = msg->rm_call.cb_proc;
  559. uc->uc_vers = msg->rm_call.cb_vers;
  560. uc->uc_prog = msg->rm_call.cb_prog;
  561. __memcpy (&uc->uc_addr, &xprt->xp_raddr, sizeof (uc->uc_addr));
  562. return 0;
  563. }