clnt_bcast.c revision 109954
1/*	$NetBSD: clnt_bcast.c,v 1.3 2000/07/06 03:05:20 christos Exp $	*/
2
3/*
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.
10 *
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.
14 *
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.
18 *
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.
22 *
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.
26 *
27 * Sun Microsystems, Inc.
28 * 2550 Garcia Avenue
29 * Mountain View, California  94043
30 */
31/*
32 * Copyright (c) 1986-1991 by Sun Microsystems Inc.
33 */
34
35/* #ident	"@(#)clnt_bcast.c	1.18	94/05/03 SMI" */
36
37#if !defined(lint) && defined(SCCSIDS)
38static char sccsid[] = "@(#)clnt_bcast.c 1.15 89/04/21 Copyr 1988 Sun Micro";
39#endif
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/lib/libc/rpc/clnt_bcast.c 109954 2003-01-27 22:38:25Z mbr $");
42
43
44/*
45 * clnt_bcast.c
46 * Client interface to broadcast service.
47 *
48 * Copyright (C) 1988, Sun Microsystems, Inc.
49 *
50 * The following is kludged-up support for simple rpc broadcasts.
51 * Someday a large, complicated system will replace these routines.
52 */
53
54#include "namespace.h"
55#include <sys/types.h>
56#include <sys/socket.h>
57#include <sys/queue.h>
58#include <net/if.h>
59#include <netinet/in.h>
60#include <ifaddrs.h>
61#include <sys/poll.h>
62#include <rpc/rpc.h>
63#ifdef PORTMAP
64#include <rpc/pmap_prot.h>
65#include <rpc/pmap_clnt.h>
66#include <rpc/pmap_rmt.h>
67#endif				/* PORTMAP */
68#include <rpc/nettype.h>
69#include <arpa/inet.h>
70#ifdef RPC_DEBUG
71#include <stdio.h>
72#endif
73#include <errno.h>
74#include <stdlib.h>
75#include <unistd.h>
76#include <netdb.h>
77#include <err.h>
78#include <string.h>
79#include "un-namespace.h"
80
81#include "rpc_com.h"
82
83#define	MAXBCAST 20	/* Max no of broadcasting transports */
84#define	INITTIME 4000	/* Time to wait initially */
85#define	WAITTIME 8000	/* Maximum time to wait */
86
87/*
88 * If nettype is NULL, it broadcasts on all the available
89 * datagram_n transports. May potentially lead to broadacst storms
90 * and hence should be used with caution, care and courage.
91 *
92 * The current parameter xdr packet size is limited by the max tsdu
93 * size of the transport. If the max tsdu size of any transport is
94 * smaller than the parameter xdr packet, then broadcast is not
95 * sent on that transport.
96 *
97 * Also, the packet size should be less the packet size of
98 * the data link layer (for ethernet it is 1400 bytes).  There is
99 * no easy way to find out the max size of the data link layer and
100 * we are assuming that the args would be smaller than that.
101 *
102 * The result size has to be smaller than the transport tsdu size.
103 *
104 * If PORTMAP has been defined, we send two packets for UDP, one for
105 * rpcbind and one for portmap. For those machines which support
106 * both rpcbind and portmap, it will cause them to reply twice, and
107 * also here it will get two responses ... inefficient and clumsy.
108 */
109
110struct broadif {
111	int index;
112	struct sockaddr_storage broadaddr;
113	TAILQ_ENTRY(broadif) link;
114};
115
116typedef TAILQ_HEAD(, broadif) broadlist_t;
117
118int __rpc_getbroadifs(int, int, int, broadlist_t *);
119void __rpc_freebroadifs(broadlist_t *);
120int __rpc_broadenable(int, int, struct broadif *);
121
122int __rpc_lowvers = 0;
123
124int
125__rpc_getbroadifs(int af, int proto, int socktype, broadlist_t *list)
126{
127	int count = 0;
128	struct broadif *bip;
129	struct ifaddrs *ifap, *ifp;
130#ifdef INET6
131	struct sockaddr_in6 *sin6;
132#endif
133	struct sockaddr_in *sin;
134	struct addrinfo hints, *res;
135
136	if (getifaddrs(&ifp) < 0)
137		return 0;
138
139	memset(&hints, 0, sizeof hints);
140
141	hints.ai_family = af;
142	hints.ai_protocol = proto;
143	hints.ai_socktype = socktype;
144
145	if (getaddrinfo(NULL, "sunrpc", &hints, &res) != 0)
146		return 0;
147
148	for (ifap = ifp; ifap != NULL; ifap = ifap->ifa_next) {
149		if (ifap->ifa_addr->sa_family != af ||
150		    !(ifap->ifa_flags & IFF_UP))
151			continue;
152#ifdef INET6
153		if ((af == AF_INET6 && !(ifap->ifa_flags & IFF_MULTICAST)) ||
154		    !(ifap->ifa_flags & IFF_BROADCAST))
155			continue;
156#endif
157		bip = (struct broadif *)malloc(sizeof *bip);
158		if (bip == NULL)
159			break;
160		bip->index = if_nametoindex(ifap->ifa_name);
161#ifdef INET6
162		if (af != AF_INET6 && (ifap->ifa_flags & IFF_BROADCAST)) {
163#else
164		if (ifap->ifa_flags & IFF_BROADCAST) {
165#endif
166			memcpy(&bip->broadaddr, ifap->ifa_broadaddr,
167			    (size_t)ifap->ifa_broadaddr->sa_len);
168			sin = (struct sockaddr_in *)(void *)&bip->broadaddr;
169			sin->sin_port =
170			    ((struct sockaddr_in *)
171			    (void *)res->ai_addr)->sin_port;
172#ifdef INET6
173		} else if (af == AF_INET6) {
174			sin6 = (struct sockaddr_in6 *)(void *)&bip->broadaddr;
175			inet_pton(af, RPCB_MULTICAST_ADDR, &sin6->sin6_addr);
176			sin6->sin6_family = af;
177			sin6->sin6_len = sizeof *sin6;
178			sin6->sin6_port =
179			    ((struct sockaddr_in6 *)
180			    (void *)res->ai_addr)->sin6_port;
181			sin6->sin6_scope_id = bip->index;
182#endif
183		}
184		TAILQ_INSERT_TAIL(list, bip, link);
185		count++;
186	}
187	freeifaddrs(ifp);
188	freeaddrinfo(res);
189
190	return count;
191}
192
193void
194__rpc_freebroadifs(broadlist_t *list)
195{
196	struct broadif *bip, *next;
197
198	bip = TAILQ_FIRST(list);
199
200	while (bip != NULL) {
201		next = TAILQ_NEXT(bip, link);
202		free(bip);
203		bip = next;
204	}
205}
206
207int
208/*ARGSUSED*/
209__rpc_broadenable(int af, int s, struct broadif *bip)
210{
211	int o = 1;
212
213#if 0
214	if (af == AF_INET6) {
215		fprintf(stderr, "set v6 multicast if to %d\n", bip->index);
216		if (_setsockopt(s, IPPROTO_IPV6, IPV6_MULTICAST_IF, &bip->index,
217		    sizeof bip->index) < 0)
218			return -1;
219	} else
220#endif
221		if (_setsockopt(s, SOL_SOCKET, SO_BROADCAST, &o, sizeof o) < 0)
222			return -1;
223
224	return 0;
225}
226
227
228enum clnt_stat
229rpc_broadcast_exp(prog, vers, proc, xargs, argsp, xresults, resultsp,
230	eachresult, inittime, waittime, nettype)
231	rpcprog_t	prog;		/* program number */
232	rpcvers_t	vers;		/* version number */
233	rpcproc_t	proc;		/* procedure number */
234	xdrproc_t	xargs;		/* xdr routine for args */
235	caddr_t		argsp;		/* pointer to args */
236	xdrproc_t	xresults;	/* xdr routine for results */
237	caddr_t		resultsp;	/* pointer to results */
238	resultproc_t	eachresult;	/* call with each result obtained */
239	int 		inittime;	/* how long to wait initially */
240	int 		waittime;	/* maximum time to wait */
241	const char		*nettype;	/* transport type */
242{
243	enum clnt_stat	stat = RPC_SUCCESS; /* Return status */
244	XDR 		xdr_stream; /* XDR stream */
245	XDR 		*xdrs = &xdr_stream;
246	struct rpc_msg	msg;	/* RPC message */
247	struct timeval	t;
248	char 		*outbuf = NULL;	/* Broadcast msg buffer */
249	char		*inbuf = NULL; /* Reply buf */
250	int		inlen;
251	u_int 		maxbufsize = 0;
252	AUTH 		*sys_auth = authunix_create_default();
253	int		i;
254	void		*handle;
255	char		uaddress[1024];	/* A self imposed limit */
256	char		*uaddrp = uaddress;
257	int 		pmap_reply_flag; /* reply recvd from PORTMAP */
258	/* An array of all the suitable broadcast transports */
259	struct {
260		int fd;		/* File descriptor */
261		int af;
262		int proto;
263		struct netconfig *nconf; /* Netconfig structure */
264		u_int asize;	/* Size of the addr buf */
265		u_int dsize;	/* Size of the data buf */
266		struct sockaddr_storage raddr; /* Remote address */
267		broadlist_t nal;
268	} fdlist[MAXBCAST];
269	struct pollfd pfd[MAXBCAST];
270	size_t fdlistno = 0;
271	struct r_rpcb_rmtcallargs barg;	/* Remote arguments */
272	struct r_rpcb_rmtcallres bres; /* Remote results */
273	size_t outlen;
274	struct netconfig *nconf;
275	int msec;
276	int pollretval;
277	int fds_found;
278
279#ifdef PORTMAP
280	size_t outlen_pmap = 0;
281	u_long port;		/* Remote port number */
282	int pmap_flag = 0;	/* UDP exists ? */
283	char *outbuf_pmap = NULL;
284	struct rmtcallargs barg_pmap;	/* Remote arguments */
285	struct rmtcallres bres_pmap; /* Remote results */
286	u_int udpbufsz = 0;
287#endif				/* PORTMAP */
288
289	if (sys_auth == NULL) {
290		return (RPC_SYSTEMERROR);
291	}
292	/*
293	 * initialization: create a fd, a broadcast address, and send the
294	 * request on the broadcast transport.
295	 * Listen on all of them and on replies, call the user supplied
296	 * function.
297	 */
298
299	if (nettype == NULL)
300		nettype = "datagram_n";
301	if ((handle = __rpc_setconf(nettype)) == NULL) {
302		return (RPC_UNKNOWNPROTO);
303	}
304	while ((nconf = __rpc_getconf(handle)) != NULL) {
305		int fd;
306		struct __rpc_sockinfo si;
307
308		if (nconf->nc_semantics != NC_TPI_CLTS)
309			continue;
310		if (fdlistno >= MAXBCAST)
311			break;	/* No more slots available */
312		if (!__rpc_nconf2sockinfo(nconf, &si))
313			continue;
314
315		TAILQ_INIT(&fdlist[fdlistno].nal);
316		if (__rpc_getbroadifs(si.si_af, si.si_proto, si.si_socktype,
317		    &fdlist[fdlistno].nal) == 0)
318			continue;
319
320		fd = _socket(si.si_af, si.si_socktype, si.si_proto);
321		if (fd < 0) {
322			stat = RPC_CANTSEND;
323			continue;
324		}
325		fdlist[fdlistno].af = si.si_af;
326		fdlist[fdlistno].proto = si.si_proto;
327		fdlist[fdlistno].fd = fd;
328		fdlist[fdlistno].nconf = nconf;
329		fdlist[fdlistno].asize = __rpc_get_a_size(si.si_af);
330		pfd[fdlistno].events = POLLIN | POLLPRI |
331			POLLRDNORM | POLLRDBAND;
332		pfd[fdlistno].fd = fdlist[fdlistno].fd = fd;
333		fdlist[fdlistno].dsize = __rpc_get_t_size(si.si_af, si.si_proto,
334							  0);
335
336		if (maxbufsize <= fdlist[fdlistno].dsize)
337			maxbufsize = fdlist[fdlistno].dsize;
338
339#ifdef PORTMAP
340		if (si.si_af == AF_INET && si.si_proto == IPPROTO_UDP) {
341			udpbufsz = fdlist[fdlistno].dsize;
342			if ((outbuf_pmap = malloc(udpbufsz)) == NULL) {
343				_close(fd);
344				stat = RPC_SYSTEMERROR;
345				goto done_broad;
346			}
347			pmap_flag = 1;
348		}
349#endif				/* PORTMAP */
350		fdlistno++;
351	}
352
353	if (fdlistno == 0) {
354		if (stat == RPC_SUCCESS)
355			stat = RPC_UNKNOWNPROTO;
356		goto done_broad;
357	}
358	if (maxbufsize == 0) {
359		if (stat == RPC_SUCCESS)
360			stat = RPC_CANTSEND;
361		goto done_broad;
362	}
363	inbuf = malloc(maxbufsize);
364	outbuf = malloc(maxbufsize);
365	if ((inbuf == NULL) || (outbuf == NULL)) {
366		stat = RPC_SYSTEMERROR;
367		goto done_broad;
368	}
369
370	/* Serialize all the arguments which have to be sent */
371	(void) gettimeofday(&t, NULL);
372	msg.rm_xid = __RPC_GETXID(&t);
373	msg.rm_direction = CALL;
374	msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
375	msg.rm_call.cb_prog = RPCBPROG;
376	msg.rm_call.cb_vers = RPCBVERS;
377	msg.rm_call.cb_proc = RPCBPROC_CALLIT;
378	barg.prog = prog;
379	barg.vers = vers;
380	barg.proc = proc;
381	barg.args.args_val = argsp;
382	barg.xdr_args = xargs;
383	bres.addr = uaddrp;
384	bres.results.results_val = resultsp;
385	bres.xdr_res = xresults;
386	msg.rm_call.cb_cred = sys_auth->ah_cred;
387	msg.rm_call.cb_verf = sys_auth->ah_verf;
388	xdrmem_create(xdrs, outbuf, maxbufsize, XDR_ENCODE);
389	if ((!xdr_callmsg(xdrs, &msg)) ||
390	    (!xdr_rpcb_rmtcallargs(xdrs,
391	    (struct rpcb_rmtcallargs *)(void *)&barg))) {
392		stat = RPC_CANTENCODEARGS;
393		goto done_broad;
394	}
395	outlen = xdr_getpos(xdrs);
396	xdr_destroy(xdrs);
397
398#ifdef PORTMAP
399	/* Prepare the packet for version 2 PORTMAP */
400	if (pmap_flag) {
401		msg.rm_xid++;	/* One way to distinguish */
402		msg.rm_call.cb_prog = PMAPPROG;
403		msg.rm_call.cb_vers = PMAPVERS;
404		msg.rm_call.cb_proc = PMAPPROC_CALLIT;
405		barg_pmap.prog = prog;
406		barg_pmap.vers = vers;
407		barg_pmap.proc = proc;
408		barg_pmap.args_ptr = argsp;
409		barg_pmap.xdr_args = xargs;
410		bres_pmap.port_ptr = &port;
411		bres_pmap.xdr_results = xresults;
412		bres_pmap.results_ptr = resultsp;
413		xdrmem_create(xdrs, outbuf_pmap, udpbufsz, XDR_ENCODE);
414		if ((! xdr_callmsg(xdrs, &msg)) ||
415		    (! xdr_rmtcall_args(xdrs, &barg_pmap))) {
416			stat = RPC_CANTENCODEARGS;
417			goto done_broad;
418		}
419		outlen_pmap = xdr_getpos(xdrs);
420		xdr_destroy(xdrs);
421	}
422#endif				/* PORTMAP */
423
424	/*
425	 * Basic loop: broadcast the packets to transports which
426	 * support data packets of size such that one can encode
427	 * all the arguments.
428	 * Wait a while for response(s).
429	 * The response timeout grows larger per iteration.
430	 */
431	for (msec = inittime; msec <= waittime; msec += msec) {
432		struct broadif *bip;
433
434		/* Broadcast all the packets now */
435		for (i = 0; i < fdlistno; i++) {
436			if (fdlist[i].dsize < outlen) {
437				stat = RPC_CANTSEND;
438				continue;
439			}
440			for (bip = TAILQ_FIRST(&fdlist[i].nal); bip != NULL;
441			     bip = TAILQ_NEXT(bip, link)) {
442				void *addr;
443
444				addr = &bip->broadaddr;
445
446				__rpc_broadenable(fdlist[i].af, fdlist[i].fd,
447				    bip);
448
449				/*
450				 * Only use version 3 if lowvers is not set
451				 */
452
453				if (!__rpc_lowvers)
454					if (_sendto(fdlist[i].fd, outbuf,
455					    outlen, 0, (struct sockaddr*)addr,
456					    (size_t)fdlist[i].asize) !=
457					    outlen) {
458#ifdef RPC_DEBUG
459						perror("sendto");
460#endif
461						warnx("clnt_bcast: cannot send"
462						      "broadcast packet");
463						stat = RPC_CANTSEND;
464						continue;
465					};
466#ifdef RPC_DEBUG
467				if (!__rpc_lowvers)
468					fprintf(stderr, "Broadcast packet sent "
469						"for %s\n",
470						 fdlist[i].nconf->nc_netid);
471#endif
472#ifdef PORTMAP
473				/*
474				 * Send the version 2 packet also
475				 * for UDP/IP
476				 */
477				if (pmap_flag &&
478				    fdlist[i].proto == IPPROTO_UDP) {
479					if (_sendto(fdlist[i].fd, outbuf_pmap,
480					    outlen_pmap, 0, addr,
481					    (size_t)fdlist[i].asize) !=
482						outlen_pmap) {
483						warnx("clnt_bcast: "
484						    "Cannot send broadcast packet");
485						stat = RPC_CANTSEND;
486						continue;
487					}
488				}
489#ifdef RPC_DEBUG
490				fprintf(stderr, "PMAP Broadcast packet "
491					"sent for %s\n",
492					fdlist[i].nconf->nc_netid);
493#endif
494#endif				/* PORTMAP */
495			}
496			/* End for sending all packets on this transport */
497		}	/* End for sending on all transports */
498
499		if (eachresult == NULL) {
500			stat = RPC_SUCCESS;
501			goto done_broad;
502		}
503
504		/*
505		 * Get all the replies from these broadcast requests
506		 */
507	recv_again:
508
509		switch (pollretval = _poll(pfd, fdlistno, msec)) {
510		case 0:		/* timed out */
511			stat = RPC_TIMEDOUT;
512			continue;
513		case -1:	/* some kind of error - we ignore it */
514			goto recv_again;
515		}		/* end of poll results switch */
516
517		for (i = fds_found = 0;
518		     i < fdlistno && fds_found < pollretval; i++) {
519			bool_t done = FALSE;
520
521			if (pfd[i].revents == 0)
522				continue;
523			else if (pfd[i].revents & POLLNVAL) {
524				/*
525				 * Something bad has happened to this descri-
526				 * ptor. We can cause _poll() to ignore
527				 * it simply by using a negative fd.  We do that
528				 * rather than compacting the pfd[] and fdlist[]
529				 * arrays.
530				 */
531				pfd[i].fd = -1;
532				fds_found++;
533				continue;
534			} else
535				fds_found++;
536#ifdef RPC_DEBUG
537			fprintf(stderr, "response for %s\n",
538				fdlist[i].nconf->nc_netid);
539#endif
540		try_again:
541			inlen = _recvfrom(fdlist[i].fd, inbuf, fdlist[i].dsize,
542			    0, (struct sockaddr *)(void *)&fdlist[i].raddr,
543			    &fdlist[i].asize);
544			if (inlen < 0) {
545				if (errno == EINTR)
546					goto try_again;
547				warnx("clnt_bcast: Cannot receive reply to "
548					"broadcast");
549				stat = RPC_CANTRECV;
550				continue;
551			}
552			if (inlen < sizeof (u_int32_t))
553				continue; /* Drop that and go ahead */
554			/*
555			 * see if reply transaction id matches sent id.
556			 * If so, decode the results. If return id is xid + 1
557			 * it was a PORTMAP reply
558			 */
559			if (*((u_int32_t *)(void *)(inbuf)) ==
560			    *((u_int32_t *)(void *)(outbuf))) {
561				pmap_reply_flag = 0;
562				msg.acpted_rply.ar_verf = _null_auth;
563				msg.acpted_rply.ar_results.where =
564					(caddr_t)(void *)&bres;
565				msg.acpted_rply.ar_results.proc =
566					(xdrproc_t)xdr_rpcb_rmtcallres;
567#ifdef PORTMAP
568			} else if (pmap_flag &&
569				*((u_int32_t *)(void *)(inbuf)) ==
570				*((u_int32_t *)(void *)(outbuf_pmap))) {
571				pmap_reply_flag = 1;
572				msg.acpted_rply.ar_verf = _null_auth;
573				msg.acpted_rply.ar_results.where =
574					(caddr_t)(void *)&bres_pmap;
575				msg.acpted_rply.ar_results.proc =
576					(xdrproc_t)xdr_rmtcallres;
577#endif				/* PORTMAP */
578			} else
579				continue;
580			xdrmem_create(xdrs, inbuf, (u_int)inlen, XDR_DECODE);
581			if (xdr_replymsg(xdrs, &msg)) {
582				if ((msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
583				    (msg.acpted_rply.ar_stat == SUCCESS)) {
584					struct netbuf taddr, *np;
585					struct sockaddr_in *sin;
586
587#ifdef PORTMAP
588					if (pmap_flag && pmap_reply_flag) {
589						sin = (struct sockaddr_in *)
590						    (void *)&fdlist[i].raddr;
591						sin->sin_port =
592						    htons((u_short)port);
593						taddr.len = taddr.maxlen =
594						    fdlist[i].raddr.ss_len;
595						taddr.buf = &fdlist[i].raddr;
596						done = (*eachresult)(resultsp,
597						    &taddr, fdlist[i].nconf);
598					} else {
599#endif				/* PORTMAP */
600#ifdef RPC_DEBUG
601						fprintf(stderr, "uaddr %s\n",
602						    uaddrp);
603#endif
604						np = uaddr2taddr(
605						    fdlist[i].nconf, uaddrp);
606						done = (*eachresult)(resultsp,
607						    np, fdlist[i].nconf);
608						free(np);
609#ifdef PORTMAP
610					}
611#endif				/* PORTMAP */
612				}
613				/* otherwise, we just ignore the errors ... */
614			}
615			/* else some kind of deserialization problem ... */
616
617			xdrs->x_op = XDR_FREE;
618			msg.acpted_rply.ar_results.proc = (xdrproc_t) xdr_void;
619			(void) xdr_replymsg(xdrs, &msg);
620			(void) (*xresults)(xdrs, resultsp);
621			XDR_DESTROY(xdrs);
622			if (done) {
623				stat = RPC_SUCCESS;
624				goto done_broad;
625			} else {
626				goto recv_again;
627			}
628		}		/* The recv for loop */
629	}			/* The giant for loop */
630
631done_broad:
632	if (inbuf)
633		(void) free(inbuf);
634	if (outbuf)
635		(void) free(outbuf);
636#ifdef PORTMAP
637	if (outbuf_pmap)
638		(void) free(outbuf_pmap);
639#endif				/* PORTMAP */
640	for (i = 0; i < fdlistno; i++) {
641		(void)_close(fdlist[i].fd);
642		__rpc_freebroadifs(&fdlist[i].nal);
643	}
644	AUTH_DESTROY(sys_auth);
645	(void) __rpc_endconf(handle);
646
647	return (stat);
648}
649
650
651enum clnt_stat
652rpc_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp,
653			eachresult, nettype)
654	rpcprog_t	prog;		/* program number */
655	rpcvers_t	vers;		/* version number */
656	rpcproc_t	proc;		/* procedure number */
657	xdrproc_t	xargs;		/* xdr routine for args */
658	caddr_t		argsp;		/* pointer to args */
659	xdrproc_t	xresults;	/* xdr routine for results */
660	caddr_t		resultsp;	/* pointer to results */
661	resultproc_t	eachresult;	/* call with each result obtained */
662	const char		*nettype;	/* transport type */
663{
664	enum clnt_stat	dummy;
665
666	dummy = rpc_broadcast_exp(prog, vers, proc, xargs, argsp,
667		xresults, resultsp, eachresult,
668		INITTIME, WAITTIME, nettype);
669	return (dummy);
670}
671