]> git.decadent.org.uk Git - nfs-utils.git/commitdiff
showmount command: call nfs_getport instead of local getport
authorChuck Lever <chuck.lever@oracle.com>
Tue, 25 Nov 2008 13:15:51 +0000 (08:15 -0500)
committerSteve Dickson <steved@redhat.com>
Tue, 25 Nov 2008 13:15:51 +0000 (08:15 -0500)
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 <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
utils/showmount/showmount.c

index 959229a8c90bd59a3a61ee3bac6ce3ca0e38078a..cbc8f1a503dffd2c7c75edf7d99ca712148029f1 100644 (file)
@@ -37,6 +37,8 @@
 #include <mount.h>
 #include <unistd.h>
 
+#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);
                }