Skip to content

Commit b412fd6

Browse files
pchaignoAlexei Starovoitov
authored andcommitted
bpf: Clarify role of BPF_F_RECOMPUTE_CSUM
BPF_F_RECOMPUTE_CSUM doesn't update the actual L3 and L4 checksums in the packet, but simply updates skb->csum (according to skb->ip_summed). This patch clarifies that to avoid confusions. Signed-off-by: Paul Chaignon <[email protected]> Link: https://lore.kernel.org/r/ff6895d42936f03dbb82334d8bcfd50e00c79086.1744102490.git.paul.chaignon@gmail.com Signed-off-by: Alexei Starovoitov <[email protected]>
1 parent 690d43d commit b412fd6

File tree

2 files changed

+18
-10
lines changed
  • include/uapi/linux
  • tools/include/uapi/linux

2 files changed

+18
-10
lines changed

include/uapi/linux/bpf.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,11 +1995,15 @@ union bpf_attr {
19951995
* long bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags)
19961996
* Description
19971997
* Store *len* bytes from address *from* into the packet
1998-
* associated to *skb*, at *offset*. *flags* are a combination of
1999-
* **BPF_F_RECOMPUTE_CSUM** (automatically recompute the
2000-
* checksum for the packet after storing the bytes) and
2001-
* **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
2002-
* **->swhash** and *skb*\ **->l4hash** to 0).
1998+
* associated to *skb*, at *offset*. The *flags* are a combination
1999+
* of the following values:
2000+
*
2001+
* **BPF_F_RECOMPUTE_CSUM**
2002+
* Automatically update *skb*\ **->csum** after storing the
2003+
* bytes.
2004+
* **BPF_F_INVALIDATE_HASH**
2005+
* Set *skb*\ **->hash**, *skb*\ **->swhash** and *skb*\
2006+
* **->l4hash** to 0.
20032007
*
20042008
* A call to this helper is susceptible to change the underlying
20052009
* packet buffer. Therefore, at load time, all checks on pointers

tools/include/uapi/linux/bpf.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1995,11 +1995,15 @@ union bpf_attr {
19951995
* long bpf_skb_store_bytes(struct sk_buff *skb, u32 offset, const void *from, u32 len, u64 flags)
19961996
* Description
19971997
* Store *len* bytes from address *from* into the packet
1998-
* associated to *skb*, at *offset*. *flags* are a combination of
1999-
* **BPF_F_RECOMPUTE_CSUM** (automatically recompute the
2000-
* checksum for the packet after storing the bytes) and
2001-
* **BPF_F_INVALIDATE_HASH** (set *skb*\ **->hash**, *skb*\
2002-
* **->swhash** and *skb*\ **->l4hash** to 0).
1998+
* associated to *skb*, at *offset*. The *flags* are a combination
1999+
* of the following values:
2000+
*
2001+
* **BPF_F_RECOMPUTE_CSUM**
2002+
* Automatically update *skb*\ **->csum** after storing the
2003+
* bytes.
2004+
* **BPF_F_INVALIDATE_HASH**
2005+
* Set *skb*\ **->hash**, *skb*\ **->swhash** and *skb*\
2006+
* **->l4hash** to 0.
20032007
*
20042008
* A call to this helper is susceptible to change the underlying
20052009
* packet buffer. Therefore, at load time, all checks on pointers

0 commit comments

Comments
 (0)