clnt_udp.c 16 KB

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