netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [bpf PATCH] bpf: selftest fix for sockmap
@ 2018-06-11 18:47 John Fastabend
  2018-06-11 23:28 ` Y Song
  2018-06-13  0:31 ` Daniel Borkmann
  0 siblings, 2 replies; 4+ messages in thread
From: John Fastabend @ 2018-06-11 18:47 UTC (permalink / raw)
  To: ast, daniel; +Cc: netdev

In selftest test_maps the sockmap test case attempts to add a socket
in listening state to the sockmap. This is no longer a valid operation
so it fails as expected. However, the test wrongly reports this as an
error now. Fix the test to avoid adding sockets in listening state.

Fixes: 945ae430aa44 ("bpf: sockmap only allow ESTABLISHED sock state")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 tools/testing/selftests/bpf/test_maps.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
index 6c25334..9fed5f0 100644
--- a/tools/testing/selftests/bpf/test_maps.c
+++ b/tools/testing/selftests/bpf/test_maps.c
@@ -564,7 +564,7 @@ static void test_sockmap(int tasks, void *data)
 	}
 
 	/* Test update without programs */
-	for (i = 0; i < 6; i++) {
+	for (i = 2; i < 6; i++) {
 		err = bpf_map_update_elem(fd, &i, &sfd[i], BPF_ANY);
 		if (err) {
 			printf("Failed noprog update sockmap '%i:%i'\n",
@@ -727,7 +727,7 @@ static void test_sockmap(int tasks, void *data)
 	}
 
 	/* Test map update elem afterwards fd lives in fd and map_fd */
-	for (i = 0; i < 6; i++) {
+	for (i = 2; i < 6; i++) {
 		err = bpf_map_update_elem(map_fd_rx, &i, &sfd[i], BPF_ANY);
 		if (err) {
 			printf("Failed map_fd_rx update sockmap %i '%i:%i'\n",

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

* Re: [bpf PATCH] bpf: selftest fix for sockmap
  2018-06-11 18:47 [bpf PATCH] bpf: selftest fix for sockmap John Fastabend
@ 2018-06-11 23:28 ` Y Song
  2018-06-13  0:31 ` Daniel Borkmann
  1 sibling, 0 replies; 4+ messages in thread
From: Y Song @ 2018-06-11 23:28 UTC (permalink / raw)
  To: John Fastabend; +Cc: Alexei Starovoitov, Daniel Borkmann, netdev

On Mon, Jun 11, 2018 at 11:47 AM, John Fastabend
<john.fastabend@gmail.com> wrote:
> In selftest test_maps the sockmap test case attempts to add a socket
> in listening state to the sockmap. This is no longer a valid operation
> so it fails as expected. However, the test wrongly reports this as an
> error now. Fix the test to avoid adding sockets in listening state.
>
> Fixes: 945ae430aa44 ("bpf: sockmap only allow ESTABLISHED sock state")

I cannot reproduce the failure and I cannot find the above "Fixes" commit.
I checked latest bpf/bpf-next/net-next trees. Maybe I missed something?

> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---
>  tools/testing/selftests/bpf/test_maps.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/bpf/test_maps.c b/tools/testing/selftests/bpf/test_maps.c
> index 6c25334..9fed5f0 100644
> --- a/tools/testing/selftests/bpf/test_maps.c
> +++ b/tools/testing/selftests/bpf/test_maps.c
> @@ -564,7 +564,7 @@ static void test_sockmap(int tasks, void *data)
>         }
>
>         /* Test update without programs */
> -       for (i = 0; i < 6; i++) {
> +       for (i = 2; i < 6; i++) {
>                 err = bpf_map_update_elem(fd, &i, &sfd[i], BPF_ANY);
>                 if (err) {
>                         printf("Failed noprog update sockmap '%i:%i'\n",
> @@ -727,7 +727,7 @@ static void test_sockmap(int tasks, void *data)
>         }
>
>         /* Test map update elem afterwards fd lives in fd and map_fd */
> -       for (i = 0; i < 6; i++) {
> +       for (i = 2; i < 6; i++) {
>                 err = bpf_map_update_elem(map_fd_rx, &i, &sfd[i], BPF_ANY);
>                 if (err) {
>                         printf("Failed map_fd_rx update sockmap %i '%i:%i'\n",
>

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

* Re: [bpf PATCH] bpf: selftest fix for sockmap
  2018-06-11 18:47 [bpf PATCH] bpf: selftest fix for sockmap John Fastabend
  2018-06-11 23:28 ` Y Song
@ 2018-06-13  0:31 ` Daniel Borkmann
  2018-06-13 17:52   ` John Fastabend
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Borkmann @ 2018-06-13  0:31 UTC (permalink / raw)
  To: John Fastabend, ast; +Cc: netdev

On 06/11/2018 08:47 PM, John Fastabend wrote:
> In selftest test_maps the sockmap test case attempts to add a socket
> in listening state to the sockmap. This is no longer a valid operation
> so it fails as expected. However, the test wrongly reports this as an
> error now. Fix the test to avoid adding sockets in listening state.
> 
> Fixes: 945ae430aa44 ("bpf: sockmap only allow ESTABLISHED sock state")
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>

(fyi, discussed with John that this will be enrolled into the set of
 fixes he has pending for bpf since the test is related to the one
 restricting to ESTABLISHED state.)

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

* Re: [bpf PATCH] bpf: selftest fix for sockmap
  2018-06-13  0:31 ` Daniel Borkmann
@ 2018-06-13 17:52   ` John Fastabend
  0 siblings, 0 replies; 4+ messages in thread
From: John Fastabend @ 2018-06-13 17:52 UTC (permalink / raw)
  To: Daniel Borkmann, ast; +Cc: netdev

On 06/12/2018 05:31 PM, Daniel Borkmann wrote:
> On 06/11/2018 08:47 PM, John Fastabend wrote:
>> In selftest test_maps the sockmap test case attempts to add a socket
>> in listening state to the sockmap. This is no longer a valid operation
>> so it fails as expected. However, the test wrongly reports this as an
>> error now. Fix the test to avoid adding sockets in listening state.
>>
>> Fixes: 945ae430aa44 ("bpf: sockmap only allow ESTABLISHED sock state")
>> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> 
> (fyi, discussed with John that this will be enrolled into the set of
>  fixes he has pending for bpf since the test is related to the one
>  restricting to ESTABLISHED state.)
> 

Patch part of this series now,

https://patchwork.ozlabs.org/project/netdev/list/?series=49988

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

end of thread, other threads:[~2018-06-13 17:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-11 18:47 [bpf PATCH] bpf: selftest fix for sockmap John Fastabend
2018-06-11 23:28 ` Y Song
2018-06-13  0:31 ` Daniel Borkmann
2018-06-13 17:52   ` John Fastabend

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).