selftests/bpf: add a test case for sock_ops perf-event notification
This patch provides a tcp_bpf based eBPF sample. The test - ncat(1) as the TCP client program to connect() to a port with the intention of triggerring SYN retransmissions: we first install an iptables DROP rule to make sure ncat SYNs are resent (instead of aborting instantly after a TCP RST) - has a bpf kernel module that sends a perf-event notification for each TCP retransmit, and also tracks the number of such notifications sent in the global_map The test passes when the number of event notifications intercepted in user-space matches the value in the global_map. Signed-off-by:Sowmini Varadhan <sowmini.varadhan@oracle.com> Signed-off-by:
Daniel Borkmann <daniel@iogearbox.net>
Showing
- tools/testing/selftests/bpf/Makefile 3 additions, 1 deletiontools/testing/selftests/bpf/Makefile
- tools/testing/selftests/bpf/test_tcpnotify.h 19 additions, 0 deletionstools/testing/selftests/bpf/test_tcpnotify.h
- tools/testing/selftests/bpf/test_tcpnotify_kern.c 95 additions, 0 deletionstools/testing/selftests/bpf/test_tcpnotify_kern.c
- tools/testing/selftests/bpf/test_tcpnotify_user.c 186 additions, 0 deletionstools/testing/selftests/bpf/test_tcpnotify_user.c
Loading
Please register or sign in to comment