clnt_udp.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614
  1. /* @(#)clnt_udp.c 2.2 88/08/01 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[] = "@(#)clnt_udp.c 1.39 87/08/11 Copyr 1984 Sun Micro";
  32. #endif
  33. /*
  34. * clnt_udp.c, Implements a UDP/IP based, client side RPC.
  35. *
  36. * Copyright (C) 1984, Sun Microsystems, Inc.
  37. */
  38. /* CMSG_NXTHDR is using it */
  39. #define __cmsg_nxthdr __libc_cmsg_nxthdr
  40. #define authnone_create __authnone_create
  41. #define __FORCE_GLIBC
  42. #include <features.h>
  43. #include <stdio.h>
  44. #include <unistd.h>
  45. #include <rpc/rpc.h>
  46. #include <rpc/xdr.h>
  47. #include <rpc/clnt.h>
  48. #include <sys/poll.h>
  49. #include <sys/socket.h>
  50. #include <sys/ioctl.h>
  51. #include <netdb.h>
  52. #include <errno.h>
  53. #include <rpc/pmap_clnt.h>
  54. #include <net/if.h>
  55. #ifdef USE_IN_LIBIO
  56. # include <wchar.h>
  57. #endif
  58. #ifdef IP_RECVERR
  59. #include "errqueue.h"
  60. #include <sys/uio.h>
  61. #endif
  62. extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
  63. extern u_long _create_xid (void) attribute_hidden;
  64. /*
  65. * UDP bases client side rpc operations
  66. */
  67. static enum clnt_stat clntudp_call (CLIENT *, u_long, xdrproc_t, caddr_t,
  68. xdrproc_t, caddr_t, struct timeval);
  69. static void clntudp_abort (void);
  70. static void clntudp_geterr (CLIENT *, struct rpc_err *);
  71. static bool_t clntudp_freeres (CLIENT *, xdrproc_t, caddr_t);
  72. static bool_t clntudp_control (CLIENT *, int, char *);
  73. static void clntudp_destroy (CLIENT *);
  74. static struct clnt_ops udp_ops =
  75. {
  76. clntudp_call,
  77. clntudp_abort,
  78. clntudp_geterr,
  79. clntudp_freeres,
  80. clntudp_destroy,
  81. clntudp_control
  82. };
  83. /*
  84. * Private data kept per client handle
  85. */
  86. struct cu_data
  87. {
  88. int cu_sock;
  89. bool_t cu_closeit;
  90. struct sockaddr_in cu_raddr;
  91. int cu_rlen;
  92. struct timeval cu_wait;
  93. struct timeval cu_total;
  94. struct rpc_err cu_error;
  95. XDR cu_outxdrs;
  96. u_int cu_xdrpos;
  97. u_int cu_sendsz;
  98. char *cu_outbuf;
  99. u_int cu_recvsz;
  100. char cu_inbuf[1];
  101. };
  102. /*
  103. * Create a UDP based client handle.
  104. * If *sockp<0, *sockp is set to a newly created UPD socket.
  105. * If raddr->sin_port is 0 a binder on the remote machine
  106. * is consulted for the correct port number.
  107. * NB: It is the clients responsibility to close *sockp.
  108. * NB: The rpch->cl_auth is initialized to null authentication.
  109. * Caller may wish to set this something more useful.
  110. *
  111. * wait is the amount of time used between retransmitting a call if
  112. * no response has been heard; retransmission occurs until the actual
  113. * rpc call times out.
  114. *
  115. * sendsz and recvsz are the maximum allowable packet sizes that can be
  116. * sent and received.
  117. */
  118. CLIENT *
  119. clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
  120. struct timeval wait, int *sockp, u_int sendsz,
  121. u_int recvsz)
  122. {
  123. CLIENT *cl;
  124. struct cu_data *cu = NULL;
  125. struct rpc_msg call_msg;
  126. cl = (CLIENT *) mem_alloc (sizeof (CLIENT));
  127. sendsz = ((sendsz + 3) / 4) * 4;
  128. recvsz = ((recvsz + 3) / 4) * 4;
  129. cu = (struct cu_data *) mem_alloc (sizeof (*cu) + sendsz + recvsz);
  130. if (cl == NULL || cu == NULL)
  131. {
  132. struct rpc_createerr *ce = &get_rpc_createerr ();
  133. #ifdef USE_IN_LIBIO
  134. if (_IO_fwide (stderr, 0) > 0)
  135. (void) __fwprintf (stderr, L"%s",
  136. _("clntudp_create: out of memory\n"));
  137. else
  138. #endif
  139. (void) fputs (_("clntudp_create: out of memory\n"), stderr);
  140. ce->cf_stat = RPC_SYSTEMERROR;
  141. ce->cf_error.re_errno = ENOMEM;
  142. goto fooy;
  143. }
  144. cu->cu_outbuf = &cu->cu_inbuf[recvsz];
  145. if (raddr->sin_port == 0)
  146. {
  147. u_short port;
  148. if ((port =
  149. pmap_getport (raddr, program, version, IPPROTO_UDP)) == 0)
  150. {
  151. goto fooy;
  152. }
  153. raddr->sin_port = htons (port);
  154. }
  155. cl->cl_ops = &udp_ops;
  156. cl->cl_private = (caddr_t) cu;
  157. cu->cu_raddr = *raddr;
  158. cu->cu_rlen = sizeof (cu->cu_raddr);
  159. cu->cu_wait = wait;
  160. cu->cu_total.tv_sec = -1;
  161. cu->cu_total.tv_usec = -1;
  162. cu->cu_sendsz = sendsz;
  163. cu->cu_recvsz = recvsz;
  164. call_msg.rm_xid = _create_xid ();
  165. call_msg.rm_direction = CALL;
  166. call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
  167. call_msg.rm_call.cb_prog = program;
  168. call_msg.rm_call.cb_vers = version;
  169. xdrmem_create (&(cu->cu_outxdrs), cu->cu_outbuf,
  170. sendsz, XDR_ENCODE);
  171. if (!xdr_callhdr (&(cu->cu_outxdrs), &call_msg))
  172. {
  173. goto fooy;
  174. }
  175. cu->cu_xdrpos = XDR_GETPOS (&(cu->cu_outxdrs));
  176. if (*sockp < 0)
  177. {
  178. int dontblock = 1;
  179. *sockp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
  180. if (*sockp < 0)
  181. {
  182. struct rpc_createerr *ce = &get_rpc_createerr ();
  183. ce->cf_stat = RPC_SYSTEMERROR;
  184. ce->cf_error.re_errno = errno;
  185. goto fooy;
  186. }
  187. /* attempt to bind to prov port */
  188. (void) bindresvport (*sockp, (struct sockaddr_in *) 0);
  189. /* the sockets rpc controls are non-blocking */
  190. (void) ioctl (*sockp, FIONBIO, (char *) &dontblock);
  191. #ifdef IP_RECVERR
  192. {
  193. int on = 1;
  194. setsockopt(*sockp, SOL_IP, IP_RECVERR, &on, sizeof(on));
  195. }
  196. #endif
  197. cu->cu_closeit = TRUE;
  198. }
  199. else
  200. {
  201. cu->cu_closeit = FALSE;
  202. }
  203. cu->cu_sock = *sockp;
  204. cl->cl_auth = authnone_create ();
  205. return cl;
  206. fooy:
  207. if (cu)
  208. mem_free ((caddr_t) cu, sizeof (*cu) + sendsz + recvsz);
  209. if (cl)
  210. mem_free ((caddr_t) cl, sizeof (CLIENT));
  211. return (CLIENT *) NULL;
  212. }
  213. CLIENT *
  214. clntudp_create (raddr, program, version, wait, sockp)
  215. struct sockaddr_in *raddr;
  216. u_long program;
  217. u_long version;
  218. struct timeval wait;
  219. int *sockp;
  220. {
  221. return clntudp_bufcreate (raddr, program, version, wait, sockp,
  222. UDPMSGSIZE, UDPMSGSIZE);
  223. }
  224. static int
  225. is_network_up (int sock)
  226. {
  227. struct ifconf ifc;
  228. char buf[UDPMSGSIZE];
  229. struct ifreq ifreq, *ifr;
  230. int n;
  231. ifc.ifc_len = sizeof (buf);
  232. ifc.ifc_buf = buf;
  233. if (ioctl(sock, SIOCGIFCONF, (char *) &ifc) == 0)
  234. {
  235. ifr = ifc.ifc_req;
  236. for (n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++)
  237. {
  238. ifreq = *ifr;
  239. if (ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0)
  240. break;
  241. if ((ifreq.ifr_flags & IFF_UP)
  242. && ifr->ifr_addr.sa_family == AF_INET)
  243. return 1;
  244. }
  245. }
  246. return 0;
  247. }
  248. static enum clnt_stat
  249. clntudp_call (cl, proc, xargs, argsp, xresults, resultsp, utimeout)
  250. CLIENT *cl; /* client handle */
  251. u_long proc; /* procedure number */
  252. xdrproc_t xargs; /* xdr routine for args */
  253. caddr_t argsp; /* pointer to args */
  254. xdrproc_t xresults; /* xdr routine for results */
  255. caddr_t resultsp; /* pointer to results */
  256. struct timeval utimeout; /* seconds to wait before giving up */
  257. {
  258. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  259. XDR *xdrs;
  260. int outlen = 0;
  261. int inlen;
  262. socklen_t fromlen;
  263. struct pollfd fd;
  264. int milliseconds = (cu->cu_wait.tv_sec * 1000) +
  265. (cu->cu_wait.tv_usec / 1000);
  266. struct sockaddr_in from;
  267. struct rpc_msg reply_msg;
  268. XDR reply_xdrs;
  269. struct timeval time_waited;
  270. bool_t ok;
  271. int nrefreshes = 2; /* number of times to refresh cred */
  272. struct timeval timeout;
  273. int anyup; /* any network interface up */
  274. if (cu->cu_total.tv_usec == -1)
  275. {
  276. timeout = utimeout; /* use supplied timeout */
  277. }
  278. else
  279. {
  280. timeout = cu->cu_total; /* use default timeout */
  281. }
  282. time_waited.tv_sec = 0;
  283. time_waited.tv_usec = 0;
  284. call_again:
  285. xdrs = &(cu->cu_outxdrs);
  286. if (xargs == NULL)
  287. goto get_reply;
  288. xdrs->x_op = XDR_ENCODE;
  289. XDR_SETPOS (xdrs, cu->cu_xdrpos);
  290. /*
  291. * the transaction is the first thing in the out buffer
  292. */
  293. (*(uint32_t *) (cu->cu_outbuf))++;
  294. if ((!XDR_PUTLONG (xdrs, (long *) &proc)) ||
  295. (!AUTH_MARSHALL (cl->cl_auth, xdrs)) ||
  296. (!(*xargs) (xdrs, argsp)))
  297. return (cu->cu_error.re_status = RPC_CANTENCODEARGS);
  298. outlen = (int) XDR_GETPOS (xdrs);
  299. send_again:
  300. if (sendto (cu->cu_sock, cu->cu_outbuf, outlen, 0,
  301. (struct sockaddr *) &(cu->cu_raddr), cu->cu_rlen)
  302. != outlen)
  303. {
  304. cu->cu_error.re_errno = errno;
  305. return (cu->cu_error.re_status = RPC_CANTSEND);
  306. }
  307. /*
  308. * Hack to provide rpc-based message passing
  309. */
  310. if (timeout.tv_sec == 0 && timeout.tv_usec == 0)
  311. {
  312. return (cu->cu_error.re_status = RPC_TIMEDOUT);
  313. }
  314. get_reply:
  315. /*
  316. * sub-optimal code appears here because we have
  317. * some clock time to spare while the packets are in flight.
  318. * (We assume that this is actually only executed once.)
  319. */
  320. reply_msg.acpted_rply.ar_verf = _null_auth;
  321. reply_msg.acpted_rply.ar_results.where = resultsp;
  322. reply_msg.acpted_rply.ar_results.proc = xresults;
  323. fd.fd = cu->cu_sock;
  324. fd.events = POLLIN;
  325. anyup = 0;
  326. for (;;)
  327. {
  328. switch (poll (&fd, 1, milliseconds))
  329. {
  330. case 0:
  331. if (anyup == 0)
  332. {
  333. anyup = is_network_up (cu->cu_sock);
  334. if (!anyup)
  335. return (cu->cu_error.re_status = RPC_CANTRECV);
  336. }
  337. time_waited.tv_sec += cu->cu_wait.tv_sec;
  338. time_waited.tv_usec += cu->cu_wait.tv_usec;
  339. while (time_waited.tv_usec >= 1000000)
  340. {
  341. time_waited.tv_sec++;
  342. time_waited.tv_usec -= 1000000;
  343. }
  344. if ((time_waited.tv_sec < timeout.tv_sec) ||
  345. ((time_waited.tv_sec == timeout.tv_sec) &&
  346. (time_waited.tv_usec < timeout.tv_usec)))
  347. goto send_again;
  348. return (cu->cu_error.re_status = RPC_TIMEDOUT);
  349. /*
  350. * buggy in other cases because time_waited is not being
  351. * updated.
  352. */
  353. case -1:
  354. if (errno == EINTR)
  355. continue;
  356. cu->cu_error.re_errno = errno;
  357. return (cu->cu_error.re_status = RPC_CANTRECV);
  358. }
  359. #ifdef IP_RECVERR
  360. if (fd.revents & POLLERR)
  361. {
  362. struct msghdr msg;
  363. struct cmsghdr *cmsg;
  364. struct sock_extended_err *e;
  365. struct sockaddr_in err_addr;
  366. struct iovec iov;
  367. char *cbuf = (char *) alloca (outlen + 256);
  368. int ret;
  369. iov.iov_base = cbuf + 256;
  370. iov.iov_len = outlen;
  371. msg.msg_name = (void *) &err_addr;
  372. msg.msg_namelen = sizeof (err_addr);
  373. msg.msg_iov = &iov;
  374. msg.msg_iovlen = 1;
  375. msg.msg_flags = 0;
  376. msg.msg_control = cbuf;
  377. msg.msg_controllen = 256;
  378. ret = recvmsg (cu->cu_sock, &msg, MSG_ERRQUEUE);
  379. if (ret >= 0
  380. && memcmp (cbuf + 256, cu->cu_outbuf, ret) == 0
  381. && (msg.msg_flags & MSG_ERRQUEUE)
  382. && ((msg.msg_namelen == 0
  383. && ret >= 12)
  384. || (msg.msg_namelen == sizeof (err_addr)
  385. && err_addr.sin_family == AF_INET
  386. && memcmp (&err_addr.sin_addr, &cu->cu_raddr.sin_addr,
  387. sizeof (err_addr.sin_addr)) == 0
  388. && err_addr.sin_port == cu->cu_raddr.sin_port)))
  389. for (cmsg = CMSG_FIRSTHDR (&msg); cmsg;
  390. cmsg = CMSG_NXTHDR (&msg, cmsg))
  391. if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
  392. {
  393. e = (struct sock_extended_err *) CMSG_DATA(cmsg);
  394. cu->cu_error.re_errno = e->ee_errno;
  395. return (cu->cu_error.re_status = RPC_CANTRECV);
  396. }
  397. }
  398. #endif
  399. do
  400. {
  401. fromlen = sizeof (struct sockaddr);
  402. inlen = recvfrom (cu->cu_sock, cu->cu_inbuf,
  403. (int) cu->cu_recvsz, 0,
  404. (struct sockaddr *) &from, &fromlen);
  405. }
  406. while (inlen < 0 && errno == EINTR);
  407. if (inlen < 0)
  408. {
  409. if (errno == EWOULDBLOCK)
  410. continue;
  411. cu->cu_error.re_errno = errno;
  412. return (cu->cu_error.re_status = RPC_CANTRECV);
  413. }
  414. if (inlen < 4)
  415. continue;
  416. /* see if reply transaction id matches sent id.
  417. Don't do this if we only wait for a replay */
  418. if (xargs != NULL
  419. && (*((u_int32_t *) (cu->cu_inbuf))
  420. != *((u_int32_t *) (cu->cu_outbuf))))
  421. continue;
  422. /* we now assume we have the proper reply */
  423. break;
  424. }
  425. /*
  426. * now decode and validate the response
  427. */
  428. xdrmem_create (&reply_xdrs, cu->cu_inbuf, (u_int) inlen, XDR_DECODE);
  429. ok = xdr_replymsg (&reply_xdrs, &reply_msg);
  430. /* XDR_DESTROY(&reply_xdrs); save a few cycles on noop destroy */
  431. if (ok)
  432. {
  433. _seterr_reply (&reply_msg, &(cu->cu_error));
  434. if (cu->cu_error.re_status == RPC_SUCCESS)
  435. {
  436. if (!AUTH_VALIDATE (cl->cl_auth,
  437. &reply_msg.acpted_rply.ar_verf))
  438. {
  439. cu->cu_error.re_status = RPC_AUTHERROR;
  440. cu->cu_error.re_why = AUTH_INVALIDRESP;
  441. }
  442. if (reply_msg.acpted_rply.ar_verf.oa_base != NULL)
  443. {
  444. xdrs->x_op = XDR_FREE;
  445. (void) xdr_opaque_auth (xdrs,
  446. &(reply_msg.acpted_rply.ar_verf));
  447. }
  448. } /* end successful completion */
  449. else
  450. {
  451. /* maybe our credentials need to be refreshed ... */
  452. if (nrefreshes > 0 && AUTH_REFRESH (cl->cl_auth))
  453. {
  454. nrefreshes--;
  455. goto call_again;
  456. }
  457. } /* end of unsuccessful completion */
  458. } /* end of valid reply message */
  459. else
  460. {
  461. cu->cu_error.re_status = RPC_CANTDECODERES;
  462. }
  463. return cu->cu_error.re_status;
  464. }
  465. static void
  466. clntudp_geterr (CLIENT *cl, struct rpc_err *errp)
  467. {
  468. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  469. *errp = cu->cu_error;
  470. }
  471. static bool_t
  472. clntudp_freeres (CLIENT *cl, xdrproc_t xdr_res, caddr_t res_ptr)
  473. {
  474. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  475. XDR *xdrs = &(cu->cu_outxdrs);
  476. xdrs->x_op = XDR_FREE;
  477. return (*xdr_res) (xdrs, res_ptr);
  478. }
  479. static void
  480. clntudp_abort (void)
  481. {
  482. }
  483. static bool_t
  484. clntudp_control (CLIENT *cl, int request, char *info)
  485. {
  486. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  487. switch (request)
  488. {
  489. case CLSET_FD_CLOSE:
  490. cu->cu_closeit = TRUE;
  491. break;
  492. case CLSET_FD_NCLOSE:
  493. cu->cu_closeit = FALSE;
  494. break;
  495. case CLSET_TIMEOUT:
  496. cu->cu_total = *(struct timeval *) info;
  497. break;
  498. case CLGET_TIMEOUT:
  499. *(struct timeval *) info = cu->cu_total;
  500. break;
  501. case CLSET_RETRY_TIMEOUT:
  502. cu->cu_wait = *(struct timeval *) info;
  503. break;
  504. case CLGET_RETRY_TIMEOUT:
  505. *(struct timeval *) info = cu->cu_wait;
  506. break;
  507. case CLGET_SERVER_ADDR:
  508. *(struct sockaddr_in *) info = cu->cu_raddr;
  509. break;
  510. case CLGET_FD:
  511. *(int *)info = cu->cu_sock;
  512. break;
  513. case CLGET_XID:
  514. /*
  515. * use the knowledge that xid is the
  516. * first element in the call structure *.
  517. * This will get the xid of the PREVIOUS call
  518. */
  519. *(u_long *)info = ntohl(*(u_long *)cu->cu_outbuf);
  520. break;
  521. case CLSET_XID:
  522. /* This will set the xid of the NEXT call */
  523. *(u_long *)cu->cu_outbuf = htonl(*(u_long *)info - 1);
  524. /* decrement by 1 as clntudp_call() increments once */
  525. case CLGET_VERS:
  526. /*
  527. * This RELIES on the information that, in the call body,
  528. * the version number field is the fifth field from the
  529. * begining of the RPC header. MUST be changed if the
  530. * call_struct is changed
  531. */
  532. *(u_long *)info = ntohl(*(u_long *)(cu->cu_outbuf +
  533. 4 * BYTES_PER_XDR_UNIT));
  534. break;
  535. case CLSET_VERS:
  536. *(u_long *)(cu->cu_outbuf + 4 * BYTES_PER_XDR_UNIT)
  537. = htonl(*(u_long *)info);
  538. break;
  539. case CLGET_PROG:
  540. /*
  541. * This RELIES on the information that, in the call body,
  542. * the program number field is the field from the
  543. * begining of the RPC header. MUST be changed if the
  544. * call_struct is changed
  545. */
  546. *(u_long *)info = ntohl(*(u_long *)(cu->cu_outbuf +
  547. 3 * BYTES_PER_XDR_UNIT));
  548. break;
  549. case CLSET_PROG:
  550. *(u_long *)(cu->cu_outbuf + 3 * BYTES_PER_XDR_UNIT)
  551. = htonl(*(u_long *)info);
  552. break;
  553. /* The following are only possible with TI-RPC */
  554. case CLGET_SVC_ADDR:
  555. case CLSET_SVC_ADDR:
  556. case CLSET_PUSH_TIMOD:
  557. case CLSET_POP_TIMOD:
  558. default:
  559. return FALSE;
  560. }
  561. return TRUE;
  562. }
  563. static void
  564. clntudp_destroy (CLIENT *cl)
  565. {
  566. struct cu_data *cu = (struct cu_data *) cl->cl_private;
  567. if (cu->cu_closeit)
  568. {
  569. (void) close (cu->cu_sock);
  570. }
  571. XDR_DESTROY (&(cu->cu_outxdrs));
  572. mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));
  573. mem_free ((caddr_t) cl, sizeof (CLIENT));
  574. }