Lines Matching +full:continue +full:- +full:on +full:- +full:error

3 /*-
4 * SPDX-License-Identifier: BSD-4-Clause
11 * at Lawrence Berkeley Laboratory under DARPA contract BG 91-66 and
37 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
42 * partially based on:
121 * What is the longest we will wait before re-sending a request?
123 * The re-send loop count sup linearly to this maximum, so the
130 * Returns non-zero error on failure.
147 int error; in krpc_portmap() local
157 m->m_len = sizeof(*sdata); in krpc_portmap()
160 sdata->prog = txdr_unsigned(prog); in krpc_portmap()
161 sdata->vers = txdr_unsigned(vers); in krpc_portmap()
162 sdata->proto = txdr_unsigned(IPPROTO_UDP); in krpc_portmap()
163 sdata->port = 0; in krpc_portmap()
165 sin->sin_port = htons(PMAPPORT); in krpc_portmap()
166 error = krpc_call(sin, PMAPPROG, PMAPVERS, in krpc_portmap()
168 if (error) in krpc_portmap()
169 return error; in krpc_portmap()
171 if (m->m_len < sizeof(*rdata)) { in krpc_portmap()
177 *portp = rdata->port; in krpc_portmap()
185 * If from_p is non-null, then we are doing broadcast, and
201 int error, rcvflg, timo, secs, len; in krpc_call() local
210 if (sa->sin_family != AF_INET) in krpc_call()
220 if ((error = socreate(AF_INET, &so, SOCK_DGRAM, 0, td->td_ucred, td))) in krpc_call()
221 return error; in krpc_call()
232 if ((error = sosetopt(so, &sopt)) != 0) in krpc_call()
239 int on = 1; in krpc_call() local
241 sopt.sopt_val = &on; in krpc_call()
242 sopt.sopt_valsize = sizeof on; in krpc_call()
243 if ((error = sosetopt(so, &sopt)) != 0) in krpc_call()
250 * non-reserved (non-privileged) ports. in krpc_call()
254 sin->sin_len = sizeof(*sin); in krpc_call()
255 sin->sin_family = AF_INET; in krpc_call()
256 sin->sin_addr.s_addr = INADDR_ANY; in krpc_call()
259 tport--; in krpc_call()
260 sin->sin_port = htons(tport); in krpc_call()
261 error = sobind(so, (struct sockaddr *)sin, td); in krpc_call()
262 } while (error == EADDRINUSE && in krpc_call()
264 if (error) { in krpc_call()
277 mhead->m_next = *data; in krpc_call()
279 mhead->m_len = sizeof(*call); in krpc_call()
283 call->rp_xid = txdr_unsigned(xid); in krpc_call()
284 /* call->rp_direction = 0; */ in krpc_call()
285 call->rp_rpcvers = txdr_unsigned(2); in krpc_call()
286 call->rp_prog = txdr_unsigned(prog); in krpc_call()
287 call->rp_vers = txdr_unsigned(vers); in krpc_call()
288 call->rp_proc = txdr_unsigned(func); in krpc_call()
290 call->rpc_auth.authtype = txdr_unsigned(AUTH_UNIX); in krpc_call()
291 call->rpc_auth.authlen = txdr_unsigned(sizeof(struct auth_unix)); in krpc_call()
293 call->rpc_verf.authtype = 0; in krpc_call()
294 call->rpc_verf.authlen = 0; in krpc_call()
300 mhead->m_pkthdr.rcvif = NULL; in krpc_call()
304 * but delay each re-send by an increasing amount. in krpc_call()
309 /* Send RPC request (or re-send). */ in krpc_call()
311 error = sosend(so, (struct sockaddr *)sa, NULL, m, in krpc_call()
313 if (error) { in krpc_call()
314 printf("krpc_call: sosend: %d\n", error); in krpc_call()
323 saddr = ntohl(sa->sin_addr.s_addr); in krpc_call()
348 error = soreceive(so, &from, &auio, &m, NULL, &rcvflg); in krpc_call()
349 if (error == EWOULDBLOCK) { in krpc_call()
350 secs--; in krpc_call()
351 continue; in krpc_call()
353 if (error) in krpc_call()
355 len -= auio.uio_resid; in krpc_call()
359 continue; in krpc_call()
360 if (m->m_len < MIN_REPLY_HDR) in krpc_call()
361 continue; in krpc_call()
365 if (reply->rp_direction != txdr_unsigned(REPLY)) in krpc_call()
366 continue; in krpc_call()
368 if (reply->rp_xid != txdr_unsigned(xid)) in krpc_call()
369 continue; in krpc_call()
372 if (reply->rp_astatus != 0) { in krpc_call()
373 error = fxdr_unsigned(u_int32_t, reply->rp_errno); in krpc_call()
374 printf("rpc denied, error=%d\n", error); in krpc_call()
375 continue; in krpc_call()
379 if (reply->rp_status != 0) { in krpc_call()
380 error = fxdr_unsigned(u_int32_t, reply->rp_status); in krpc_call()
381 if (error == PROG_MISMATCH) { in krpc_call()
382 error = EBADRPC; in krpc_call()
385 printf("rpc denied, status=%d\n", error); in krpc_call()
386 continue; in krpc_call()
394 error = ETIMEDOUT; in krpc_call()
404 if (m->m_len < len) { in krpc_call()
407 error = ENOBUFS; in krpc_call()
412 if (reply->rp_auth.authtype != 0) { in krpc_call()
413 len += fxdr_unsigned(u_int32_t, reply->rp_auth.authlen); in krpc_call()
429 return error; in krpc_call()
434 * (but with non-standard args...)
443 /* data is padded to a long-word boundary */
462 m->m_len = mlen; in xdr_string_encode()
463 xs->len = txdr_unsigned(len); in xdr_string_encode()
464 bcopy(str, xs->data, len); in xdr_string_encode()