|
|
06d1c93 |
mount.nfs: Do not send pmap inquire when port is specified
|
|
|
06d1c93 |
|
|
|
06d1c93 |
When the port is specified on the command line do not
|
|
|
06d1c93 |
send a pmap inquire asking for the port. Instead use
|
|
|
06d1c93 |
the given port in the NFS ping. If the ping fails,
|
|
|
06d1c93 |
assume a bad port was given and now go ask the server
|
|
|
06d1c93 |
for the correct port.
|
|
|
06d1c93 |
|
|
|
06d1c93 |
Signed-off-by: Steve Dickson <steved@redhat.com>
|
|
|
06d1c93 |
|
|
|
06d1c93 |
diff --git a/utils/mount/network.c b/utils/mount/network.c
|
|
|
06d1c93 |
index d1f91dc..405c320 100644
|
|
|
06d1c93 |
--- a/utils/mount/network.c
|
|
|
06d1c93 |
+++ b/utils/mount/network.c
|
|
|
06d1c93 |
@@ -545,17 +545,18 @@ static int nfs_probe_port(const struct sockaddr *sap, const socklen_t salen,
|
|
|
06d1c93 |
const unsigned int prot = (u_int)pmap->pm_prot, *p_prot;
|
|
|
06d1c93 |
const u_short port = (u_short) pmap->pm_port;
|
|
|
06d1c93 |
unsigned long vers = pmap->pm_vers;
|
|
|
06d1c93 |
- unsigned short p_port;
|
|
|
06d1c93 |
+ unsigned short p_port = port;
|
|
|
06d1c93 |
+ int once = 1;
|
|
|
06d1c93 |
|
|
|
06d1c93 |
memcpy(saddr, sap, salen);
|
|
|
06d1c93 |
p_prot = prot ? &prot : protos;
|
|
|
06d1c93 |
p_vers = vers ? &vers : versions;
|
|
|
06d1c93 |
-
|
|
|
06d1c93 |
for (;;) {
|
|
|
06d1c93 |
if (verbose)
|
|
|
06d1c93 |
printf(_("%s: prog %lu, trying vers=%lu, prot=%u\n"),
|
|
|
06d1c93 |
progname, prog, *p_vers, *p_prot);
|
|
|
06d1c93 |
- p_port = nfs_getport(saddr, salen, prog, *p_vers, *p_prot);
|
|
|
06d1c93 |
+ if (!p_port)
|
|
|
06d1c93 |
+ p_port = nfs_getport(saddr, salen, prog, *p_vers, *p_prot);
|
|
|
06d1c93 |
if (p_port) {
|
|
|
06d1c93 |
if (!port || port == p_port) {
|
|
|
06d1c93 |
nfs_set_port(saddr, p_port);
|
|
|
06d1c93 |
@@ -564,6 +565,15 @@ static int nfs_probe_port(const struct sockaddr *sap, const socklen_t salen,
|
|
|
06d1c93 |
if (nfs_rpc_ping(saddr, salen, prog,
|
|
|
06d1c93 |
*p_vers, *p_prot, NULL))
|
|
|
06d1c93 |
goto out_ok;
|
|
|
06d1c93 |
+ if (port == p_port && once) {
|
|
|
06d1c93 |
+ /*
|
|
|
06d1c93 |
+ * Could be a bad port was specified. This
|
|
|
06d1c93 |
+ * time ask the server for the port but only
|
|
|
06d1c93 |
+ * do it once.
|
|
|
06d1c93 |
+ */
|
|
|
06d1c93 |
+ p_port = once = 0;
|
|
|
06d1c93 |
+ continue;
|
|
|
06d1c93 |
+ }
|
|
|
06d1c93 |
} else
|
|
|
06d1c93 |
rpc_createerr.cf_stat = RPC_PROGNOTREGISTERED;
|
|
|
06d1c93 |
}
|