diff mbox series

Squash to "selftests: mptcp: add ADD_ADDR timeout test case" v2

Message ID b3ed8ba86d19ab431e4e04b3dd94afbd973d8393.1603262779.git.geliangtang@gmail.com
State Accepted, archived
Commit 270e0d80b14bd87d25a4929018ed2c62724e3ca5
Delegated to: Matthieu Baerts
Headers show
Series Squash to "selftests: mptcp: add ADD_ADDR timeout test case" v2 | expand

Commit Message

Geliang Tang Oct. 21, 2020, 6:49 a.m. UTC
Added ADD_ADDR IPv6 support for reset_with_add_addr_timeout.

Signed-off-by: Geliang Tang <geliangtang@gmail.com>
---
 tools/testing/selftests/net/mptcp/config      |  8 +++-
 .../testing/selftests/net/mptcp/mptcp_join.sh | 41 ++++++++++++++-----
 2 files changed, 37 insertions(+), 12 deletions(-)

Comments

Geliang Tang Oct. 22, 2020, 2:42 a.m. UTC | #1
Hi Matt,

This squash-to patch is v2 for adding IPv6 support for ADD_ADDR timeout
test case. And I also put your squash-to patch about "skip mptcp_join
selftest if IPTables is not available" in it together.

Please help me to squash it to the original commit "selftests: mptcp:
add ADD_ADDR timeout test case".

Thanks very much.

-Geliang


Geliang Tang <geliangtang@gmail.com> 于2020年10月21日周三 下午2:49写道:

>
> Added ADD_ADDR IPv6 support for reset_with_add_addr_timeout.
>
> Signed-off-by: Geliang Tang <geliangtang@gmail.com>
> ---
>  tools/testing/selftests/net/mptcp/config      |  8 +++-
>  .../testing/selftests/net/mptcp/mptcp_join.sh | 41 ++++++++++++++-----
>  2 files changed, 37 insertions(+), 12 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selftests/net/mptcp/config
> index af8c0ca79b98..c74e60a01c17 100644
> --- a/tools/testing/selftests/net/mptcp/config
> +++ b/tools/testing/selftests/net/mptcp/config
> @@ -6,7 +6,11 @@ CONFIG_VETH=y
>  CONFIG_NET_SCH_NETEM=m
>  CONFIG_NETFILTER=y
>  CONFIG_NETFILTER_ADVANCED=y
> +CONFIG_NETFILTER_NETLINK=m
> +CONFIG_NF_TABLES=m
> +CONFIG_NFT_COUNTER=m
> +CONFIG_NFT_COMPAT=m
>  CONFIG_NETFILTER_XTABLES=m
>  CONFIG_NETFILTER_XT_MATCH_BPF=m
> -CONFIG_IP_NF_IPTABLES=m
> -CONFIG_IP_NF_FILTER=m
> +CONFIG_NF_TABLES_IPV4=y
> +CONFIG_NF_TABLES_IPV6=y
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 3767acb9bb12..0d93b243695f 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -13,17 +13,19 @@ capture=0
>
>  TEST_COUNT=0
>
> -# generated using "nfbpf_compile '(tcp[34] & 0xf0) == 0x30'"
> -CBPF_MPTCP_SUBOPTION_ADD_ADDR="13,
> +# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
> +#                                (ip6 && (ip6[74] & 0xf0) == 0x30)'"
> +CBPF_MPTCP_SUBOPTION_ADD_ADDR="14,
>                                48 0 0 0,
>                                84 0 0 240,
> -                              21 0 9 64,
> -                              48 0 0 9,
> -                              21 0 7 6,
> -                              40 0 0 6,
> -                              69 5 0 8191,
> -                              177 0 0 0,
> -                              80 0 0 34,
> +                              21 0 3 64,
> +                              48 0 0 54,
> +                              84 0 0 240,
> +                              21 6 7 48,
> +                              48 0 0 0,
> +                              84 0 0 240,
> +                              21 0 4 96,
> +                              48 0 0 74,
>                                84 0 0 240,
>                                21 0 1 48,
>                                6 0 0 65535,
> @@ -100,10 +102,18 @@ reset_with_cookies()
>
>  reset_with_add_addr_timeout()
>  {
> +       local ip="${1:-4}"
> +       local tables
> +
> +       tables="iptables"
> +       if [ $ip -eq 6 ]; then
> +               tables="ip6tables"
> +       fi
> +
>         reset
>
>         ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
> -       ip netns exec $ns2 iptables -A OUTPUT -p tcp \
> +       ip netns exec $ns2 $tables -A OUTPUT -p tcp \
>                 -m tcp --tcp-option 30 \
>                 -m bpf --bytecode \
>                 "$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \
> @@ -122,6 +132,17 @@ if [ $? -ne 0 ];then
>         exit $ksft_skip
>  fi
>
> +iptables -V > /dev/null 2>&1
> +if [ $? -ne 0 ];then
> +       echo "SKIP: Could not run all tests without iptables tool"
> +       exit $ksft_skip
> +fi
> +
> +ip6tables -V > /dev/null 2>&1
> +if [ $? -ne 0 ];then
> +       echo "SKIP: Could not run all tests without ip6tables tool"
> +       exit $ksft_skip
> +fi
>
>  check_transfer()
>  {
> --
> 2.26.2
>
Matthieu Baerts Oct. 23, 2020, 4:11 p.m. UTC | #2
Hi Geliang,

On 21/10/2020 08:49, Geliang Tang wrote:
> Added ADD_ADDR IPv6 support for reset_with_add_addr_timeout.

Thank you for the patch!

- 270e0d80b14b: "squashed" in "selftests: mptcp: add ADD_ADDR timeout 
test case"
- 6dbcea11474b: conflict in t/selftests-mptcp-add-link-failure-test-case
- Results: 62d3c2d391fa..66965b9869c7

Tests + export are going to be started soon.

Cheers,
Matt
diff mbox series

Patch

diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selftests/net/mptcp/config
index af8c0ca79b98..c74e60a01c17 100644
--- a/tools/testing/selftests/net/mptcp/config
+++ b/tools/testing/selftests/net/mptcp/config
@@ -6,7 +6,11 @@  CONFIG_VETH=y
 CONFIG_NET_SCH_NETEM=m
 CONFIG_NETFILTER=y
 CONFIG_NETFILTER_ADVANCED=y
+CONFIG_NETFILTER_NETLINK=m
+CONFIG_NF_TABLES=m
+CONFIG_NFT_COUNTER=m
+CONFIG_NFT_COMPAT=m
 CONFIG_NETFILTER_XTABLES=m
 CONFIG_NETFILTER_XT_MATCH_BPF=m
-CONFIG_IP_NF_IPTABLES=m
-CONFIG_IP_NF_FILTER=m
+CONFIG_NF_TABLES_IPV4=y
+CONFIG_NF_TABLES_IPV6=y
diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
index 3767acb9bb12..0d93b243695f 100755
--- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
+++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
@@ -13,17 +13,19 @@  capture=0
 
 TEST_COUNT=0
 
-# generated using "nfbpf_compile '(tcp[34] & 0xf0) == 0x30'"
-CBPF_MPTCP_SUBOPTION_ADD_ADDR="13,
+# generated using "nfbpf_compile '(ip && (ip[54] & 0xf0) == 0x30) ||
+#				  (ip6 && (ip6[74] & 0xf0) == 0x30)'"
+CBPF_MPTCP_SUBOPTION_ADD_ADDR="14,
 			       48 0 0 0,
 			       84 0 0 240,
-			       21 0 9 64,
-			       48 0 0 9,
-			       21 0 7 6,
-			       40 0 0 6,
-			       69 5 0 8191,
-			       177 0 0 0,
-			       80 0 0 34,
+			       21 0 3 64,
+			       48 0 0 54,
+			       84 0 0 240,
+			       21 6 7 48,
+			       48 0 0 0,
+			       84 0 0 240,
+			       21 0 4 96,
+			       48 0 0 74,
 			       84 0 0 240,
 			       21 0 1 48,
 			       6 0 0 65535,
@@ -100,10 +102,18 @@  reset_with_cookies()
 
 reset_with_add_addr_timeout()
 {
+	local ip="${1:-4}"
+	local tables
+
+	tables="iptables"
+	if [ $ip -eq 6 ]; then
+		tables="ip6tables"
+	fi
+
 	reset
 
 	ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
-	ip netns exec $ns2 iptables -A OUTPUT -p tcp \
+	ip netns exec $ns2 $tables -A OUTPUT -p tcp \
 		-m tcp --tcp-option 30 \
 		-m bpf --bytecode \
 		"$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \
@@ -122,6 +132,17 @@  if [ $? -ne 0 ];then
 	exit $ksft_skip
 fi
 
+iptables -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without iptables tool"
+	exit $ksft_skip
+fi
+
+ip6tables -V > /dev/null 2>&1
+if [ $? -ne 0 ];then
+	echo "SKIP: Could not run all tests without ip6tables tool"
+	exit $ksft_skip
+fi
 
 check_transfer()
 {