]> git.baikalelectronics.ru Git - kernel.git/commit
selftests/bpf: fix race in test_tcp_rtt test
authorPetar Penkov <ppenkov@google.com>
Fri, 16 Aug 2019 17:08:25 +0000 (10:08 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Sat, 17 Aug 2019 21:16:25 +0000 (23:16 +0200)
commitfc4e8b4cbb963adf36394f711302872295746963
treeb0939375f0abb2c3e2b5688763cea97962316bdc
parent2e624eecc2fa22b67b14fbb9f523a54704bfca61
selftests/bpf: fix race in test_tcp_rtt test

There is a race in this test between receiving the ACK for the
single-byte packet sent in the test, and reading the values from the
map.

This patch fixes this by having the client wait until there are no more
unacknowledged packets.

Before:
for i in {1..1000}; do ../net/in_netns.sh ./test_tcp_rtt; \
done | grep -c PASSED
< trimmed error messages >
993

After:
for i in {1..10000}; do ../net/in_netns.sh ./test_tcp_rtt; \
done | grep -c PASSED
10000

Fixes: 422531b33b66 ("selftests/bpf: test BPF_SOCK_OPS_RTT_CB")
Signed-off-by: Petar Penkov <ppenkov@google.com>
Reviewed-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
tools/testing/selftests/bpf/test_tcp_rtt.c