Skip to contentSkip to conversation

mount.nfs4: don't try to detect a clientaddr if clientaddr= option is provided

PATCH New Gabriel Barazer 1 participant 1 message Aug 31, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mount.nfs4: don't try to detect a clientaddr if clientaddr= option is provided

If get_my_ipv4addr() fails (dns error, wrong hostname, etc.), nfs4mount would fail even if the clientaddr= is provided (and with clientaddr=, get_my_ipv4addr detection is then useless).

---
 utils/mount/nfs4mount.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
utils/mount/nfs4mount.c +8 -2
index c4e8bfb..391665b 100644
@@ -199,8 +199,6 @@ int nfs4mount(const char *spec, const char *node, int flags,
 
 	if (fill_ipv4_sockaddr(hostname, &server_addr))
 		goto fail;
-	if (get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
-		goto fail;
 
 	/* add IP address to mtab options for use when unmounting */
 	s = inet_ntoa(server_addr.sin_addr);
@@ -328,6 +326,14 @@ int nfs4mount(const char *spec, const char *node, int flags,
 		}
 	}
 
+	/* Try to get and resolve the local address only if
+	 * it is not provided by the clientaddr= option.
+	 * Else, nfs4mount could fail if the local hostname is not resolvable
+	 * (poor DNS config or early mount), even if clientaddr= is provided.
+	 */
+	if (!ip_addr_in_opts && get_my_ipv4addr(ip_addr, sizeof(ip_addr)))
+		goto fail;
+
 	data.flags = (soft ? NFS4_MOUNT_SOFT : 0)
 		| (intr ? NFS4_MOUNT_INTR : 0)
 		| (nocto ? NFS4_MOUNT_NOCTO : 0)
Signature · 11 lines
1.5.2.5


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >>  http://get.splunk.com/
_______________________________________________
NFS maillist  -  [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs