Add IPv6 support to showmount(8). This replaces IPv4-specific code

with calls to the new protocol-independent clnt_*_create functions
provided by ti-rpc. Martin submitted a more complex patch to achieve
this, but it turns out that clnt_create() does everything we need.

Reviewed by:	Martin Blapp <mb@imp.ch>
This commit is contained in:
Ian Dowse 2001-04-05 17:18:36 +00:00
parent aaad2b9793
commit c2fdb4d1b1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=75239

View File

@ -215,7 +215,6 @@ main(argc, argv)
* tcp_callrpc has the same interface as callrpc, but tries to
* use tcp as transport method in order to handle large replies.
*/
int
tcp_callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
char *host;
@ -227,43 +226,12 @@ tcp_callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
xdrproc_t outproc;
char *out;
{
struct hostent *hp;
struct sockaddr_in server_addr;
CLIENT *client;
int sock;
struct timeval timeout;
int rval;
hp = gethostbyname(host);
if (!hp)
return ((int) RPC_UNKNOWNHOST);
memset(&server_addr,0,sizeof(server_addr));
memcpy((char *) &server_addr.sin_addr,
hp->h_addr,
hp->h_length);
server_addr.sin_len = sizeof(struct sockaddr_in);
server_addr.sin_family =AF_INET;
server_addr.sin_port = 0;
sock = RPC_ANYSOCK;
client = clnttcp_create(&server_addr,
(u_long) prognum,
(u_long) versnum, &sock, 0, 0);
if (!client) {
timeout.tv_sec = 5;
timeout.tv_usec = 0;
server_addr.sin_port = 0;
sock = RPC_ANYSOCK;
client = clntudp_create(&server_addr,
(u_long) prognum,
(u_long) versnum,
timeout,
&sock);
}
if (!client)
if ((client = clnt_create(host, prognum, versnum, "tcp")) == NULL &&
(client = clnt_create(host, prognum, versnum, "udp")) == NULL)
return ((int) rpc_createerr.cf_stat);
timeout.tv_sec = 25;