bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bpf: selftests build error in sockmap_basic.c
@ 2020-02-10  5:44 John Fastabend
  2020-02-10  9:59 ` Jakub Sitnicki
  0 siblings, 1 reply; 3+ messages in thread
From: John Fastabend @ 2020-02-10  5:44 UTC (permalink / raw)
  To: alexei.starovoitov, jakub; +Cc: netdev, bpf, john.fastabend, daniel

Fix following build error. We could push a tcp.h header into one of the
include paths, but I think its easy enough to simply pull in the three
defines we need here. If we end up using more of tcp.h at some point
we can pull it in later.

/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function ‘connected_socket_v4’:
/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: error: ‘TCP_REPAIR_ON’ undeclared (first use in this function)
  repair = TCP_REPAIR_ON;
           ^
/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
/home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:29:11: error: ‘TCP_REPAIR_OFF_NO_WP’ undeclared (first use in this function)
  repair = TCP_REPAIR_OFF_NO_WP;

Then with fix,

$ ./test_progs -n 44
#44/1 sockmap create_update_free:OK
#44/2 sockhash create_update_free:OK
#44 sockmap_basic:OK

Fixes: 5d3919a953c3c ("selftests/bpf: Test freeing sockmap/sockhash with a socket in it")
Signed-off-by: John Fastabend <john.fastabend@gmail.com>
---
 .../selftests/bpf/prog_tests/sockmap_basic.c       |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
index 07f5b46..aa43e0b 100644
--- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
+++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
@@ -3,6 +3,11 @@
 
 #include "test_progs.h"
 
+#define TCP_REPAIR		19	/* TCP sock is under repair right now */
+
+#define TCP_REPAIR_ON		1
+#define TCP_REPAIR_OFF_NO_WP	-1	/* Turn off without window probes */
+
 static int connected_socket_v4(void)
 {
 	struct sockaddr_in addr = {


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

* Re: [PATCH] bpf: selftests build error in sockmap_basic.c
  2020-02-10  5:44 [PATCH] bpf: selftests build error in sockmap_basic.c John Fastabend
@ 2020-02-10  9:59 ` Jakub Sitnicki
  2020-02-10 22:33   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: Jakub Sitnicki @ 2020-02-10  9:59 UTC (permalink / raw)
  To: John Fastabend; +Cc: alexei.starovoitov, netdev, bpf, daniel

On Mon, Feb 10, 2020 at 05:44 AM GMT, John Fastabend wrote:
> Fix following build error. We could push a tcp.h header into one of the
> include paths, but I think its easy enough to simply pull in the three
> defines we need here. If we end up using more of tcp.h at some point
> we can pull it in later.
>
> /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function ‘connected_socket_v4’:
> /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: error: ‘TCP_REPAIR_ON’ undeclared (first use in this function)
>   repair = TCP_REPAIR_ON;
>            ^
> /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
> /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:29:11: error: ‘TCP_REPAIR_OFF_NO_WP’ undeclared (first use in this function)
>   repair = TCP_REPAIR_OFF_NO_WP;
>
> Then with fix,
>
> $ ./test_progs -n 44
> #44/1 sockmap create_update_free:OK
> #44/2 sockhash create_update_free:OK
> #44 sockmap_basic:OK
>
> Fixes: 5d3919a953c3c ("selftests/bpf: Test freeing sockmap/sockhash with a socket in it")
> Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> ---
>  .../selftests/bpf/prog_tests/sockmap_basic.c       |    5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> index 07f5b46..aa43e0b 100644
> --- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> @@ -3,6 +3,11 @@
>
>  #include "test_progs.h"
>
> +#define TCP_REPAIR		19	/* TCP sock is under repair right now */
> +
> +#define TCP_REPAIR_ON		1
> +#define TCP_REPAIR_OFF_NO_WP	-1	/* Turn off without window probes */
> +
>  static int connected_socket_v4(void)
>  {
>  	struct sockaddr_in addr = {

Neat, I haven't thought of that. Thank you for fixing up my mistake.

Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>

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

* Re: [PATCH] bpf: selftests build error in sockmap_basic.c
  2020-02-10  9:59 ` Jakub Sitnicki
@ 2020-02-10 22:33   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-02-10 22:33 UTC (permalink / raw)
  To: Jakub Sitnicki; +Cc: John Fastabend, Network Development, bpf, Daniel Borkmann

On Mon, Feb 10, 2020 at 1:59 AM Jakub Sitnicki <jakub@cloudflare.com> wrote:
>
> On Mon, Feb 10, 2020 at 05:44 AM GMT, John Fastabend wrote:
> > Fix following build error. We could push a tcp.h header into one of the
> > include paths, but I think its easy enough to simply pull in the three
> > defines we need here. If we end up using more of tcp.h at some point
> > we can pull it in later.
> >
> > /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c: In function ‘connected_socket_v4’:
> > /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: error: ‘TCP_REPAIR_ON’ undeclared (first use in this function)
> >   repair = TCP_REPAIR_ON;
> >            ^
> > /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:20:11: note: each undeclared identifier is reported only once for each function it appears in
> > /home/john/git/bpf/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c:29:11: error: ‘TCP_REPAIR_OFF_NO_WP’ undeclared (first use in this function)
> >   repair = TCP_REPAIR_OFF_NO_WP;
> >
> > Then with fix,
> >
> > $ ./test_progs -n 44
> > #44/1 sockmap create_update_free:OK
> > #44/2 sockhash create_update_free:OK
> > #44 sockmap_basic:OK
> >
> > Fixes: 5d3919a953c3c ("selftests/bpf: Test freeing sockmap/sockhash with a socket in it")
> > Signed-off-by: John Fastabend <john.fastabend@gmail.com>
> > ---
> >  .../selftests/bpf/prog_tests/sockmap_basic.c       |    5 +++++
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> > index 07f5b46..aa43e0b 100644
> > --- a/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> > +++ b/tools/testing/selftests/bpf/prog_tests/sockmap_basic.c
> > @@ -3,6 +3,11 @@
> >
> >  #include "test_progs.h"
> >
> > +#define TCP_REPAIR           19      /* TCP sock is under repair right now */
> > +
> > +#define TCP_REPAIR_ON                1
> > +#define TCP_REPAIR_OFF_NO_WP -1      /* Turn off without window probes */
> > +
> >  static int connected_socket_v4(void)
> >  {
> >       struct sockaddr_in addr = {
>
> Neat, I haven't thought of that. Thank you for fixing up my mistake.
>
> Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>

I also think this is the better approach.
Applied. Thanks.

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

end of thread, other threads:[~2020-02-10 22:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-10  5:44 [PATCH] bpf: selftests build error in sockmap_basic.c John Fastabend
2020-02-10  9:59 ` Jakub Sitnicki
2020-02-10 22:33   ` Alexei Starovoitov

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).