Skip to content

Commit 5a15a05

Browse files
pchaignoAlexei Starovoitov
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/5126ef84ba75425b689482cbc98bffe75e5d8ab0.1744102490.git.paul.chaignon@gmail.com Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent b412fd6 commit 5a15a05

File tree

2 files changed

+2
-2
lines changed
  • include/uapi/linux
  • tools/include/uapi/linux

2 files changed

+2
-2
lines changed

include/uapi/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ union bpf_attr {
20552055
* untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and
20562056
* for updates resulting in a null checksum the value is set to
20572057
* **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.
20592059
*
20602060
* This helper works in combination with **bpf_csum_diff**\ (),
20612061
* which does not update the checksum in-place, but offers more

tools/include/uapi/linux/bpf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2055,7 +2055,7 @@ union bpf_attr {
20552055
* untouched (unless **BPF_F_MARK_ENFORCE** is added as well), and
20562056
* for updates resulting in a null checksum the value is set to
20572057
* **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.
20592059
*
20602060
* This helper works in combination with **bpf_csum_diff**\ (),
20612061
* which does not update the checksum in-place, but offers more

0 commit comments

Comments
 (0)