]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
selftests/bpf: Test TCP_NODELAY in TCP hdr opt callbacks
authorKaFai Wan <kafai.wan@linux.dev>
Tue, 21 Apr 2026 15:58:03 +0000 (23:58 +0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Wed, 22 Apr 2026 19:59:49 +0000 (12:59 -0700)
commit52b6b5334924d8f083a2abe8edeface9206e13ee
tree9392b499496c8344f84dbb6b57fd172a4b73e143
parent54377fcab51f6f1f8807827d3751be42279e1a6a
selftests/bpf: Test TCP_NODELAY in TCP hdr opt callbacks

Add a sockops selftest for the TCP_NODELAY restriction in
BPF_SOCK_OPS_HDR_OPT_LEN_CB and BPF_SOCK_OPS_WRITE_HDR_OPT_CB.

With BPF_SOCK_OPS_WRITE_HDR_OPT_CB_FLAG enabled,
bpf_setsockopt(TCP_NODELAY) returns -EOPNOTSUPP from
BPF_SOCK_OPS_HDR_OPT_LEN_CB and BPF_SOCK_OPS_WRITE_HDR_OPT_CB, avoiding
unbounded recursion and kernel stack overflow.

Other cases continue to work as before, including
BPF_SOCK_OPS_PASSIVE_ESTABLISHED_CB.

Signed-off-by: KaFai Wan <kafai.wan@linux.dev>
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Link: https://patch.msgid.link/20260421155804.135786-4-kafai.wan@linux.dev
tools/testing/selftests/bpf/prog_tests/tcp_hdr_options.c
tools/testing/selftests/bpf/progs/test_misc_tcp_hdr_options.c