summaryrefslogtreecommitdiffstats
path: root/usr.bin/showmount
diff options
context:
space:
mode:
authoriedowse <iedowse@FreeBSD.org>2001-04-05 17:18:36 +0000
committeriedowse <iedowse@FreeBSD.org>2001-04-05 17:18:36 +0000
commit467415a2ba769920ed176e23c5daff93b9cc1469 (patch)
tree50e853ce60f79e16a236e8d286a421b5f167e885 /usr.bin/showmount
parentc4564f1eedebba3b36521f9627b1ceeb611c66be (diff)
downloadFreeBSD-src-467415a2ba769920ed176e23c5daff93b9cc1469.zip
FreeBSD-src-467415a2ba769920ed176e23c5daff93b9cc1469.tar.gz
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>
Diffstat (limited to 'usr.bin/showmount')
-rw-r--r--usr.bin/showmount/showmount.c36
1 files changed, 2 insertions, 34 deletions
diff --git a/usr.bin/showmount/showmount.c b/usr.bin/showmount/showmount.c
index ecc528d..df692ac 100644
--- a/usr.bin/showmount/showmount.c
+++ b/usr.bin/showmount/showmount.c
@@ -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;
OpenPOWER on IntegriCloud