From: Chuck Lever Date: Tue, 2 Dec 2008 12:39:06 +0000 (-0500) Subject: mount command: Use nfs_pmap_getport() in probe_statd() X-Git-Tag: nfs-utils-1-1-5~53 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=ea0473feffd8071216c96217df3202a8deed2c65;p=nfs-utils.git mount command: Use nfs_pmap_getport() in probe_statd() Repace the getport() and clnt_ping() calls in probe_statd() with their new shared equivalents. Signed-off-by: Chuck Lever Signed-off-by: Steve Dickson --- diff --git a/utils/mount/network.c b/utils/mount/network.c index 806344c..0ba7bdb 100644 --- a/utils/mount/network.c +++ b/utils/mount/network.c @@ -47,6 +47,7 @@ #include "nls.h" #include "nfs_mount.h" #include "mount_constants.h" +#include "nfsrpc.h" #include "network.h" /* @@ -79,6 +80,11 @@ extern int nfs_mount_data_version; extern char *progname; extern int verbose; +static const char *nfs_ns_pgmtbl[] = { + "status", + NULL, +}; + static const unsigned long nfs_to_mnt[] = { 0, 0, @@ -669,24 +675,16 @@ version_fixed: return probe_mntport(mnt_server); } -static int probe_statd(void) +static int nfs_probe_statd(void) { - struct sockaddr_in addr; - unsigned short port; - - memset(&addr, 0, sizeof(addr)); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - port = getport(&addr, 100024, 1, IPPROTO_UDP); - - if (port == 0) - return 0; - addr.sin_port = htons(port); - - if (clnt_ping(&addr, 100024, 1, IPPROTO_UDP, NULL) <= 0) - return 0; + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_addr.s_addr = htonl(INADDR_LOOPBACK), + }; + rpcprog_t program = nfs_getrpcbyname(NSMPROG, nfs_ns_pgmtbl); - return 1; + return nfs_getport_ping((struct sockaddr *)&addr, sizeof(addr), + program, (rpcvers_t)1, IPPROTO_UDP); } /** @@ -700,7 +698,7 @@ int start_statd(void) struct stat stb; #endif - if (probe_statd()) + if (nfs_probe_statd()) return 1; #ifdef START_STATD @@ -718,7 +716,7 @@ int start_statd(void) waitpid(pid, NULL,0); break; } - if (probe_statd()) + if (nfs_probe_statd()) return 1; } }