selftests/bpf: Test bpf_skb_adjust_room on CHECKSUM_PARTIAL
authorMartin KaFai Lau <martin.lau@kernel.org>
Wed, 21 Dec 2022 18:56:53 +0000 (10:56 -0800)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 21 Dec 2022 23:56:27 +0000 (00:56 +0100)
commit70a00e2f1dbae11dc3444444c6bd7555763d8421
tree6e29be63d2a63d43c51d1d0ac99fab76ffaa329f
parent54c3f1a81421f85e60ae2eaae7be3727a09916ee
selftests/bpf: Test bpf_skb_adjust_room on CHECKSUM_PARTIAL

When the bpf_skb_adjust_room() shrinks the skb such that its csum_start
is invalid, the skb->ip_summed should be reset from CHECKSUM_PARTIAL to
CHECKSUM_NONE.

The commit 54c3f1a81421 ("bpf: pull before calling skb_postpull_rcsum()")
fixed it.

This patch adds a test to ensure the skb->ip_summed changed from
CHECKSUM_PARTIAL to CHECKSUM_NONE after bpf_skb_adjust_room().

Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Stanislav Fomichev <sdf@google.com>
Link: https://lore.kernel.org/bpf/20221221185653.1589961-1-martin.lau@linux.dev
tools/testing/selftests/bpf/DENYLIST.s390x
tools/testing/selftests/bpf/prog_tests/decap_sanity.c [new file with mode: 0644]
tools/testing/selftests/bpf/progs/bpf_tracing_net.h
tools/testing/selftests/bpf/progs/decap_sanity.c [new file with mode: 0644]