clnt_udp.c 16 KB

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