Don't use portmapper to discover the port for NFSv4

Default to use port 2049. If server runs on a different port then
we must manually override this with the nfsport flag.
NFSv4 servers can run without any portmapper daemon at all and we
must be prepared for that.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
libnfs-4.0.0-vitalif
Ronnie Sahlberg 2018-04-29 13:46:22 +10:00
parent 9edb1078e6
commit 456e52507b
2 changed files with 6 additions and 17 deletions

View File

@ -1585,6 +1585,7 @@ nfs4_mount_async(struct nfs_context *nfs, const char *server,
{
struct nfs4_cb_data *data;
char *new_server, *new_export;
int port;
new_server = strdup(server);
free(nfs->server);
@ -1614,27 +1615,15 @@ nfs4_mount_async(struct nfs_context *nfs, const char *server,
data->private_data = private_data;
data->path = strdup(new_export);
if (nfs->nfsport) {
if (rpc_connect_port_async(nfs->rpc, server, nfs->nfsport,
NFS4_PROGRAM, NFS_V4,
nfs4_mount_1_cb, data) != 0) {
nfs_set_error(nfs, "Failed to start connection. %s",
nfs_get_error(nfs));
free_nfs4_cb_data(data);
return -1;
}
return 0;
}
if (rpc_connect_program_async(nfs->rpc, server,
NFS4_PROGRAM, NFS_V4,
nfs4_mount_1_cb, data) != 0) {
port = nfs->nfsport ? nfs->nfsport : 2049;
if (rpc_connect_port_async(nfs->rpc, server, port,
NFS4_PROGRAM, NFS_V4,
nfs4_mount_1_cb, data) != 0) {
nfs_set_error(nfs, "Failed to start connection. %s",
nfs_get_error(nfs));
free_nfs4_cb_data(data);
return -1;
}
return 0;
}

View File

@ -7,7 +7,7 @@ echo "NFSv${VERS} Basic timeout test."
if [ $VERS -eq 3 ]; then
COUNT=28
else
COUNT=18
COUNT=13
fi
start_share