Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Clarify the meaning of BPF_F_PSEUDO_HDR

In the bpf_l4_csum_replace helper, the BPF_F_PSEUDO_HDR flag should only
be set if the modified header field is part of the pseudo-header.

If you modify for example the UDP ports and pass BPF_F_PSEUDO_HDR,
inet_proto_csum_replace4 will update skb->csum even though it shouldn't
(the port and the UDP checksum updates null each other).

Signed-off-by: Paul Chaignon <paul.chaignon@gmail.com>
Link: https://lore.kernel.org/r/5126ef84ba75425b689482cbc98bffe75e5d8ab0.1744102490.git.paul.chaignon@gmail.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Paul Chaignon and committed by
Alexei Starovoitov
5a15a050 b412fd6b

+2 -2
+1 -1
include/uapi/linux/bpf.h
··· 2055 2055 * untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and 2056 2056 * for updates resulting in a null checksum the value is set to 2057 2057 * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates 2058 - * the checksum is to be computed against a pseudo-header. 2058 + * that the modified header field is part of the pseudo-header. 2059 2059 * 2060 2060 * This helper works in combination with **bpf_csum_diff**\ (), 2061 2061 * which does not update the checksum in-place, but offers more
+1 -1
tools/include/uapi/linux/bpf.h
··· 2055 2055 * untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and 2056 2056 * for updates resulting in a null checksum the value is set to 2057 2057 * **CSUM_MANGLED_0** instead. Flag **BPF_F_PSEUDO_HDR** indicates 2058 - * the checksum is to be computed against a pseudo-header. 2058 + * that the modified header field is part of the pseudo-header. 2059 2059 * 2060 2060 * This helper works in combination with **bpf_csum_diff**\ (), 2061 2061 * which does not update the checksum in-place, but offers more