[PATCH 1/4] showmount command: call nfs_getport instead of local getport

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

 utils/showmount/showmount.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)

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 <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);
 		}

--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux