BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH bpf 0/2] selftests/bpf: fix false failures
@ 2019-10-08 13:10 Jiri Benc
  2019-10-08 13:10 ` [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector Jiri Benc
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Jiri Benc @ 2019-10-08 13:10 UTC (permalink / raw)
  To: bpf, netdev

The test_flow_dissector and test_lwt_ip_encap selftests were failing for me.
It was caused by the tests not being enough system/distro independent.

Jiri Benc (2):
  selftests/bpf: set rp_filter in test_flow_dissector
  selftests/bpf: more compatible nc options in test_lwt_ip_encap

 tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++
 tools/testing/selftests/bpf/test_lwt_ip_encap.sh   | 6 +++---
 2 files changed, 6 insertions(+), 3 deletions(-)

-- 
2.18.1


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

* [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector
  2019-10-08 13:10 [PATCH bpf 0/2] selftests/bpf: fix false failures Jiri Benc
@ 2019-10-08 13:10 ` Jiri Benc
  2019-10-08 16:45   ` Petar Penkov
  2019-10-08 13:10 ` [PATCH bpf 2/2] selftests/bpf: more compatible nc options in test_lwt_ip_encap Jiri Benc
  2019-10-08 22:03 ` [PATCH bpf 0/2] selftests/bpf: fix false failures Daniel Borkmann
  2 siblings, 1 reply; 5+ messages in thread
From: Jiri Benc @ 2019-10-08 13:10 UTC (permalink / raw)
  To: bpf, netdev; +Cc: Petar Penkov

Many distributions enable rp_filter. However, the flow dissector test
generates packets that have 1.1.1.1 set as (inner) source address without
this address being reachable. This causes the selftest to fail.

The selftests should not assume a particular initial configuration. Switch
off rp_filter.

Fixes: 50b3ed57dee9 ("selftests/bpf: test bpf flow dissection")
Cc: Petar Penkov <ppenkov@google.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/testing/selftests/bpf/test_flow_dissector.sh b/tools/testing/selftests/bpf/test_flow_dissector.sh
index d23d4da66b83..e2d06191bd35 100755
--- a/tools/testing/selftests/bpf/test_flow_dissector.sh
+++ b/tools/testing/selftests/bpf/test_flow_dissector.sh
@@ -63,6 +63,9 @@ fi
 
 # Setup
 tc qdisc add dev lo ingress
+echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter
+echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
+echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
 
 echo "Testing IPv4..."
 # Drops all IP/UDP packets coming from port 9
-- 
2.18.1


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

* [PATCH bpf 2/2] selftests/bpf: more compatible nc options in test_lwt_ip_encap
  2019-10-08 13:10 [PATCH bpf 0/2] selftests/bpf: fix false failures Jiri Benc
  2019-10-08 13:10 ` [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector Jiri Benc
@ 2019-10-08 13:10 ` Jiri Benc
  2019-10-08 22:03 ` [PATCH bpf 0/2] selftests/bpf: fix false failures Daniel Borkmann
  2 siblings, 0 replies; 5+ messages in thread
From: Jiri Benc @ 2019-10-08 13:10 UTC (permalink / raw)
  To: bpf, netdev; +Cc: Peter Oskolkov

Out of the three nc implementations widely in use, at least two (BSD netcat
and nmap-ncat) do not support -l combined with -s. Modify the nc invocation
to be accepted by all of them.

Fixes: 17a90a788473 ("selftests/bpf: test that GSO works in lwt_ip_encap")
Cc: Peter Oskolkov <posk@google.com>
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 tools/testing/selftests/bpf/test_lwt_ip_encap.sh | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh
index acf7a74f97cd..59ea56945e6c 100755
--- a/tools/testing/selftests/bpf/test_lwt_ip_encap.sh
+++ b/tools/testing/selftests/bpf/test_lwt_ip_encap.sh
@@ -314,15 +314,15 @@ test_gso()
 	command -v nc >/dev/null 2>&1 || \
 		{ echo >&2 "nc is not available: skipping TSO tests"; return; }
 
-	# listen on IPv*_DST, capture TCP into $TMPFILE
+	# listen on port 9000, capture TCP into $TMPFILE
 	if [ "${PROTO}" == "IPv4" ] ; then
 		IP_DST=${IPv4_DST}
 		ip netns exec ${NS3} bash -c \
-			"nc -4 -l -s ${IPv4_DST} -p 9000 > ${TMPFILE} &"
+			"nc -4 -l -p 9000 > ${TMPFILE} &"
 	elif [ "${PROTO}" == "IPv6" ] ; then
 		IP_DST=${IPv6_DST}
 		ip netns exec ${NS3} bash -c \
-			"nc -6 -l -s ${IPv6_DST} -p 9000 > ${TMPFILE} &"
+			"nc -6 -l -p 9000 > ${TMPFILE} &"
 		RET=$?
 	else
 		echo "    test_gso: unknown PROTO: ${PROTO}"
-- 
2.18.1


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

* Re: [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector
  2019-10-08 13:10 ` [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector Jiri Benc
@ 2019-10-08 16:45   ` Petar Penkov
  0 siblings, 0 replies; 5+ messages in thread
From: Petar Penkov @ 2019-10-08 16:45 UTC (permalink / raw)
  To: Jiri Benc; +Cc: bpf, Networking, Petar Penkov

On Tue, Oct 8, 2019 at 6:11 AM Jiri Benc <jbenc@redhat.com> wrote:
>
> Many distributions enable rp_filter. However, the flow dissector test
> generates packets that have 1.1.1.1 set as (inner) source address without
> this address being reachable. This causes the selftest to fail.
>
> The selftests should not assume a particular initial configuration. Switch
> off rp_filter.
>
> Fixes: 50b3ed57dee9 ("selftests/bpf: test bpf flow dissection")
> Cc: Petar Penkov <ppenkov@google.com>
> Signed-off-by: Jiri Benc <jbenc@redhat.com>

Acked-by: Petar Penkov <ppenkov@google.com>

> ---
>  tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/tools/testing/selftests/bpf/test_flow_dissector.sh b/tools/testing/selftests/bpf/test_flow_dissector.sh
> index d23d4da66b83..e2d06191bd35 100755
> --- a/tools/testing/selftests/bpf/test_flow_dissector.sh
> +++ b/tools/testing/selftests/bpf/test_flow_dissector.sh
> @@ -63,6 +63,9 @@ fi
>
>  # Setup
>  tc qdisc add dev lo ingress
> +echo 0 > /proc/sys/net/ipv4/conf/default/rp_filter
> +echo 0 > /proc/sys/net/ipv4/conf/all/rp_filter
> +echo 0 > /proc/sys/net/ipv4/conf/lo/rp_filter
>
>  echo "Testing IPv4..."
>  # Drops all IP/UDP packets coming from port 9
> --
> 2.18.1
>

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

* Re: [PATCH bpf 0/2] selftests/bpf: fix false failures
  2019-10-08 13:10 [PATCH bpf 0/2] selftests/bpf: fix false failures Jiri Benc
  2019-10-08 13:10 ` [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector Jiri Benc
  2019-10-08 13:10 ` [PATCH bpf 2/2] selftests/bpf: more compatible nc options in test_lwt_ip_encap Jiri Benc
@ 2019-10-08 22:03 ` Daniel Borkmann
  2 siblings, 0 replies; 5+ messages in thread
From: Daniel Borkmann @ 2019-10-08 22:03 UTC (permalink / raw)
  To: Jiri Benc; +Cc: bpf, netdev

On Tue, Oct 08, 2019 at 03:10:43PM +0200, Jiri Benc wrote:
> The test_flow_dissector and test_lwt_ip_encap selftests were failing for me.
> It was caused by the tests not being enough system/distro independent.
> 
> Jiri Benc (2):
>   selftests/bpf: set rp_filter in test_flow_dissector
>   selftests/bpf: more compatible nc options in test_lwt_ip_encap
> 
>  tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++
>  tools/testing/selftests/bpf/test_lwt_ip_encap.sh   | 6 +++---
>  2 files changed, 6 insertions(+), 3 deletions(-)

Applied, thanks!

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

end of thread, back to index

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-08 13:10 [PATCH bpf 0/2] selftests/bpf: fix false failures Jiri Benc
2019-10-08 13:10 ` [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector Jiri Benc
2019-10-08 16:45   ` Petar Penkov
2019-10-08 13:10 ` [PATCH bpf 2/2] selftests/bpf: more compatible nc options in test_lwt_ip_encap Jiri Benc
2019-10-08 22:03 ` [PATCH bpf 0/2] selftests/bpf: fix false failures Daniel Borkmann

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org bpf@archiver.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/ public-inbox