All of lore.kernel.org
 help / color / mirror / Atom feed
From: Xiao Yang <yangx.jy@cn.fujitsu.com>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2] netns/netns_helper.sh: Fix failure when testing ipv6 in netns
Date: Fri, 5 Jan 2018 10:55:56 +0800	[thread overview]
Message-ID: <5A4EE93C.8070006@cn.fujitsu.com> (raw)
In-Reply-To: <1513826560-26481-1-git-send-email-yangx.jy@cn.fujitsu.com>

Hi Alexey,

Could you help me review the v2 patch?
Thanks a lot. :-)

Thanks,
Xiao Yang
On 2017/12/21 11:22, xiao yang wrote:
> When testing ipv6 in network namespace, we got the following
> error on some distros(e.g. RHEL7.5Alpha):
> ----------------------------------------------------------------------------------
> connect: Cannot assign requested address
> netns_comm_ns_exec_ipv6_netlink 1 TFAIL: configuration and communication over veth0
> connect: Cannot assign requested address
> netns_comm_ns_exec_ipv6_netlink 2 TFAIL: configuration and communication over veth1
> -----------------------------------------------------------------------------------
>
> On a kernel with commits 35e015e1f577 and a2d3f3e33853, the global
> 'accept_dad' flag is taken into account and set to 1 by default.
> If global flag is non-zero, DAD will be enabled and trigger the
> failure on a given interface.  I think it should not be considered
> as a bug, and try to fix it by setting all.accept_dad to 0 manually.
>
> The default value of all.accept_dad has been set to 0 in kernel:
> '094009531612("ipv6: set all.accept_dad to 0 by default")'
>
> Signed-off-by: xiao yang <yangx.jy@cn.fujitsu.com>
> ---
>  testcases/kernel/containers/netns/netns_helper.sh | 54 +++++++++++++++++++----
>  1 file changed, 46 insertions(+), 8 deletions(-)
>
> diff --git a/testcases/kernel/containers/netns/netns_helper.sh b/testcases/kernel/containers/netns/netns_helper.sh
> index a95cdf2..8f7d3b5 100755
> --- a/testcases/kernel/containers/netns/netns_helper.sh
> +++ b/testcases/kernel/containers/netns/netns_helper.sh
> @@ -78,6 +78,42 @@ tst_check_iproute()
>  	fi
>  }
>  
> +check_ipv6_tentative()
> +{
> +	local info=$($NS_EXEC $NS_HANDLE0 $NS_TYPE ip -6 address show tentative 2>&1)
> +	local enabled=$($NS_EXEC $NS_HANDLE0 $NS_TYPE cat /proc/sys/net/ipv6/conf/all/accept_dad)
> +
> +	# With commits 35e015e1f577 and a2d3f3e33853, the global 'accept_dad'
> +	# flag is also taken into account (default value is 1). If either
> +	# global or per-interface flag is non-zero, DAD will be enabled on a
> +	# given interface.  With commit 094009531612, all.accept_dad is set to
> +	# 0 by default.
> +	if [ -n "$info" -a $enabled -eq 1 ]; then
> +		tst_resm TINFO "all.accept_dad was taken into account and set to 1 by default, and set it to 0 manually"
> +		echo 0 | $NS_EXEC $NS_HANDLE0 $NS_TYPE \
> +		tee /proc/sys/net/ipv6/conf/all/accept_dad >/dev/null
> +		echo 0 | $NS_EXEC $NS_HANDLE1 $NS_TYPE \
> +		tee /proc/sys/net/ipv6/conf/all/accept_dad >/dev/null
> +
> +		case $USE_IFCONFIG in
> +		1)
> +			$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 down || \
> +				tst_brkm TBROK "disabling veth0 device failed"
> +			$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 down || \
> +				tst_brkm TBROK "disabling veth1 device failed"
> +			;;
> +		*)
> +			$NS_EXEC $NS_HANDLE0 $NS_TYPE ip link set veth0 down || \
> +				tst_brkm TBROK "disabling veth0 device failed"
> +			$NS_EXEC $NS_HANDLE1 $NS_TYPE ip link set veth1 down || \
> +				tst_brkm TBROK "disabling veth1 device failed"
> +			;;
> +		esac
> +
> +		netns_set_ip
> +	fi
> +}
> +
>  ##
>  # Sets up global variables which can be used in test cases (documented above),
>  # creates two network namespaces and a pair of virtual ethernet devices, each
> @@ -174,6 +210,8 @@ netns_setup()
>  	esac
>  
>  	netns_set_ip
> +
> +	[ "$2" = "ipv6" ] && check_ipv6_tentative
>  }
>  
>  ##
> @@ -265,23 +303,23 @@ netns_set_ip()
>  
>  	case $USE_IFCONFIG in
>  	1)
> -		$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 $IFCONF_IN6_ARG $IP0/$NETMASK ||
> +		$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 $IFCONF_IN6_ARG $IP0/$NETMASK || \
>  			tst_brkm TBROK "adding address to veth0 failed"
> -		$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK ||
> +		$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 $IFCONF_IN6_ARG $IP1/$NETMASK || \
>  			tst_brkm TBROK "adding address to veth1 failed"
> -		$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 up ||
> +		$NS_EXEC $NS_HANDLE0 $NS_TYPE ifconfig veth0 up || \
>  			tst_brkm TBROK "enabling veth0 device failed"
> -		$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 up ||
> +		$NS_EXEC $NS_HANDLE1 $NS_TYPE ifconfig veth1 up || \
>  			tst_brkm TBROK "enabling veth1 device failed"
>  		;;
>  	*)
> -		$NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP0/$NETMASK dev veth0 ||
> +		$NS_EXEC $NS_HANDLE0 $NS_TYPE ip address add $IP0/$NETMASK dev veth0 || \
>  			tst_brkm TBROK "adding address to veth0 failed"
> -		$NS_EXEC $NS_HANDLE1 $NS_TYPE ip address add $IP1/$NETMASK dev veth1 ||
> +		$NS_EXEC $NS_HANDLE1 $NS_TYPE ip address add $IP1/$NETMASK dev veth1 || \
>  			tst_brkm TBROK "adding address to veth1 failed"
> -		$NS_EXEC $NS_HANDLE0 $NS_TYPE ip link set veth0 up ||
> +		$NS_EXEC $NS_HANDLE0 $NS_TYPE ip link set veth0 up || \
>  			tst_brkm TBROK "enabling veth0 device failed"
> -		$NS_EXEC $NS_HANDLE1 $NS_TYPE ip link set veth1 up ||
> +		$NS_EXEC $NS_HANDLE1 $NS_TYPE ip link set veth1 up || \
>  			tst_brkm TBROK "enabling veth1 device failed"
>  		;;
>  	esac




      reply	other threads:[~2018-01-05  2:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-15 13:13 [LTP] [PATCH] netns/netns_helper.sh: Fix failure when testing ipv6 in netns Xiao Yang
2017-12-15 14:06 ` Alexey Kodanev
2017-12-18  2:50   ` Xiao Yang
2017-12-19  8:24     ` Alexey Kodanev
2017-12-20  9:39       ` Xiao Yang
2017-12-21  3:22       ` [LTP] [PATCH v2] " xiao yang
2018-01-05  2:55         ` Xiao Yang [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5A4EE93C.8070006@cn.fujitsu.com \
    --to=yangx.jy@cn.fujitsu.com \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.