diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2009-12-11 10:50:13 -0500 |
---|---|---|
committer | Steve Dickson <steved@redhat.com> | 2009-12-11 16:13:16 -0500 |
commit | 2755eeaa0a573e5cff621bb0102ddf4df3d07e19 (patch) | |
tree | 269c1d56db8f6a9ceab7516ef9b8e62ff9b143c4 | |
parent | 0e90c66a66946975029ef08038556e229955eb07 (diff) | |
download | nfs-utils-2755eeaa0a573e5cff621bb0102ddf4df3d07e19.tar.gz nfs-utils-2755eeaa0a573e5cff621bb0102ddf4df3d07e19.tar.xz nfs-utils-2755eeaa0a573e5cff621bb0102ddf4df3d07e19.zip |
mount.nfs: Teach umount.nfs to recognize netids in /etc/mtab
umount.nfs has to detect the correct address family to use when
looking up the server.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r-- | utils/mount/nfsumount.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/utils/mount/nfsumount.c b/utils/mount/nfsumount.c index c5505b1..9d798a2 100644 --- a/utils/mount/nfsumount.c +++ b/utils/mount/nfsumount.c @@ -169,10 +169,15 @@ out: static int nfs_umount_do_umnt(struct mount_options *options, char **hostname, char **dirname) { - struct sockaddr_storage address; - struct sockaddr *sap = (struct sockaddr *)&address; + union { + struct sockaddr sa; + struct sockaddr_in s4; + struct sockaddr_in6 s6; + } address; + struct sockaddr *sap = &address.sa; socklen_t salen = sizeof(address); struct pmap nfs_pmap, mnt_pmap; + sa_family_t family; if (!nfs_options2pmap(options, &nfs_pmap, &mnt_pmap)) { nfs_error(_("%s: bad mount options"), progname); @@ -189,8 +194,10 @@ static int nfs_umount_do_umnt(struct mount_options *options, return EX_FAIL; } - if (nfs_name_to_address(*hostname, sap, &salen) == 0) - /* nfs_name_to_address reports any errors */ + if (!nfs_mount_proto_family(options, &family)) + return 0; + if (!nfs_lookup(*hostname, family, sap, &salen)) + /* nfs_lookup reports any errors */ return EX_FAIL; if (nfs_advise_umount(sap, salen, &mnt_pmap, dirname) == 0) |