Skip to contentSkip to conversation

text-based mount.nfs: support AF_INET6 addresses for NFSv4 mounting

PATCH New Chuck Lever 1 participant 1 message Feb 18, 2008

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

PATCH 16/17 text-based mount.nfs: support AF_INET6 addresses for NFSv4 mounting

The kernel now supports client-side IPv6 for the main NFS protocols, but not yet for auxiliary protocols such as NLM.

Enable the text-based mount.nfs logic to resolve hostnames to IPv6 addresses. This should be enough to begin testing the in-kernel NFSv4 support for IPv6.

Since NFSv4 unmounting is only a local process (no communication with the server) we don't need to do anything to support unmounting an IPv6-addressed NFSv4 server.

Note that the mount command may now also pass in an IPv6 address via the "clientaddr=" mount option, though the kernel NFS client doesn't yet support an IPv6 callback service.

---

 utils/mount/stropts.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
utils/mount/stropts.c +4 -3
index ef6365d..caf13b1 100644
@@ -725,13 +725,14 @@ int nfsmount_string(const char *spec, const char *node, const char *type,
 		    int flags, char **extra_opts, int fake, int child)
 {
 	struct mount_options *options = NULL;
-	struct sockaddr_in saddr;
+	struct sockaddr_storage dummy;
+	struct sockaddr *saddr = (struct sockaddr *)&dummy;
 	char *hostname;
 	int retval = EX_FAIL;
 
 	if (!parse_devname(spec, &hostname))
 		return retval;
-	if (!fill_ipv4_sockaddr(hostname, &saddr))
+	if (nfs_name_to_address(hostname, AF_UNSPEC, saddr))
 		goto fail;
 
 	options = po_split(*extra_opts);
@@ -740,7 +741,7 @@ int nfsmount_string(const char *spec, const char *node, const char *type,
 		goto fail;
 	}
 
-	if (!set_mandatory_options(type, (struct sockaddr *)&saddr, options))
+	if (!set_mandatory_options(type, saddr, options))
 		goto out;
 
 	if (po_rightmost(options, "bg", "fg") == PO_KEY1_RIGHTMOST)