lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <1617B125-3EFF-42EB-8F1B-A1D57E6ADC12@oracle.com>
Date:	Mon, 7 Nov 2011 23:01:09 -0500
From:	Chuck Lever <chuck.lever@...cle.com>
To:	Hamo <hamo.by@...il.com>
Cc:	linux-nfs@...r.kernel.org, linux-fsdevel@...r.kernel.org,
	linux-kernel@...r.kernel.org, steved@...hat.com, jlayton@...hat.com
Subject: Re: [PATCH] mount.nfs: ensure AF priority when mounting


On Nov 7, 2011, at 10:14 PM, Hamo wrote:

> On different architectures, getaddrinfo() may return different
> orders of address families. This may confuse the users.
> This patch fixes this problem by ensuring that we first try
> through IPv6(if present), then through IPv4.
> Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=750729

By the way, this bug isn't public (I can't access it, anyway).  If RH can't make it public, perhaps a copy of the relevant parts of the bug can be created in bugzilla.linux-nfs.org?  Otherwise, it's hard to tell what you are trying to fix so we can do a thorough patch review.

(Also, I'm not sure why you copied lkml and linux-fsdevel on this NFS-specific user space patch).

> Signed-off-by: Yang Bai <hamo.by@...il.com>
> ---
> utils/mount/stropts.c |   41 +++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 41 insertions(+), 0 deletions(-)
> 
> diff --git a/utils/mount/stropts.c b/utils/mount/stropts.c
> index 4032bf3..aa5ee86 100644
> --- a/utils/mount/stropts.c
> +++ b/utils/mount/stropts.c
> @@ -654,7 +654,28 @@ static int nfs_try_mount_v3v2(struct nfsmount_info *mi)
> 	struct addrinfo *ai;
> 	int ret = 0;
> 
> +	/* first, try IPv6 */
> 	for (ai = mi->address; ai != NULL; ai = ai->ai_next) {
> +		if (ai->ai_family != AF_INET6)
> +			continue;
> +		ret = nfs_do_mount_v3v2(mi, ai->ai_addr, ai->ai_addrlen);
> +		if (ret != 0)
> +			return ret;
> +
> +		switch (errno) {
> +		case ECONNREFUSED:
> +		case EOPNOTSUPP:
> +		case EHOSTUNREACH:
> +			continue;
> +		default:
> +			goto out;
> +		}
> +	}
> +
> +	/* then, try IPv4 */
> +	for (ai = mi->address; ai != NULL; ai = ai->ai_next) {
> +		if (ai->ai_family != AF_INET)
> +			continue;
> 		ret = nfs_do_mount_v3v2(mi, ai->ai_addr, ai->ai_addrlen);
> 		if (ret != 0)
> 			return ret;
> @@ -742,7 +763,27 @@ static int nfs_try_mount_v4(struct nfsmount_info *mi)
> 	struct addrinfo *ai;
> 	int ret = 0;
> 
> +	/* first, try IPv6 */
> 	for (ai = mi->address; ai != NULL; ai = ai->ai_next) {
> +		if (ai->ai_family != AF_INET6)
> +			continue;
> +		ret = nfs_do_mount_v4(mi, ai->ai_addr, ai->ai_addrlen);
> +		if (ret != 0)
> +			return ret;
> +
> +		switch (errno) {
> +		case ECONNREFUSED:
> +		case EHOSTUNREACH:
> +			continue;
> +		default:
> +			goto out;
> +		}
> +	}
> +
> +	/* then, try IPv4 */
> +	for (ai = mi->address; ai != NULL; ai = ai->ai_next) {
> +		if (ai->ai_family != AF_INET)
> +			continue;
> 		ret = nfs_do_mount_v4(mi, ai->ai_addr, ai->ai_addrlen);
> 		if (ret != 0)
> 			return ret;
> -- 
> 1.7.1

-- 
Chuck Lever
chuck[dot]lever[at]oracle[dot]com




--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ