selftests/bpf: fix false failures
Subsystems (5)
cover selftests/bpf: fix false failures
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(-)
Signature · 1 line
2.18.1
PATCH 1/2 selftests/bpf: set rp_filter in test_flow_dissector
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.
--- tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++ 1 file changed, 3 insertions(+)
tools/testing/selftests/bpf/test_flow_dissector.sh +3 -0
@@ -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
Signature · 1 line
2.18.1
PATCH 2/2 selftests/bpf: more compatible nc options in test_lwt_ip_encap
In reply to Jiri BencOut 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.
--- tools/testing/selftests/bpf/test_lwt_ip_encap.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/test_lwt_ip_encap.sh +3 -3
@@ -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}"
Signature · 1 line
2.18.1
Re: [PATCH bpf 1/2] selftests/bpf: set rp_filter in test_flow_dissector
In reply to Jiri BencQuoted 11 lines · Jiri Benc
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 <[email protected]>Signed-off-by Jiri Benc <[email protected]>
Quoted 21 lines
--- tools/testing/selftests/bpf/test_flow_dissector.sh | 3 +++ 1 file changed, 3 insertions(+)tools/testing/selftests/bpf/test_flow_dissector.sh +3
-1@@ -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
Quoted 10 lines · Jiri Benc
The
test_flow_dissectorandtest_lwt_ip_encapselftests were failing for me. It was caused by the tests not being enough system/distro independent.Jiri Benc (2):
selftests/bpf: setrp_filterintest_flow_dissectorselftests/bpf: more compatible nc options intest_lwt_ip_encaptools/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!