1 /* $NetBSD: clnt_dg.c,v 1.4 2000/07/14 08:40:41 fvdl Exp $ */
4 * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
5 * unrestricted use provided that this legend is included on all tape
6 * media and as a part of the software program in whole or part. Users
7 * may copy or modify Sun RPC without charge, but are not authorized
8 * to license or distribute it to anyone else except as part of a product or
9 * program developed by the user.
11 * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
12 * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
13 * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
15 * Sun RPC is provided with no support and without any obligation on the
16 * part of Sun Microsystems, Inc. to assist in its use, correction,
17 * modification or enhancement.
19 * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
20 * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
21 * OR ANY PART THEREOF.
23 * In no event will Sun Microsystems, Inc. be liable for any lost revenue
24 * or profits or other special, indirect and consequential damages, even if
25 * Sun has been advised of the possibility of such damages.
27 * Sun Microsystems, Inc.
29 * Mountain View, California 94043
32 * Copyright (c) 1986-1991 by Sun Microsystems Inc.
35 #if defined(LIBC_SCCS) && !defined(lint)
36 #ident "@(#)clnt_dg.c 1.23 94/04/22 SMI"
37 static char sccsid[] = "@(#)clnt_dg.c 1.19 89/03/16 Copyr 1988 Sun Micro";
39 #include <sys/cdefs.h>
40 __FBSDID("$FreeBSD$");
43 * Implements a connectionless client side RPC.
46 #include <sys/param.h>
47 #include <sys/systm.h>
49 #include <sys/malloc.h>
51 #include <sys/mutex.h>
54 #include <sys/socket.h>
55 #include <sys/socketvar.h>
60 #include <rpc/rpc_com.h>
63 #ifdef _FREEFALL_CONFIG
65 * Disable RPC exponential back-off for FreeBSD.org systems.
67 #define RPC_MAX_BACKOFF 1 /* second */
69 #define RPC_MAX_BACKOFF 30 /* seconds */
72 static bool_t time_not_ok(struct timeval *);
73 static enum clnt_stat clnt_dg_call(CLIENT *, rpcproc_t, xdrproc_t, void *,
74 xdrproc_t, void *, struct timeval);
75 static void clnt_dg_geterr(CLIENT *, struct rpc_err *);
76 static bool_t clnt_dg_freeres(CLIENT *, xdrproc_t, void *);
77 static void clnt_dg_abort(CLIENT *);
78 static bool_t clnt_dg_control(CLIENT *, u_int, void *);
79 static void clnt_dg_destroy(CLIENT *);
80 static void clnt_dg_soupcall(struct socket *so, void *arg, int waitflag);
82 static struct clnt_ops clnt_dg_ops = {
83 .cl_call = clnt_dg_call,
84 .cl_abort = clnt_dg_abort,
85 .cl_geterr = clnt_dg_geterr,
86 .cl_freeres = clnt_dg_freeres,
87 .cl_destroy = clnt_dg_destroy,
88 .cl_control = clnt_dg_control
91 static const char mem_err_clnt_dg[] = "clnt_dg_create: out of memory";
94 * A pending RPC request which awaits a reply.
97 TAILQ_ENTRY(cu_request) cr_link;
98 uint32_t cr_xid; /* XID of request */
99 struct mbuf *cr_mrep; /* reply received by upcall */
100 int cr_error; /* any error from upcall */
103 TAILQ_HEAD(cu_request_list, cu_request);
105 #define MCALL_MSG_SIZE 24
108 * This structure is pointed to by the socket's so_upcallarg
109 * member. It is separate from the client private data to facilitate
110 * multiple clients sharing the same socket. The cs_lock mutex is used
111 * to protect all fields of this structure, the socket's receive
112 * buffer SOCKBUF_LOCK is used to ensure that exactly one of these
113 * structures is installed on the socket.
117 int cs_refs; /* Count of clients */
118 struct cu_request_list cs_pending; /* Requests awaiting replies */
123 * Private data kept per client handle
126 struct socket *cu_socket; /* connection socket */
127 bool_t cu_closeit; /* opened by library */
128 struct sockaddr_storage cu_raddr; /* remote address */
130 struct timeval cu_wait; /* retransmit interval */
131 struct timeval cu_total; /* total time for the call */
132 struct rpc_err cu_error;
134 char cu_mcallc[MCALL_MSG_SIZE]; /* marshalled callmsg */
136 size_t cu_sendsz; /* send size */
137 size_t cu_recvsz; /* recv size */
139 int cu_connect; /* Use connect(). */
140 int cu_connected; /* Have done connect(). */
141 const char *cu_waitchan;
146 * Connection less client creation returns with client handle parameters.
147 * Default options are set, which the user can change using clnt_control().
148 * fd should be open and bound.
149 * NB: The rpch->cl_auth is initialized to null authentication.
150 * Caller may wish to set this something more useful.
152 * sendsz and recvsz are the maximum allowable packet sizes that can be
153 * sent and received. Normally they are the same, but they can be
154 * changed to improve the program efficiency and buffer allocation.
155 * If they are 0, use the transport default.
157 * If svcaddr is NULL, returns NULL.
162 struct sockaddr *svcaddr, /* servers address */
163 rpcprog_t program, /* program number */
164 rpcvers_t version, /* version number */
165 size_t sendsz, /* buffer recv size */
166 size_t recvsz) /* buffer send size */
168 CLIENT *cl = NULL; /* client handle */
169 struct cu_data *cu = NULL; /* private data */
170 struct cu_socket *cs = NULL;
172 struct rpc_msg call_msg;
173 struct __rpc_sockinfo si;
176 if (svcaddr == NULL) {
177 rpc_createerr.cf_stat = RPC_UNKNOWNADDR;
181 if (!__rpc_socket2sockinfo(so, &si)) {
182 rpc_createerr.cf_stat = RPC_TLIERROR;
183 rpc_createerr.cf_error.re_errno = 0;
188 * Find the receive and the send size
190 sendsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)sendsz);
191 recvsz = __rpc_get_t_size(si.si_af, si.si_proto, (int)recvsz);
192 if ((sendsz == 0) || (recvsz == 0)) {
193 rpc_createerr.cf_stat = RPC_TLIERROR; /* XXX */
194 rpc_createerr.cf_error.re_errno = 0;
198 cl = mem_alloc(sizeof (CLIENT));
201 * Should be multiple of 4 for XDR.
203 sendsz = ((sendsz + 3) / 4) * 4;
204 recvsz = ((recvsz + 3) / 4) * 4;
205 cu = mem_alloc(sizeof (*cu));
206 (void) memcpy(&cu->cu_raddr, svcaddr, (size_t)svcaddr->sa_len);
207 cu->cu_rlen = svcaddr->sa_len;
208 /* Other values can also be set through clnt_control() */
209 cu->cu_wait.tv_sec = 15; /* heuristically chosen */
210 cu->cu_wait.tv_usec = 0;
211 cu->cu_total.tv_sec = -1;
212 cu->cu_total.tv_usec = -1;
213 cu->cu_sendsz = sendsz;
214 cu->cu_recvsz = recvsz;
215 cu->cu_async = FALSE;
216 cu->cu_connect = FALSE;
217 cu->cu_connected = FALSE;
218 cu->cu_waitchan = "rpcrecv";
220 (void) getmicrotime(&now);
221 cu->cu_xid = __RPC_GETXID(&now);
222 call_msg.rm_xid = cu->cu_xid;
223 call_msg.rm_call.cb_prog = program;
224 call_msg.rm_call.cb_vers = version;
225 xdrmem_create(&xdrs, cu->cu_mcallc, MCALL_MSG_SIZE, XDR_ENCODE);
226 if (! xdr_callhdr(&xdrs, &call_msg)) {
227 rpc_createerr.cf_stat = RPC_CANTENCODEARGS; /* XXX */
228 rpc_createerr.cf_error.re_errno = 0;
231 cu->cu_mcalllen = XDR_GETPOS(&xdrs);;
234 * By default, closeit is always FALSE. It is users responsibility
235 * to do a close on it, else the user may use clnt_control
236 * to let clnt_destroy do it for him/her.
238 cu->cu_closeit = FALSE;
241 SOCKBUF_LOCK(&so->so_rcv);
244 if (so->so_upcall != clnt_dg_soupcall) {
245 SOCKBUF_UNLOCK(&so->so_rcv);
246 printf("clnt_dg_create(): socket already has an incompatible upcall\n");
249 cs = (struct cu_socket *) so->so_upcallarg;
250 mtx_lock(&cs->cs_lock);
252 mtx_unlock(&cs->cs_lock);
255 * We are the first on this socket - allocate the
256 * structure and install it in the socket.
258 SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
259 cs = mem_alloc(sizeof(*cs));
260 SOCKBUF_LOCK(&cu->cu_socket->so_rcv);
263 * We have lost a race with some other client.
265 mem_free(cs, sizeof(*cs));
268 mtx_init(&cs->cs_lock, "cs->cs_lock", NULL, MTX_DEF);
270 TAILQ_INIT(&cs->cs_pending);
271 so->so_upcallarg = cs;
272 so->so_upcall = clnt_dg_soupcall;
273 so->so_rcv.sb_flags |= SB_UPCALL;
275 SOCKBUF_UNLOCK(&so->so_rcv);
277 cl->cl_ops = &clnt_dg_ops;
278 cl->cl_private = (caddr_t)(void *)cu;
279 cl->cl_auth = authnone_create();
285 mem_free(cl, sizeof (CLIENT));
287 mem_free(cu, sizeof (*cu));
292 static enum clnt_stat
294 CLIENT *cl, /* client handle */
295 rpcproc_t proc, /* procedure number */
296 xdrproc_t xargs, /* xdr routine for args */
297 void *argsp, /* pointer to args */
298 xdrproc_t xresults, /* xdr routine for results */
299 void *resultsp, /* pointer to results */
300 struct timeval utimeout) /* seconds to wait before giving up */
302 struct cu_data *cu = (struct cu_data *)cl->cl_private;
303 struct cu_socket *cs = (struct cu_socket *) cu->cu_socket->so_upcallarg;
305 struct rpc_msg reply_msg;
307 int nrefreshes = 2; /* number of times to refresh cred */
308 struct timeval timeout;
309 struct timeval retransmit_time;
310 struct timeval next_sendtime, starttime, time_waited, tv;
314 struct mbuf *mreq = NULL;
315 struct cu_request cr;
318 mtx_lock(&cs->cs_lock);
323 if (cu->cu_total.tv_usec == -1) {
324 timeout = utimeout; /* use supplied timeout */
326 timeout = cu->cu_total; /* use default timeout */
329 if (cu->cu_connect && !cu->cu_connected) {
330 mtx_unlock(&cs->cs_lock);
331 error = soconnect(cu->cu_socket,
332 (struct sockaddr *)&cu->cu_raddr, curthread);
333 mtx_lock(&cs->cs_lock);
335 cu->cu_error.re_errno = error;
336 cu->cu_error.re_status = RPC_CANTSEND;
339 cu->cu_connected = 1;
341 if (cu->cu_connected) {
345 sa = (struct sockaddr *)&cu->cu_raddr;
348 time_waited.tv_sec = 0;
349 time_waited.tv_usec = 0;
350 retransmit_time = next_sendtime = cu->cu_wait;
352 getmicrotime(&starttime);
355 mtx_assert(&cs->cs_lock, MA_OWNED);
361 mtx_unlock(&cs->cs_lock);
363 MGETHDR(mreq, M_WAIT, MT_DATA);
364 MCLGET(mreq, M_WAIT);
366 m_append(mreq, cu->cu_mcalllen, cu->cu_mcallc);
369 * The XID is the first thing in the request.
371 *mtod(mreq, uint32_t *) = htonl(xid);
373 xdrmbuf_create(&xdrs, mreq, XDR_ENCODE);
375 if (cu->cu_async == TRUE && xargs == NULL)
378 if ((! XDR_PUTINT32(&xdrs, &proc)) ||
379 (! AUTH_MARSHALL(cl->cl_auth, &xdrs)) ||
380 (! (*xargs)(&xdrs, argsp))) {
381 cu->cu_error.re_status = RPC_CANTENCODEARGS;
382 mtx_lock(&cs->cs_lock);
388 mtx_lock(&cs->cs_lock);
389 TAILQ_INSERT_TAIL(&cs->cs_pending, &cr, cr_link);
390 mtx_unlock(&cs->cs_lock);
393 * sosend consumes mreq.
395 error = sosend(cu->cu_socket, sa, NULL, mreq, NULL, 0, curthread);
399 * sub-optimal code appears here because we have
400 * some clock time to spare while the packets are in flight.
401 * (We assume that this is actually only executed once.)
403 reply_msg.acpted_rply.ar_verf = _null_auth;
404 reply_msg.acpted_rply.ar_results.where = resultsp;
405 reply_msg.acpted_rply.ar_results.proc = xresults;
407 mtx_lock(&cs->cs_lock);
409 TAILQ_REMOVE(&cs->cs_pending, &cr, cr_link);
411 cu->cu_error.re_errno = error;
412 cu->cu_error.re_status = RPC_CANTSEND;
417 * Check to see if we got an upcall while waiting for the
418 * lock. In both these cases, the request has been removed
419 * from cs->cs_pending.
422 cu->cu_error.re_errno = cr.cr_error;
423 cu->cu_error.re_status = RPC_CANTRECV;
431 * Hack to provide rpc-based message passing
433 if (timeout.tv_sec == 0 && timeout.tv_usec == 0) {
435 TAILQ_REMOVE(&cs->cs_pending, &cr, cr_link);
436 cu->cu_error.re_status = RPC_TIMEDOUT;
442 /* Decide how long to wait. */
443 if (timevalcmp(&next_sendtime, &timeout, <)) {
448 timevalsub(&tv, &time_waited);
449 if (tv.tv_sec < 0 || tv.tv_usec < 0)
450 tv.tv_sec = tv.tv_usec = 0;
452 error = msleep(&cr, &cs->cs_lock, cu->cu_waitflag,
453 cu->cu_waitchan, tvtohz(&tv));
457 * We were woken up by the upcall. If the
458 * upcall had a receive error, report that,
459 * otherwise we have a reply.
462 cu->cu_error.re_errno = cr.cr_error;
463 cu->cu_error.re_status = RPC_CANTRECV;
470 * The sleep returned an error so our request is still
471 * on the list. If we got EWOULDBLOCK, we may want to
472 * re-send the request.
474 if (error != EWOULDBLOCK) {
476 TAILQ_REMOVE(&cs->cs_pending, &cr, cr_link);
477 cu->cu_error.re_errno = error;
479 cu->cu_error.re_status = RPC_INTR;
481 cu->cu_error.re_status = RPC_CANTRECV;
487 timevalsub(&time_waited, &starttime);
489 /* Check for timeout. */
490 if (timevalcmp(&time_waited, &timeout, >)) {
492 TAILQ_REMOVE(&cs->cs_pending, &cr, cr_link);
493 cu->cu_error.re_errno = EWOULDBLOCK;
494 cu->cu_error.re_status = RPC_TIMEDOUT;
498 /* Retransmit if necessary. */
499 if (timevalcmp(&time_waited, &next_sendtime, >)) {
501 TAILQ_REMOVE(&cs->cs_pending, &cr, cr_link);
502 /* update retransmit_time */
503 if (retransmit_time.tv_sec < RPC_MAX_BACKOFF)
504 timevaladd(&retransmit_time, &retransmit_time);
505 timevaladd(&next_sendtime, &retransmit_time);
512 * Now decode and validate the response. We need to drop the
513 * lock since xdr_replymsg may end up sleeping in malloc.
515 mtx_unlock(&cs->cs_lock);
517 xdrmbuf_create(&xdrs, cr.cr_mrep, XDR_DECODE);
518 ok = xdr_replymsg(&xdrs, &reply_msg);
522 mtx_lock(&cs->cs_lock);
525 if ((reply_msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
526 (reply_msg.acpted_rply.ar_stat == SUCCESS))
527 cu->cu_error.re_status = RPC_SUCCESS;
529 _seterr_reply(&reply_msg, &(cu->cu_error));
531 if (cu->cu_error.re_status == RPC_SUCCESS) {
532 if (! AUTH_VALIDATE(cl->cl_auth,
533 &reply_msg.acpted_rply.ar_verf)) {
534 cu->cu_error.re_status = RPC_AUTHERROR;
535 cu->cu_error.re_why = AUTH_INVALIDRESP;
537 if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) {
538 xdrs.x_op = XDR_FREE;
539 (void) xdr_opaque_auth(&xdrs,
540 &(reply_msg.acpted_rply.ar_verf));
542 } /* end successful completion */
544 * If unsuccesful AND error is an authentication error
545 * then refresh credentials and try again, else break
547 else if (cu->cu_error.re_status == RPC_AUTHERROR)
548 /* maybe our credentials need to be refreshed ... */
549 if (nrefreshes > 0 &&
550 AUTH_REFRESH(cl->cl_auth, &reply_msg)) {
554 /* end of unsuccessful completion */
555 } /* end of valid reply message */
557 cu->cu_error.re_status = RPC_CANTDECODERES;
561 mtx_assert(&cs->cs_lock, MA_OWNED);
568 mtx_unlock(&cs->cs_lock);
569 return (cu->cu_error.re_status);
573 clnt_dg_geterr(CLIENT *cl, struct rpc_err *errp)
575 struct cu_data *cu = (struct cu_data *)cl->cl_private;
577 *errp = cu->cu_error;
581 clnt_dg_freeres(CLIENT *cl, xdrproc_t xdr_res, void *res_ptr)
586 xdrs.x_op = XDR_FREE;
587 dummy = (*xdr_res)(&xdrs, res_ptr);
594 clnt_dg_abort(CLIENT *h)
599 clnt_dg_control(CLIENT *cl, u_int request, void *info)
601 struct cu_data *cu = (struct cu_data *)cl->cl_private;
602 struct cu_socket *cs = (struct cu_socket *) cu->cu_socket->so_upcallarg;
603 struct sockaddr *addr;
605 mtx_lock(&cs->cs_lock);
609 cu->cu_closeit = TRUE;
610 mtx_unlock(&cs->cs_lock);
612 case CLSET_FD_NCLOSE:
613 cu->cu_closeit = FALSE;
614 mtx_unlock(&cs->cs_lock);
618 /* for other requests which use info */
620 mtx_unlock(&cs->cs_lock);
625 if (time_not_ok((struct timeval *)info)) {
626 mtx_unlock(&cs->cs_lock);
629 cu->cu_total = *(struct timeval *)info;
632 *(struct timeval *)info = cu->cu_total;
634 case CLSET_RETRY_TIMEOUT:
635 if (time_not_ok((struct timeval *)info)) {
636 mtx_unlock(&cs->cs_lock);
639 cu->cu_wait = *(struct timeval *)info;
641 case CLGET_RETRY_TIMEOUT:
642 *(struct timeval *)info = cu->cu_wait;
646 * Slightly different semantics to userland - we use
647 * sockaddr instead of netbuf.
649 memcpy(info, &cu->cu_raddr, cu->cu_raddr.ss_len);
651 case CLSET_SVC_ADDR: /* set to new address */
652 addr = (struct sockaddr *)info;
653 (void) memcpy(&cu->cu_raddr, addr, addr->sa_len);
656 *(uint32_t *)info = cu->cu_xid;
660 /* This will set the xid of the NEXT call */
661 /* decrement by 1 as clnt_dg_call() increments once */
662 cu->cu_xid = *(uint32_t *)info - 1;
667 * This RELIES on the information that, in the call body,
668 * the version number field is the fifth field from the
669 * begining of the RPC header. MUST be changed if the
670 * call_struct is changed
673 ntohl(*(uint32_t *)(void *)(cu->cu_mcallc +
674 4 * BYTES_PER_XDR_UNIT));
678 *(uint32_t *)(void *)(cu->cu_mcallc + 4 * BYTES_PER_XDR_UNIT)
679 = htonl(*(uint32_t *)info);
684 * This RELIES on the information that, in the call body,
685 * the program number field is the fourth field from the
686 * begining of the RPC header. MUST be changed if the
687 * call_struct is changed
690 ntohl(*(uint32_t *)(void *)(cu->cu_mcallc +
691 3 * BYTES_PER_XDR_UNIT));
695 *(uint32_t *)(void *)(cu->cu_mcallc + 3 * BYTES_PER_XDR_UNIT)
696 = htonl(*(uint32_t *)info);
699 cu->cu_async = *(int *)info;
702 cu->cu_connect = *(int *)info;
705 cu->cu_waitchan = *(const char **)info;
708 *(const char **) info = cu->cu_waitchan;
710 case CLSET_INTERRUPTIBLE:
712 cu->cu_waitflag = PCATCH;
716 case CLGET_INTERRUPTIBLE:
718 *(int *) info = TRUE;
720 *(int *) info = FALSE;
723 mtx_unlock(&cs->cs_lock);
726 mtx_unlock(&cs->cs_lock);
731 clnt_dg_destroy(CLIENT *cl)
733 struct cu_data *cu = (struct cu_data *)cl->cl_private;
734 struct cu_socket *cs = (struct cu_socket *) cu->cu_socket->so_upcallarg;
735 struct socket *so = NULL;
736 bool_t lastsocketref;
738 SOCKBUF_LOCK(&cu->cu_socket->so_rcv);
740 mtx_lock(&cs->cs_lock);
742 if (cs->cs_refs == 0) {
743 cu->cu_socket->so_upcallarg = NULL;
744 cu->cu_socket->so_upcall = NULL;
745 cu->cu_socket->so_rcv.sb_flags &= ~SB_UPCALL;
746 mtx_destroy(&cs->cs_lock);
747 SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
748 mem_free(cs, sizeof(*cs));
749 lastsocketref = TRUE;
751 mtx_unlock(&cs->cs_lock);
752 SOCKBUF_UNLOCK(&cu->cu_socket->so_rcv);
753 lastsocketref = FALSE;
756 if (cu->cu_closeit) {
757 KASSERT(lastsocketref, ("clnt_dg_destroy(): closing a socket "
758 "shared with other clients"));
760 cu->cu_socket = NULL;
766 if (cl->cl_netid && cl->cl_netid[0])
767 mem_free(cl->cl_netid, strlen(cl->cl_netid) +1);
768 if (cl->cl_tp && cl->cl_tp[0])
769 mem_free(cl->cl_tp, strlen(cl->cl_tp) +1);
770 mem_free(cu, sizeof (*cu));
771 mem_free(cl, sizeof (CLIENT));
775 * Make sure that the time is not garbage. -1 value is allowed.
778 time_not_ok(struct timeval *t)
780 return (t->tv_sec < -1 || t->tv_sec > 100000000 ||
781 t->tv_usec < -1 || t->tv_usec > 1000000);
785 clnt_dg_soupcall(struct socket *so, void *arg, int waitflag)
787 struct cu_socket *cs = (struct cu_socket *) arg;
790 struct mbuf *control;
791 struct cu_request *cr;
792 int error, rcvflag, foundreq;
795 uio.uio_resid = 1000000000;
796 uio.uio_td = curthread;
800 rcvflag = MSG_DONTWAIT;
801 error = soreceive(so, NULL, &uio, &m, &control, &rcvflag);
805 if (error == EWOULDBLOCK)
809 * If there was an error, wake up all pending
813 mtx_lock(&cs->cs_lock);
814 TAILQ_FOREACH(cr, &cs->cs_pending, cr_link) {
815 cr->cr_error = error;
818 TAILQ_INIT(&cs->cs_pending);
819 mtx_unlock(&cs->cs_lock);
824 * The XID is in the first uint32_t of the reply.
826 m = m_pullup(m, sizeof(xid));
829 xid = ntohl(*mtod(m, uint32_t *));
832 * Attempt to match this reply with a pending request.
834 mtx_lock(&cs->cs_lock);
836 TAILQ_FOREACH(cr, &cs->cs_pending, cr_link) {
837 if (cr->cr_xid == xid) {
839 * This one matches. We snip it out of
840 * the pending list and leave the
841 * reply mbuf in cr->cr_mrep. Set the
842 * XID to zero so that clnt_dg_call
843 * can know not to repeat the
846 TAILQ_REMOVE(&cs->cs_pending, cr, cr_link);
855 mtx_unlock(&cs->cs_lock);
858 * If we didn't find the matching request, just drop
859 * it - its probably a repeated reply.