bpf, sockmap: Test FIONREAD returns correct bytes in rx buffer
authorJohn Fastabend <john.fastabend@gmail.com>
Tue, 23 May 2023 02:56:16 +0000 (19:56 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Tue, 23 May 2023 14:11:13 +0000 (16:11 +0200)
commitbb516f98c731cafe27900f43c0ef0aa7b5a9a44b
treea39f25da84739da53744a21552f01ee5d4237729
parent1fa1fe8ff161cc34620e31295235dc1e6d0dce77
bpf, sockmap: Test FIONREAD returns correct bytes in rx buffer

A bug was reported where ioctl(FIONREAD) returned zero even though the
socket with a SK_SKB verdict program attached had bytes in the msg
queue. The result is programs may hang or more likely try to recover,
but use suboptimal buffer sizes.

Add a test to check that ioctl(FIONREAD) returns the correct number of
bytes.

Signed-off-by: John Fastabend <john.fastabend@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/bpf/20230523025618.113937-13-john.fastabend@gmail.com
tools/testing/selftests/bpf/prog_tests/sockmap_basic.c