[PATCH 09/14] text-based mount command: Add IPv6 support to set_mandatory_options

Chuck Lever
2008-07-10T04:08:08Z

utils/mount/stropts.c | 12 ++++++------
1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
index e2e72a7..caa2c25 100644
--- a/utils/mount/stropts.c
+++ b/utils/mount/stropts.c
@@ -334,14 +334,15 @@ static int nfs_append_sloppy_option(struct mount_options *options)
*/
static int nfs_validate_options(struct nfsmount_info *mi)
{
- struct sockaddr_in saddr;
+ struct sockaddr_storage dummy;
+ struct sockaddr *sap = (struct sockaddr *)&dummy;
+ socklen_t salen = sizeof(dummy);

- if (!fill_ipv4_sockaddr(mi->hostname, &saddr))
+ if (!nfs_name_to_address(mi->hostname, mi->family, sap, &salen))
return 0;

if (strncmp(mi->type, "nfs4", 4) == 0) {
- if (!nfs_append_clientaddr_option((struct sockaddr *)&saddr,
- sizeof(saddr), mi->options))
+ if (!nfs_append_clientaddr_option(sap, salen, mi->options))
return 0;
} else {
if (!nfs_fix_mounthost_option(mi->family, mi->options))
@@ -353,8 +354,7 @@ static int nfs_validate_options(struct nfsmount_info *mi)
if (!nfs_append_sloppy_option(mi->options))
return 0;

- return nfs_append_addr_option((struct sockaddr *)&saddr,
- sizeof(saddr), mi->options);
+ return nfs_append_addr_option(sap, salen, mi->options);
}

/*