selftests/net: test sk_filter support for SKF_NET_OFF on frags
authorWillem de Bruijn <willemb@google.com>
Tue, 8 Apr 2025 13:27:49 +0000 (09:27 -0400)
committerAlexei Starovoitov <ast@kernel.org>
Thu, 10 Apr 2025 03:02:51 +0000 (20:02 -0700)
commitfcd7132cb1f93e4d4594ecb19b8dcecdf0497d9e
tree33bbb467e9359bc65b2a5587afcb79d7e9d0e06b
parentd4bac0288a2b444e468e6df9cb4ed69479ddf14a
selftests/net: test sk_filter support for SKF_NET_OFF on frags

Verify that a classic BPF linux socket filter correctly matches
packet contents. Including when accessing contents in an
skb_frag.

1. Open a SOCK_RAW socket with a classic BPF filter on UDP dport 8000.
2. Open a tap device with IFF_NAPI_FRAGS to inject skbs with frags.
3. Send a packet for which the UDP header is in frag[0].
4. Receive this packet to demonstrate that the socket accepted it.

Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Signed-off-by: Willem de Bruijn <willemb@google.com>
Link: https://lore.kernel.org/r/20250408132833.195491-3-willemdebruijn.kernel@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
tools/testing/selftests/net/.gitignore
tools/testing/selftests/net/Makefile
tools/testing/selftests/net/skf_net_off.c [new file with mode: 0644]
tools/testing/selftests/net/skf_net_off.sh [new file with mode: 0755]