All of lore.kernel.org
 help / color / mirror / Atom feed
* [MPTCP] Re: [PATCH mptcp-next] selftests: mptcp: avoid calling pm_nl_ctl with bad IDs
@ 2021-03-12 16:06 Matthieu Baerts
  0 siblings, 0 replies; 2+ messages in thread
From: Matthieu Baerts @ 2021-03-12 16:06 UTC (permalink / raw)
  To: mptcp

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

Hi Geliang,

On 12/03/2021 16:27, Geliang Tang wrote:
> Hi Matt,
> 
> Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2021年3月12日周五 下午11:14写道:
> 
>>
>> IDs are supposed to be between 0 and 255.
>>
>> In pm_nl_ctl, for both the 'add' and 'get' instruction, the ID is casted
>> in a u_int8_t. So if we give 256, we will delete ID 0. Obviously, the
>> goal is not to delete this ID by giving 256.
>>
>> We could modify pm_nl_ctl and stop if the ID is negative or higher than
>> 255 but probably better not to increase the number of lines for such
>> things in this tool which is only used in selftests. Instead, we use it
>> within the limits.
>>
>> This modification also means that we will no longer add a new ID for the
>> 2nd entry. That's why we removed an expected entry from the dump and
>> introduced with
>> commit dc8eb10e95a8 ("selftests: mptcp: add testcases for setting the address ID").
>>
>> So now we delete ID 9 like before and we add entries for IDs 10 to 255
>> that are deleted just after.
>>
>> Note that this could be seen as a fix but it was not really an issue so
>> far: we were simply playing with ID 0/1 once again. With the following
>> commit ("selftests: mptcp: add addr argument for del_addr"), it will be
>> different because ID 0 is going to required an address. We don't want
>> errors when trying to delete ID 0 without the address argument.
>>
>> Signed-off-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>
> 
> Thanks for your patch.
> 
> Acked-and-tested-by: Geliang Tang <geliangtang(a)gmail.com>

Thank you for the review and the validation!

Now in our tree just before "selftests: mptcp: add testcases for setting 
the address ID" commit:

- efefe960f11c: selftests: mptcp: avoid calling pm_nl_ctl with bad IDs
- Results: 92c965f2a9d7..833f13d2c126

Tests + export are in progress!

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

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

* [MPTCP] Re: [PATCH mptcp-next] selftests: mptcp: avoid calling pm_nl_ctl with bad IDs
@ 2021-03-12 15:27 Geliang Tang
  0 siblings, 0 replies; 2+ messages in thread
From: Geliang Tang @ 2021-03-12 15:27 UTC (permalink / raw)
  To: mptcp

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

Hi Matt,

Matthieu Baerts <matthieu.baerts(a)tessares.net> 于2021年3月12日周五 下午11:14写道:

>
> IDs are supposed to be between 0 and 255.
>
> In pm_nl_ctl, for both the 'add' and 'get' instruction, the ID is casted
> in a u_int8_t. So if we give 256, we will delete ID 0. Obviously, the
> goal is not to delete this ID by giving 256.
>
> We could modify pm_nl_ctl and stop if the ID is negative or higher than
> 255 but probably better not to increase the number of lines for such
> things in this tool which is only used in selftests. Instead, we use it
> within the limits.
>
> This modification also means that we will no longer add a new ID for the
> 2nd entry. That's why we removed an expected entry from the dump and
> introduced with
> commit dc8eb10e95a8 ("selftests: mptcp: add testcases for setting the address ID").
>
> So now we delete ID 9 like before and we add entries for IDs 10 to 255
> that are deleted just after.
>
> Note that this could be seen as a fix but it was not really an issue so
> far: we were simply playing with ID 0/1 once again. With the following
> commit ("selftests: mptcp: add addr argument for del_addr"), it will be
> different because ID 0 is going to required an address. We don't want
> errors when trying to delete ID 0 without the address argument.
>
> Signed-off-by: Matthieu Baerts <matthieu.baerts(a)tessares.net>

Thanks for your patch.

Acked-and-tested-by: Geliang Tang <geliangtang(a)gmail.com>

-Geliang

> ---
>  tools/testing/selftests/net/mptcp/pm_netlink.sh | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/pm_netlink.sh b/tools/testing/selftests/net/mptcp/pm_netlink.sh
> index a617e293734c..3c741abe034e 100755
> --- a/tools/testing/selftests/net/mptcp/pm_netlink.sh
> +++ b/tools/testing/selftests/net/mptcp/pm_netlink.sh
> @@ -100,12 +100,12 @@ done
>  check "ip netns exec $ns1 ./pm_nl_ctl get 9" "id 9 flags signal 10.0.1.9" "hard addr limit"
>  check "ip netns exec $ns1 ./pm_nl_ctl get 10" "" "above hard addr limit"
>
> -for i in `seq 9 256`; do
> +ip netns exec $ns1 ./pm_nl_ctl del 9
> +for i in `seq 10 255`; do
> +       ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.9 id $i
>         ip netns exec $ns1 ./pm_nl_ctl del $i
> -       ip netns exec $ns1 ./pm_nl_ctl add 10.0.0.9 id $((i+1))
>  done
>  check "ip netns exec $ns1 ./pm_nl_ctl dump" "id 1 flags  10.0.1.1
> -id 2 flags  10.0.0.9
>  id 3 flags signal,backup 10.0.1.3
>  id 4 flags signal 10.0.1.4
>  id 5 flags signal 10.0.1.5
> --
> 2.30.2
>

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

end of thread, other threads:[~2021-03-12 16:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12 16:06 [MPTCP] Re: [PATCH mptcp-next] selftests: mptcp: avoid calling pm_nl_ctl with bad IDs Matthieu Baerts
  -- strict thread matches above, loose matches on Subject: below --
2021-03-12 15:27 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.