2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A
2N/A/*
2N/A * Copyright (c) 1989, 2011, Oracle and/or its affiliates. All rights reserved.
2N/A */
2N/A
2N/A/* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
2N/A/* All Rights Reserved */
2N/A/*
2N/A * Portions of this source code were derived from Berkeley
2N/A * 4.3 BSD under license from the Regents of the University of
2N/A * California.
2N/A */
2N/A
2N/A/*
2N/A * Client interface to broadcast service.
2N/A *
2N/A * The following is kludged-up support for simple rpc broadcasts.
2N/A * Someday a large, complicated system will replace these routines.
2N/A */
2N/A
2N/A#include "mt.h"
2N/A#include "rpc_mt.h"
2N/A#include <string.h>
2N/A#include <strings.h>
2N/A#include <rpc/rpc.h>
2N/A#include <rpc/nettype.h>
2N/A#include <sys/poll.h>
2N/A#include <netdir.h>
2N/A#ifdef PORTMAP
2N/A#include <rpc/pmap_prot.h>
2N/A#endif
2N/A#ifdef RPC_DEBUG
2N/A#include <stdio.h>
2N/A#endif
2N/A#include <errno.h>
2N/A#include <syslog.h>
2N/A#include <stdlib.h>
2N/A#include <unistd.h>
2N/A#include <sys/types.h>
2N/A#include <sys/socket.h>
2N/A#include <netinet/in.h>
2N/A#include <arpa/inet.h>
2N/A
2N/A#define MAXBCAST 20 /* Max no of broadcasting transports */
2N/A#define INITTIME 4000 /* Time to wait initially */
2N/A#define WAITTIME 8000 /* Maximum time to wait */
2N/A
2N/Aint lowvers = 1; /* by default, broadcast only version 2 over UDP */
2N/A#ifndef NETIDLEN
2N/A#define NETIDLEN 32
2N/A#endif
2N/A
2N/A/*
2N/A * If nettype is NULL, it broadcasts on all the available
2N/A * datagram_n transports. May potentially lead to broadacst storms
2N/A * and hence should be used with caution, care and courage.
2N/A *
2N/A * The current parameter xdr packet size is limited by the max tsdu
2N/A * size of the transport. If the max tsdu size of any transport is
2N/A * smaller than the parameter xdr packet, then broadcast is not
2N/A * sent on that transport.
2N/A *
2N/A * Also, the packet size should be less the packet size of
2N/A * the data link layer (for ethernet it is 1400 bytes). There is
2N/A * no easy way to find out the max size of the data link layer and
2N/A * we are assuming that the args would be smaller than that.
2N/A *
2N/A * The result size has to be smaller than the transport tsdu size.
2N/A *
2N/A * If PORTMAP has been defined, we send two packets for UDP, one for
2N/A * rpcbind and one for portmap. For those machines which support
2N/A * both rpcbind and portmap, it will cause them to reply twice, and
2N/A * also here it will get two responses ... inefficient and clumsy.
2N/A */
2N/A
2N/A
2N/Aenum clnt_stat
2N/Arpc_broadcast_exp(const rpcprog_t prog, const rpcvers_t vers,
2N/A const rpcproc_t proc, const xdrproc_t xargs, caddr_t argsp,
2N/A const xdrproc_t xresults, caddr_t resultsp, const resultproc_t eachresult,
2N/A const int inittime, const int waittime, const char *netclass)
2N/A{
2N/A enum clnt_stat stat = RPC_SUCCESS; /* Return status */
2N/A XDR xdr_stream; /* XDR stream */
2N/A XDR *xdrs = &xdr_stream;
2N/A struct rpc_msg msg; /* RPC message */
2N/A struct timeval t;
2N/A char *outbuf = NULL; /* Broadcast msg buffer */
2N/A char *inbuf = NULL; /* Reply buf */
2N/A uint_t maxbufsize = 0;
2N/A AUTH *sys_auth = authsys_create_default();
2N/A int i, j;
2N/A void *handle;
2N/A char uaddress[1024]; /* A self imposed limit */
2N/A char *uaddrp = uaddress;
2N/A int pmap_reply_flag; /* reply recvd from PORTMAP */
2N/A /* An array of all the suitable broadcast transports */
2N/A struct {
2N/A int fd; /* File descriptor */
2N/A bool_t udp_flag; /* this is udp */
2N/A struct netconfig *nconf; /* Netconfig structure */
2N/A uint_t asize; /* Size of the addr buf */
2N/A uint_t dsize; /* Size of the data buf */
2N/A struct netbuf raddr; /* Remote address */
2N/A struct nd_addrlist *nal; /* Broadcast addrs */
2N/A } fdlist[MAXBCAST];
2N/A struct pollfd pfd[MAXBCAST];
2N/A int fdlistno = 0;
2N/A struct r_rpcb_rmtcallargs barg; /* Remote arguments */
2N/A struct r_rpcb_rmtcallres bres; /* Remote results */
2N/A struct t_unitdata t_udata, t_rdata;
2N/A struct netconfig *nconf;
2N/A struct nd_hostserv hs;
2N/A int msec;
2N/A int pollretval;
2N/A int fds_found;
2N/A char nettype_array[NETIDLEN];
2N/A char *nettype = &nettype_array[0];
2N/A
2N/A#ifdef PORTMAP
2N/A rpcport_t *port; /* Remote port number */
2N/A int pmap_flag = 0; /* UDP exists ? */
2N/A char *outbuf_pmap = NULL;
2N/A struct p_rmtcallargs barg_pmap; /* Remote arguments */
2N/A struct p_rmtcallres bres_pmap; /* Remote results */
2N/A struct t_unitdata t_udata_pmap;
2N/A int udpbufsz = 0;
2N/A#endif /* PORTMAP */
2N/A
2N/A if (sys_auth == NULL)
2N/A return (RPC_SYSTEMERROR);
2N/A /*
2N/A * initialization: create a fd, a broadcast address, and send the
2N/A * request on the broadcast transport.
2N/A * Listen on all of them and on replies, call the user supplied
2N/A * function.
2N/A */
2N/A
2N/A if (netclass == NULL)
2N/A nettype = NULL;
2N/A else {
2N/A size_t len = strlen(netclass);
2N/A if (len >= sizeof (nettype_array))
2N/A return (RPC_UNKNOWNPROTO);
2N/A (void) strcpy(nettype, netclass);
2N/A }
2N/A
2N/A if (nettype == NULL)
2N/A nettype = "datagram_n";
2N/A if ((handle = __rpc_setconf((char *)nettype)) == NULL)
2N/A return (RPC_UNKNOWNPROTO);
2N/A while (nconf = __rpc_getconf(handle)) {
2N/A struct t_info tinfo;
2N/A int fd;
2N/A uint_t addrlen;
2N/A
2N/A if (nconf->nc_semantics != NC_TPI_CLTS)
2N/A continue;
2N/A if (fdlistno >= MAXBCAST)
2N/A break; /* No more slots available */
2N/A if ((fd = t_open(nconf->nc_device, O_RDWR, &tinfo)) == -1) {
2N/A stat = RPC_CANTSEND;
2N/A continue;
2N/A }
2N/A __rpc_set_mac_options(fd, nconf, prog);
2N/A if (t_bind(fd, NULL, NULL) == -1) {
2N/A (void) t_close(fd);
2N/A stat = RPC_CANTSEND;
2N/A continue;
2N/A }
2N/A
2N/A /* Do protocol specific negotiating for broadcast */
2N/A if (netdir_options(nconf, ND_SET_BROADCAST, fd, NULL)) {
2N/A (void) t_close(fd);
2N/A stat = RPC_NOBROADCAST;
2N/A continue;
2N/A }
2N/A fdlist[fdlistno].fd = fd;
2N/A fdlist[fdlistno].nconf = nconf;
2N/A fdlist[fdlistno].udp_flag = FALSE;
2N/A if (((addrlen = __rpc_get_a_size(tinfo.addr)) == 0) ||
2N/A ((fdlist[fdlistno].raddr.buf = malloc(addrlen)) == NULL)) {
2N/A (void) t_close(fd);
2N/A stat = RPC_SYSTEMERROR;
2N/A goto done_broad;
2N/A }
2N/A fdlist[fdlistno].raddr.maxlen = addrlen;
2N/A fdlist[fdlistno].raddr.len = addrlen;
2N/A pfd[fdlistno].events = POLLIN | POLLPRI |
2N/A POLLRDNORM | POLLRDBAND;
2N/A pfd[fdlistno].fd = fdlist[fdlistno].fd = fd;
2N/A fdlist[fdlistno].asize = addrlen;
2N/A
2N/A if ((fdlist[fdlistno].dsize = __rpc_get_t_size(0,
2N/A tinfo.tsdu)) == 0) {
2N/A (void) t_close(fd);
2N/A free(fdlist[fdlistno].raddr.buf);
2N/A stat = RPC_SYSTEMERROR; /* XXX */
2N/A goto done_broad;
2N/A }
2N/A
2N/A if (maxbufsize <= fdlist[fdlistno].dsize)
2N/A maxbufsize = fdlist[fdlistno].dsize;
2N/A#ifdef PORTMAP
2N/A if (strcmp(nconf->nc_protofmly, NC_INET) == 0 &&
2N/A strcmp(nconf->nc_proto, NC_UDP) == 0) {
2N/A udpbufsz = fdlist[fdlistno].dsize;
2N/A if ((outbuf_pmap = malloc(udpbufsz)) == NULL) {
2N/A (void) t_close(fd);
2N/A free(fdlist[fdlistno].raddr.buf);
2N/A stat = RPC_SYSTEMERROR;
2N/A goto done_broad;
2N/A }
2N/A pmap_flag = 1;
2N/A fdlist[fdlistno].udp_flag = TRUE;
2N/A }
2N/A#endif
2N/A fdlistno++;
2N/A }
2N/A
2N/A if (fdlistno == 0) {
2N/A if (stat == RPC_SUCCESS)
2N/A stat = RPC_UNKNOWNPROTO;
2N/A goto done_broad;
2N/A }
2N/A if (maxbufsize == 0) {
2N/A if (stat == RPC_SUCCESS)
2N/A stat = RPC_CANTSEND;
2N/A goto done_broad;
2N/A }
2N/A inbuf = malloc((size_t)maxbufsize);
2N/A outbuf = malloc((size_t)maxbufsize);
2N/A if ((inbuf == NULL) || (outbuf == NULL)) {
2N/A stat = RPC_SYSTEMERROR;
2N/A goto done_broad;
2N/A }
2N/A
2N/A /* Serialize all the arguments which have to be sent */
2N/A (void) gettimeofday(&t, (struct timezone *)0);
2N/A msg.rm_xid = getpid() ^ t.tv_sec ^ t.tv_usec;
2N/A msg.rm_direction = CALL;
2N/A msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
2N/A msg.rm_call.cb_prog = RPCBPROG;
2N/A msg.rm_call.cb_vers = RPCBVERS;
2N/A msg.rm_call.cb_proc = RPCBPROC_CALLIT;
2N/A barg.prog = prog;
2N/A barg.vers = vers;
2N/A barg.proc = proc;
2N/A barg.args.args_val = argsp;
2N/A barg.xdr_args = xargs;
2N/A bres.addr = uaddrp;
2N/A bres.results.results_val = resultsp;
2N/A bres.xdr_res = xresults;
2N/A msg.rm_call.cb_cred = sys_auth->ah_cred;
2N/A msg.rm_call.cb_verf = sys_auth->ah_verf;
2N/A xdrmem_create(xdrs, outbuf, maxbufsize, XDR_ENCODE);
2N/A if ((!xdr_callmsg(xdrs, &msg)) ||
2N/A (!xdr_rpcb_rmtcallargs(xdrs, &barg))) {
2N/A stat = RPC_CANTENCODEARGS;
2N/A goto done_broad;
2N/A }
2N/A t_udata.opt.len = 0;
2N/A t_udata.udata.buf = outbuf;
2N/A t_udata.udata.len = xdr_getpos(xdrs);
2N/A t_udata.udata.maxlen = t_udata.udata.len;
2N/A /* XXX Should have set opt to its legal maxlen. */
2N/A t_rdata.opt.len = t_rdata.opt.maxlen = 0;
2N/A xdr_destroy(xdrs);
2N/A
2N/A#ifdef PORTMAP
2N/A /* Prepare the packet for version 2 PORTMAP */
2N/A if (pmap_flag) {
2N/A msg.rm_xid++; /* One way to distinguish */
2N/A msg.rm_call.cb_prog = PMAPPROG;
2N/A msg.rm_call.cb_vers = PMAPVERS;
2N/A msg.rm_call.cb_proc = PMAPPROC_CALLIT;
2N/A barg_pmap.prog = prog;
2N/A barg_pmap.vers = vers;
2N/A barg_pmap.proc = proc;
2N/A barg_pmap.args.args_val = argsp;
2N/A barg_pmap.xdr_args = xargs;
2N/A port = &bres_pmap.port; /* for use later on */
2N/A bres_pmap.xdr_res = xresults;
2N/A bres_pmap.res.res_val = resultsp;
2N/A xdrmem_create(xdrs, outbuf_pmap, udpbufsz, XDR_ENCODE);
2N/A if ((!xdr_callmsg(xdrs, &msg)) ||
2N/A (!xdr_rmtcallargs(xdrs, &barg_pmap))) {
2N/A stat = RPC_CANTENCODEARGS;
2N/A goto done_broad;
2N/A }
2N/A t_udata_pmap.opt.len = 0;
2N/A t_udata_pmap.udata.buf = outbuf_pmap;
2N/A t_udata_pmap.udata.len = xdr_getpos(xdrs);
2N/A xdr_destroy(xdrs);
2N/A }
2N/A#endif /* PORTMAP */
2N/A
2N/A /*
2N/A * Basic loop: broadcast the packets to transports which
2N/A * support data packets of size such that one can encode
2N/A * all the arguments.
2N/A * Wait a while for response(s).
2N/A * The response timeout grows larger per iteration.
2N/A */
2N/A hs.h_host = HOST_BROADCAST;
2N/A hs.h_serv = "rpcbind";
2N/A
2N/A for (msec = inittime; msec <= waittime; msec += msec) {
2N/A /* Broadcast all the packets now */
2N/A for (i = 0; i < fdlistno; i++) {
2N/A if (strcmp(fdlist[i].nconf->nc_protofmly,
2N/A NC_INET6) == 0) {
2N/A /* if it's IPv6 */
2N/A
2N/A struct netbuf addr;
2N/A struct sockaddr_in6 sa6;
2N/A
2N/A /* fill in the multicast address */
2N/A bzero((char *)&sa6, sizeof (sa6));
2N/A sa6.sin6_family = AF_INET6;
2N/A sa6.sin6_port = htons(PMAPPORT);
2N/A (void) inet_pton(AF_INET6, RPCB_MULTICAST_ADDR,
2N/A &sa6.sin6_addr);
2N/A addr.maxlen = sizeof (struct sockaddr_in6);
2N/A addr.len = addr.maxlen;
2N/A addr.buf = (char *)&sa6;
2N/A
2N/A /* now send rpcbind message */
2N/A t_udata.addr = addr;
2N/A
2N/A
2N/A if (t_sndudata(fdlist[i].fd,
2N/A &t_udata)) {
2N/A (void) syslog(LOG_ERR,
2N/A "Cannot send broadcast\
2N/Apacket: %m");
2N/A#ifdef RPC_DEBUG
2N/A t_error("rpc_broadcast: t_sndudata");
2N/A#endif
2N/A stat = RPC_CANTSEND;
2N/A continue;
2N/A }
2N/A
2N/A } else {
2N/A
2N/A struct nd_addrlist *addrlist;
2N/A
2N/A if (fdlist[i].dsize < t_udata.udata.len) {
2N/A stat = RPC_CANTSEND;
2N/A continue;
2N/A }
2N/A if (netdir_getbyname(fdlist[i].nconf, &hs,
2N/A &addrlist) || (addrlist->n_cnt == 0)) {
2N/A stat = RPC_N2AXLATEFAILURE;
2N/A continue;
2N/A }
2N/A
2N/A for (j = 0; j < addrlist->n_cnt; j++) {
2N/A#ifdef RPC_DEBUG
2N/A struct netconfig *nconf =
2N/A fdlist[i].nconf;
2N/A#endif
2N/A
2N/A t_udata.addr = addrlist->n_addrs[j];
2N/A
2N/A /*
2N/A * Only use version 3 if lowvers
2N/A * is not set or transport is not UDP.
2N/A */
2N/A
2N/A if (!lowvers || !fdlist[i].udp_flag)
2N/A if (t_sndudata(fdlist[i].fd,
2N/A &t_udata)) {
2N/A (void) syslog(LOG_ERR,
2N/A "Cannot send broadcast\
2N/Apacket: %m");
2N/A#ifdef RPC_DEBUG
2N/A t_error("rpc_broadcast: t_sndudata");
2N/A#endif
2N/A stat = RPC_CANTSEND;
2N/A continue;
2N/A };
2N/A#ifdef RPC_DEBUG
2N/A if (!lowvers || !fdlist[i].udp_flag)
2N/A fprintf(stderr, "Broadcast\
2N/Apacket sent for %s\n", nconf->nc_netid);
2N/A#endif
2N/A#ifdef PORTMAP
2N/A /*
2N/A * Send the version 2 packet also
2N/A * for UDP/IP
2N/A */
2N/A if (fdlist[i].udp_flag) {
2N/A t_udata_pmap.addr =
2N/A t_udata.addr;
2N/A if (t_sndudata(fdlist[i].fd,
2N/A &t_udata_pmap)) {
2N/A (void) syslog(LOG_ERR,\
2N/A"Cannot send broadcast packet: %m");
2N/A#ifdef RPC_DEBUG
2N/A t_error("rpc_broadcast:\
2N/At_sndudata");
2N/A#endif
2N/A stat = RPC_CANTSEND;
2N/A continue;
2N/A }
2N/A }
2N/A#ifdef RPC_DEBUG
2N/A fprintf(stderr, "PMAP Broadcast packet\
2N/Asent for %s\n", nconf->nc_netid);
2N/A#endif
2N/A#endif /* PORTMAP */
2N/A }
2N/A /* End for sending all packets on this transport */
2N/A (void) netdir_free((char *)addrlist, ND_ADDRLIST);
2N/A } /* end non-IPv6 */
2N/A
2N/A } /* End for sending on all transports */
2N/A
2N/A if (eachresult == NULL) {
2N/A stat = RPC_SUCCESS;
2N/A goto done_broad;
2N/A }
2N/A
2N/A /*
2N/A * Get all the replies from these broadcast requests
2N/A */
2N/A recv_again:
2N/A
2N/A switch (pollretval = poll(pfd, fdlistno, msec)) {
2N/A case 0: /* timed out */
2N/A stat = RPC_TIMEDOUT;
2N/A continue;
2N/A case -1: /* some kind of error - we ignore it */
2N/A goto recv_again;
2N/A } /* end of poll results switch */
2N/A
2N/A t_rdata.udata.buf = inbuf;
2N/A
2N/A for (i = fds_found = 0;
2N/A i < fdlistno && fds_found < pollretval; i++) {
2N/A
2N/A int flag;
2N/A bool_t done = FALSE;
2N/A
2N/A if (pfd[i].revents == 0)
2N/A continue;
2N/A else if (pfd[i].revents & POLLNVAL) {
2N/A /*
2N/A * Something bad has happened to this descri-
2N/A * ptor. We can cause poll() to ignore
2N/A * it simply by using a negative fd. We do that
2N/A * rather than compacting the pfd[] and fdlist[]
2N/A * arrays.
2N/A */
2N/A pfd[i].fd = -1;
2N/A fds_found++;
2N/A continue;
2N/A } else
2N/A fds_found++;
2N/A#ifdef RPC_DEBUG
2N/A fprintf(stderr, "response for %s\n",
2N/A fdlist[i].nconf->nc_netid);
2N/A#endif
2N/A try_again:
2N/A t_rdata.udata.maxlen = fdlist[i].dsize;
2N/A t_rdata.udata.len = 0;
2N/A t_rdata.addr = fdlist[i].raddr;
2N/A if (t_rcvudata(fdlist[i].fd, &t_rdata, &flag) == -1) {
2N/A if (t_errno == TSYSERR && errno == EINTR)
2N/A goto try_again;
2N/A
2N/A /*
2N/A * Ignore any T_UDERR look errors.
2N/A * We should never see any ICMP port
2N/A * unreachables when broadcasting but it has
2N/A * been observed with broken IP
2N/A * implementations.
2N/A */
2N/A if (t_errno == TLOOK &&
2N/A t_look(fdlist[i].fd) == T_UDERR &&
2N/A t_rcvuderr(fdlist[i].fd, NULL) == 0)
2N/A goto recv_again;
2N/A
2N/A (void) syslog(LOG_ERR,
2N/A "Cannot receive reply to \
2N/A broadcast: %m");
2N/A stat = RPC_CANTRECV;
2N/A continue;
2N/A }
2N/A /*
2N/A * Not taking care of flag for T_MORE.
2N/A * We are assuming that
2N/A * such calls should not take more than one
2N/A * transport packet.
2N/A */
2N/A if (flag & T_MORE)
2N/A continue; /* Drop that and go ahead */
2N/A if (t_rdata.udata.len < (uint_t)sizeof (uint32_t))
2N/A continue; /* Drop that and go ahead */
2N/A /*
2N/A * see if reply transaction id matches sent id.
2N/A * If so, decode the results. If return id is xid + 1
2N/A * it was a PORTMAP reply
2N/A */
2N/A /* LINTED pointer cast */
2N/A if (*((uint32_t *)(inbuf)) == *((uint32_t *)(outbuf))) {
2N/A pmap_reply_flag = 0;
2N/A msg.acpted_rply.ar_verf = _null_auth;
2N/A msg.acpted_rply.ar_results.where =
2N/A (caddr_t)&bres;
2N/A msg.acpted_rply.ar_results.proc =
2N/A (xdrproc_t)xdr_rpcb_rmtcallres;
2N/A#ifdef PORTMAP
2N/A } else if (pmap_flag &&
2N/A /* LINTED pointer cast */
2N/A *((uint32_t *)(inbuf)) ==
2N/A /* LINTED pointer cast */
2N/A *((uint32_t *)(outbuf_pmap))) {
2N/A pmap_reply_flag = 1;
2N/A msg.acpted_rply.ar_verf = _null_auth;
2N/A msg.acpted_rply.ar_results.where =
2N/A (caddr_t)&bres_pmap;
2N/A msg.acpted_rply.ar_results.proc =
2N/A (xdrproc_t)xdr_rmtcallres;
2N/A#endif /* PORTMAP */
2N/A } else
2N/A continue;
2N/A xdrmem_create(xdrs, inbuf,
2N/A (uint_t)t_rdata.udata.len, XDR_DECODE);
2N/A if (xdr_replymsg(xdrs, &msg)) {
2N/A if ((msg.rm_reply.rp_stat == MSG_ACCEPTED) &&
2N/A (msg.acpted_rply.ar_stat == SUCCESS)) {
2N/A struct netbuf *taddr;
2N/A#ifdef PORTMAP
2N/A if (pmap_flag && pmap_reply_flag) {
2N/A /* convert port to taddr */
2N/A ((struct sockaddr_in *)
2N/A t_rdata.addr.buf)->sin_port =
2N/A htons((ushort_t)*port);
2N/A taddr = &t_rdata.addr;
2N/A } else /* Convert the uaddr to taddr */
2N/A#endif
2N/A taddr = uaddr2taddr(
2N/A fdlist[i].nconf,
2N/A uaddrp);
2N/A done = (*eachresult)(resultsp, taddr,
2N/A fdlist[i].nconf);
2N/A#ifdef RPC_DEBUG
2N/A {
2N/A int k;
2N/A
2N/A printf("rmt addr = ");
2N/A for (k = 0; k < taddr->len; k++)
2N/A printf("%d ", taddr->buf[k]);
2N/A printf("\n");
2N/A }
2N/A#endif
2N/A if (taddr && !pmap_reply_flag)
2N/A netdir_free((char *)taddr,
2N/A ND_ADDR);
2N/A }
2N/A /* otherwise, we just ignore the errors ... */
2N/A }
2N/A /* else some kind of deserialization problem ... */
2N/A
2N/A xdrs->x_op = XDR_FREE;
2N/A msg.acpted_rply.ar_results.proc = (xdrproc_t)xdr_void;
2N/A (void) xdr_replymsg(xdrs, &msg);
2N/A (void) (*xresults)(xdrs, resultsp);
2N/A XDR_DESTROY(xdrs);
2N/A if (done) {
2N/A stat = RPC_SUCCESS;
2N/A goto done_broad;
2N/A } else {
2N/A if (rpc_callerr.re_status == RPC_SYSTEMERROR) {
2N/A stat = RPC_SYSTEMERROR;
2N/A goto done_broad;
2N/A }
2N/A goto recv_again;
2N/A }
2N/A } /* The recv for loop */
2N/A } /* The giant for loop */
2N/A
2N/Adone_broad:
2N/A if (inbuf)
2N/A free(inbuf);
2N/A if (outbuf)
2N/A free(outbuf);
2N/A#ifdef PORTMAP
2N/A if (outbuf_pmap)
2N/A free(outbuf_pmap);
2N/A#endif
2N/A for (i = 0; i < fdlistno; i++) {
2N/A (void) t_close(fdlist[i].fd);
2N/A free(fdlist[i].raddr.buf);
2N/A }
2N/A AUTH_DESTROY(sys_auth);
2N/A (void) __rpc_endconf(handle);
2N/A
2N/A return (stat);
2N/A}
2N/A
2N/Aenum clnt_stat
2N/Arpc_broadcast(const rpcprog_t prog, const rpcvers_t vers, const rpcproc_t proc,
2N/A const xdrproc_t xargs, caddr_t argsp, xdrproc_t const xresults,
2N/A caddr_t resultsp, const resultproc_t eachresult, const char *nettype)
2N/A{
2N/A return (rpc_broadcast_exp(prog, vers, proc, xargs, argsp,
2N/A xresults, resultsp, eachresult,
2N/A INITTIME, WAITTIME, nettype));
2N/A}