summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/test_progs.c
diff options
context:
space:
mode:
authorKui-Feng Lee <thinker.li@gmail.com>2024-08-15 08:32:49 +0300
committerMartin KaFai Lau <martin.lau@kernel.org>2024-08-15 21:33:44 +0300
commitf52403b6bfea6994b017c58367aee9acdb9d9fd4 (patch)
treec37aef1e9234065b8baa55e1961475ea6789709e /tools/testing/selftests/bpf/test_progs.c
parentb97ce54743e598f4883697534496b27288b6e752 (diff)
downloadlinux-f52403b6bfea6994b017c58367aee9acdb9d9fd4.tar.xz
selftests/bpf: Add traffic monitor functions.
Add functions that capture packets and print log in the background. They are supposed to be used for debugging flaky network test cases. A monitored test case should call traffic_monitor_start() to start a thread to capture packets in the background for a given namespace and call traffic_monitor_stop() to stop capturing. (Or, option '-m' implemented by the later patches.) lo In IPv4 127.0.0.1:40265 > 127.0.0.1:55907: TCP, length 68, SYN lo In IPv4 127.0.0.1:55907 > 127.0.0.1:40265: TCP, length 60, SYN, ACK lo In IPv4 127.0.0.1:40265 > 127.0.0.1:55907: TCP, length 60, ACK lo In IPv4 127.0.0.1:55907 > 127.0.0.1:40265: TCP, length 52, ACK lo In IPv4 127.0.0.1:40265 > 127.0.0.1:55907: TCP, length 52, FIN, ACK lo In IPv4 127.0.0.1:55907 > 127.0.0.1:40265: TCP, length 52, RST, ACK Packet file: packets-2173-86-select_reuseport:sockhash_IPv4_TCP_LOOPBACK_test_detach_bpf-test.log #280/87 select_reuseport/sockhash IPv4/TCP LOOPBACK test_detach_bpf:OK The above is the output of an example. It shows the packets of a connection and the name of the file that contains captured packets in the directory /tmp/tmon_pcap. The file can be loaded by tcpdump or wireshark. This feature only works if libpcap is available. (Could be found by pkg-config) Acked-by: Stanislav Fomichev <sdf@fomichev.me> Signed-off-by: Kui-Feng Lee <thinker.li@gmail.com> Link: https://lore.kernel.org/r/20240815053254.470944-2-thinker.li@gmail.com Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/test_progs.c')
0 files changed, 0 insertions, 0 deletions