All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 2/2] selftests: mptcp: add ADD_ADDR timeout test case
@ 2020-10-16  9:28 Geliang Tang
  0 siblings, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2020-10-16  9:28 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 8418 bytes --]

Hi Matt,

As I mentioned in the last meeting, I want to add ADD_ADDR timeout IPv6
test case. My patch is something like this:

+reset_with_add_addr6_timeout()
+{
+       reset
+
+       ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
+       ip netns exec $ns2 ip6tables -A OUTPUT -p tcp \
+               -m tcp --tcp-option 30 \
+               -m bpf --bytecode \
+               "$(nfbpf_compile '(tcp[34] & 0xf0) == 0x30')" \
+               -j DROP
+}
+
 for arg in "$@"; do
        if [ "$arg" = "-c" ]; then
                capture=1
@@ -590,6 +604,22 @@ ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2
flags subflow
 run_tests $ns1 $ns2 dead:beef:1::1 0 0 slow
 chk_join_nr "single subflow IPv6" 1 1 1

+# add_addr timeout IPv6
+reset_with_add_addr6_timeout
+ip netns exec $ns1 ./pm_nl_ctl limits 0 1
+ip netns exec $ns2 ./pm_nl_ctl limits 1 1
+ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal
+run_tests $ns1 $ns2 dead:beef:1::1 0 0 slow
+chk_join_nr "signal address, ADD_ADDR6 timeout" 1 1 1
+chk_add_nr 4 0
+
 # signal address IPv6
 reset
 ip netns exec $ns1 ./pm_nl_ctl limits 0 1

But this BPF (tcp[34] & 0xf0) == 0x30') is not working on IPv6, please
give me some help
about how to get this right offset value on IPv6. Thanks very much.

-Geliang

Geliang Tang <geliangtang(a)gmail.com> 于2020年10月1日周四 下午3:26写道:
>
> This patch added the test case for retransmitting ADD_ADDR when timeout
> occurs. It set NS1's add_addr_timeout to 1 second, and drop NS2's ADD_ADDR
> echo packets.
>
> Here we need to slow down the transfer process of all data to let the
> ADD_ADDR suboptions can be retransmitted three times. So we added a new
> parameter "speed" for do_transfer, it can be set with fast or slow.
>
> We also added three new optional parameters for run_tests, and dropped
> run_remove_tests function.
>
> Since we added the netfilter rules in this test case, we need to update
> the "config" file.
>
> Suggested-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>
> Suggested-by: Paolo Abeni <pabeni(a)redhat.com>
> Signed-off-by: Geliang Tang <geliangtang(a)gmail.com>
> ---
>  tools/testing/selftests/net/mptcp/config      |  6 ++
>  .../testing/selftests/net/mptcp/mptcp_join.sh | 73 +++++++++++++------
>  2 files changed, 55 insertions(+), 24 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/config b/tools/testing/selftests/net/mptcp/config
> index 8df5cb8f71ff..af8c0ca79b98 100644
> --- a/tools/testing/selftests/net/mptcp/config
> +++ b/tools/testing/selftests/net/mptcp/config
> @@ -4,3 +4,9 @@ CONFIG_INET_DIAG=m
>  CONFIG_INET_MPTCP_DIAG=m
>  CONFIG_VETH=y
>  CONFIG_NET_SCH_NETEM=m
> +CONFIG_NETFILTER=y
> +CONFIG_NETFILTER_ADVANCED=y
> +CONFIG_NETFILTER_XTABLES=m
> +CONFIG_NETFILTER_XT_MATCH_BPF=m
> +CONFIG_IP_NF_IPTABLES=m
> +CONFIG_IP_NF_FILTER=m
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_join.sh b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> index 08f53d86dedc..3767acb9bb12 100755
> --- a/tools/testing/selftests/net/mptcp/mptcp_join.sh
> +++ b/tools/testing/selftests/net/mptcp/mptcp_join.sh
> @@ -13,6 +13,22 @@ capture=0
>
>  TEST_COUNT=0
>
> +# generated using "nfbpf_compile '(tcp[34] & 0xf0) == 0x30'"
> +CBPF_MPTCP_SUBOPTION_ADD_ADDR="13,
> +                              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,
> +                              84 0 0 240,
> +                              21 0 1 48,
> +                              6 0 0 65535,
> +                              6 0 0 0"
> +
>  init()
>  {
>         capout=$(mktemp)
> @@ -82,6 +98,18 @@ reset_with_cookies()
>         done
>  }
>
> +reset_with_add_addr_timeout()
> +{
> +       reset
> +
> +       ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
> +       ip netns exec $ns2 iptables -A OUTPUT -p tcp \
> +               -m tcp --tcp-option 30 \
> +               -m bpf --bytecode \
> +               "$CBPF_MPTCP_SUBOPTION_ADD_ADDR" \
> +               -j DROP
> +}
> +
>  for arg in "$@"; do
>         if [ "$arg" = "-c" ]; then
>                 capture=1
> @@ -135,6 +163,7 @@ do_transfer()
>         connect_addr="$5"
>         rm_nr_ns1="$6"
>         rm_nr_ns2="$7"
> +       speed="$8"
>
>         port=$((10000+$TEST_COUNT))
>         TEST_COUNT=$((TEST_COUNT+1))
> @@ -159,7 +188,7 @@ do_transfer()
>                 sleep 1
>         fi
>
> -       if [[ $rm_nr_ns1 -eq 0 && $rm_nr_ns2 -eq 0 ]]; then
> +       if [ $speed = "fast" ]; then
>                 mptcp_connect="./mptcp_connect -j"
>         else
>                 mptcp_connect="./mptcp_connect -r"
> @@ -250,26 +279,13 @@ run_tests()
>         listener_ns="$1"
>         connector_ns="$2"
>         connect_addr="$3"
> +       rm_nr_ns1="${4:-0}"
> +       rm_nr_ns2="${5:-0}"
> +       speed="${6:-fast}"
>         lret=0
>
> -       do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} 0 0
> -       lret=$?
> -       if [ $lret -ne 0 ]; then
> -               ret=$lret
> -               return
> -       fi
> -}
> -
> -run_remove_tests()
> -{
> -       listener_ns="$1"
> -       connector_ns="$2"
> -       connect_addr="$3"
> -       rm_nr_ns1="$4"
> -       rm_nr_ns2="$5"
> -       lret=0
> -
> -       do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} ${rm_nr_ns1} ${rm_nr_ns2}
> +       do_transfer ${listener_ns} ${connector_ns} MPTCP MPTCP ${connect_addr} \
> +               ${rm_nr_ns1} ${rm_nr_ns2} ${speed}
>         lret=$?
>         if [ $lret -ne 0 ]; then
>                 ret=$lret
> @@ -491,12 +507,21 @@ run_tests $ns1 $ns2 10.0.1.1
>  chk_join_nr "multiple subflows and signal" 3 3 3
>  chk_add_nr 1 1
>
> +# add_addr timeout
> +reset_with_add_addr_timeout
> +ip netns exec $ns1 ./pm_nl_ctl limits 0 1
> +ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> +ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
> +run_tests $ns1 $ns2 10.0.1.1 0 0 slow
> +chk_join_nr "signal address, ADD_ADDR timeout" 1 1 1
> +chk_add_nr 4 0
> +
>  # single subflow, remove
>  reset
>  ip netns exec $ns1 ./pm_nl_ctl limits 0 1
>  ip netns exec $ns2 ./pm_nl_ctl limits 0 1
>  ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> -run_remove_tests $ns1 $ns2 10.0.1.1 0 1
> +run_tests $ns1 $ns2 10.0.1.1 0 1 slow
>  chk_join_nr "remove single subflow" 1 1 1
>  chk_rm_nr 1 1
>
> @@ -506,7 +531,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2
>  ip netns exec $ns2 ./pm_nl_ctl limits 0 2
>  ip netns exec $ns2 ./pm_nl_ctl add 10.0.2.2 flags subflow
>  ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> -run_remove_tests $ns1 $ns2 10.0.1.1 0 2
> +run_tests $ns1 $ns2 10.0.1.1 0 2 slow
>  chk_join_nr "remove multiple subflows" 2 2 2
>  chk_rm_nr 2 2
>
> @@ -515,7 +540,7 @@ reset
>  ip netns exec $ns1 ./pm_nl_ctl limits 0 1
>  ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
>  ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> -run_remove_tests $ns1 $ns2 10.0.1.1 1 0
> +run_tests $ns1 $ns2 10.0.1.1 1 0 slow
>  chk_join_nr "remove single address" 1 1 1
>  chk_add_nr 1 1
>  chk_rm_nr 0 0
> @@ -526,7 +551,7 @@ ip netns exec $ns1 ./pm_nl_ctl limits 0 2
>  ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
>  ip netns exec $ns2 ./pm_nl_ctl limits 1 2
>  ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
> -run_remove_tests $ns1 $ns2 10.0.1.1 1 1
> +run_tests $ns1 $ns2 10.0.1.1 1 1 slow
>  chk_join_nr "remove subflow and signal" 2 2 2
>  chk_add_nr 1 1
>  chk_rm_nr 1 1
> @@ -538,7 +563,7 @@ ip netns exec $ns1 ./pm_nl_ctl add 10.0.2.1 flags signal
>  ip netns exec $ns2 ./pm_nl_ctl limits 1 3
>  ip netns exec $ns2 ./pm_nl_ctl add 10.0.3.2 flags subflow
>  ip netns exec $ns2 ./pm_nl_ctl add 10.0.4.2 flags subflow
> -run_remove_tests $ns1 $ns2 10.0.1.1 1 2
> +run_tests $ns1 $ns2 10.0.1.1 1 2 slow
>  chk_join_nr "remove subflows and signal" 3 3 3
>  chk_add_nr 1 1
>  chk_rm_nr 2 2
> --
> 2.26.2
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 2/2] selftests: mptcp: add ADD_ADDR timeout test case
@ 2020-10-17  0:53 Geliang Tang
  0 siblings, 0 replies; 3+ messages in thread
From: Geliang Tang @ 2020-10-17  0:53 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 2576 bytes --]

Hi Matt,

Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2020年10月16日周五 下午11:02写道:
>
> Hi Geliang,
>
> On 16/10/2020 11:28, Geliang Tang wrote:
> > Hi Matt,
> >
> > As I mentioned in the last meeting, I want to add ADD_ADDR timeout IPv6
> > test case. My patch is something like this:
> >
> > +reset_with_add_addr6_timeout()
> > +{
> > +       reset
> > +
> > +       ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
> > +       ip netns exec $ns2 ip6tables -A OUTPUT -p tcp \
> > +               -m tcp --tcp-option 30 \
> > +               -m bpf --bytecode \
> > +               "$(nfbpf_compile '(tcp[34] & 0xf0) == 0x30')" \
> > +               -j DROP
> > +}
> > +
> >   for arg in "$@"; do
> >          if [ "$arg" = "-c" ]; then
> >                  capture=1
> > @@ -590,6 +604,22 @@ ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2
> > flags subflow
> >   run_tests $ns1 $ns2 dead:beef:1::1 0 0 slow
> >   chk_join_nr "single subflow IPv6" 1 1 1
> >
> > +# add_addr timeout IPv6
> > +reset_with_add_addr6_timeout
> > +ip netns exec $ns1 ./pm_nl_ctl limits 0 1
> > +ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> > +ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal
> > +run_tests $ns1 $ns2 dead:beef:1::1 0 0 slow
> > +chk_join_nr "signal address, ADD_ADDR6 timeout" 1 1 1
> > +chk_add_nr 4 0
> > +
> >   # signal address IPv6
> >   reset
> >   ip netns exec $ns1 ./pm_nl_ctl limits 0 1
> >
> > But this BPF (tcp[34] & 0xf0) == 0x30') is not working on IPv6, please
> > give me some help
> > about how to get this right offset value on IPv6. Thanks very much.
>
> It looks like it cannot get the offset correctly with TCP. The best is
> then to start from the IP layer and suppose there will not be any IPv6
> extension: we control the selftests environment and we already check
> with IPTables that we have TCP.
>
>
> $ docker run quay.io/casey_callendrello/nfbpf_compile RAW "(ip[54] &
> 0xf0) == 0x30"
> 8,48 0 0 0,84 0 0 240,21 0 4 64,48 0 0 54,84 0 0 240,21 0 1 48,6 0 0
> 65535,6 0 0 0
>
>
> $ docker run quay.io/casey_callendrello/nfbpf_compile RAW "(ip6[74] &
> 0xf0) == 0x30"
> 8,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,6 0 0 0
>
>
> May you try with these two new bytecodes please?

I have tested these two bytecodes, they all work well. I'll add them in the
ADD_ADDR IPV6 testcase patch.

Thanks.
-Geliang

>
> Cheers,
> Matt
> --
> Tessares | Belgium | Hybrid Access Solutions
> www.tessares.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 2/2] selftests: mptcp: add ADD_ADDR timeout test case
@ 2020-10-16 15:02 Matthieu Baerts
  0 siblings, 0 replies; 3+ messages in thread
From: Matthieu Baerts @ 2020-10-16 15:02 UTC (permalink / raw)
  To: mptcp

[-- Attachment #1: Type: text/plain, Size: 2211 bytes --]

Hi Geliang,

On 16/10/2020 11:28, Geliang Tang wrote:
> Hi Matt,
> 
> As I mentioned in the last meeting, I want to add ADD_ADDR timeout IPv6
> test case. My patch is something like this:
> 
> +reset_with_add_addr6_timeout()
> +{
> +       reset
> +
> +       ip netns exec $ns1 sysctl -q net.mptcp.add_addr_timeout=1
> +       ip netns exec $ns2 ip6tables -A OUTPUT -p tcp \
> +               -m tcp --tcp-option 30 \
> +               -m bpf --bytecode \
> +               "$(nfbpf_compile '(tcp[34] & 0xf0) == 0x30')" \
> +               -j DROP
> +}
> +
>   for arg in "$@"; do
>          if [ "$arg" = "-c" ]; then
>                  capture=1
> @@ -590,6 +604,22 @@ ip netns exec $ns2 ./pm_nl_ctl add dead:beef:3::2
> flags subflow
>   run_tests $ns1 $ns2 dead:beef:1::1 0 0 slow
>   chk_join_nr "single subflow IPv6" 1 1 1
> 
> +# add_addr timeout IPv6
> +reset_with_add_addr6_timeout
> +ip netns exec $ns1 ./pm_nl_ctl limits 0 1
> +ip netns exec $ns2 ./pm_nl_ctl limits 1 1
> +ip netns exec $ns1 ./pm_nl_ctl add dead:beef:2::1 flags signal
> +run_tests $ns1 $ns2 dead:beef:1::1 0 0 slow
> +chk_join_nr "signal address, ADD_ADDR6 timeout" 1 1 1
> +chk_add_nr 4 0
> +
>   # signal address IPv6
>   reset
>   ip netns exec $ns1 ./pm_nl_ctl limits 0 1
> 
> But this BPF (tcp[34] & 0xf0) == 0x30') is not working on IPv6, please
> give me some help
> about how to get this right offset value on IPv6. Thanks very much.

It looks like it cannot get the offset correctly with TCP. The best is 
then to start from the IP layer and suppose there will not be any IPv6 
extension: we control the selftests environment and we already check 
with IPTables that we have TCP.


$ docker run quay.io/casey_callendrello/nfbpf_compile RAW "(ip[54] & 
0xf0) == 0x30"
8,48 0 0 0,84 0 0 240,21 0 4 64,48 0 0 54,84 0 0 240,21 0 1 48,6 0 0 
65535,6 0 0 0


$ docker run quay.io/casey_callendrello/nfbpf_compile RAW "(ip6[74] & 
0xf0) == 0x30"
8,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,6 0 0 0


May you try with these two new bytecodes please?

Cheers,
Matt
-- 
Tessares | Belgium | Hybrid Access Solutions
www.tessares.net

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-17  0:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-16  9:28 [MPTCP] Re: [MPTCP][PATCH v5 mptcp-next 2/2] selftests: mptcp: add ADD_ADDR timeout test case Geliang Tang
2020-10-16 15:02 Matthieu Baerts
2020-10-17  0:53 Geliang Tang

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.