From: Chuck Lever Date: Tue, 25 Nov 2008 13:15:51 +0000 (-0500) Subject: showmount command: call nfs_getport instead of local getport X-Git-Tag: nfs-utils-1-1-5~59 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=bb3e50bd5c4f6bf94221ef69d4dc87e73d0e474b;p=nfs-utils.git showmount command: call nfs_getport instead of local getport Have the showmount command invoke the shared nfs_getport() function instead of its own local version. This gives the showmount command immediate support for querying via rpcbindv3/v4 in addition to portmapper, and sets the stage for AF_INET6 support in showmount. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/utils/showmount/showmount.c b/utils/showmount/showmount.c index 959229a..cbc8f1a 100644 --- a/utils/showmount/showmount.c +++ b/utils/showmount/showmount.c @@ -37,6 +37,8 @@ #include #include +#include "nfsrpc.h" + #define TIMEOUT_UDP 3 #define TIMEOUT_TCP 10 #define TOTAL_TIMEOUT 20 @@ -352,9 +354,9 @@ int main(int argc, char **argv) mclient = NULL; msock = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP); if (msock != -1) { - server_addr.sin_port = getport(&server_addr, - MOUNTPROG, MOUNTVERS, IPPROTO_TCP); - if (server_addr.sin_port) { + if (nfs_getport_ping((struct sockaddr *)&server_addr, + sizeof(server_addr), MOUNTPROG, + MOUNTVERS, IPPROTO_TCP)) { ret = connect_nb(msock, &server_addr, 0); if (ret == 0) /* success */ mclient = clnttcp_create(&server_addr, @@ -367,9 +369,9 @@ int main(int argc, char **argv) } if (!mclient) { - server_addr.sin_port = getport(&server_addr, - MOUNTPROG, MOUNTVERS, IPPROTO_UDP); - if (!server_addr.sin_port) { + if (nfs_getport_ping((struct sockaddr *)&server_addr, + sizeof(server_addr), MOUNTPROG, + MOUNTVERS, IPPROTO_UDP)) { clnt_pcreateerror("showmount"); exit(1); }