Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions docs/linux/helper-function/bpf_skb_change_tail.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,9 @@ description: "This page documents the 'bpf_skb_change_tail' eBPF helper function
> Copyright (c) 2015 The Libbpf Authors. All rights reserved.


<!-- [HELPER_FUNC_DEF] -->
Resize (trim or grow) the packet associated to _skb_ to the new _len_. The _flags_ are reserved for future usage, and must be left at zero.
Resize (trim or grow) the packet associated to `skb` to the new `len`. The `flags` are reserved for future usage, and must be left at zero.

The basic idea is that the helper performs the needed work to change the size of the packet, then the eBPF program rewrites the rest via helpers like **bpf_skb_store_bytes**(), **bpf_l3_csum_replace**(), **bpf_l3_csum_replace**() and others. This helper is a slow path utility intended for replies with control messages. And because it is targeted for slow path, the helper itself can afford to be slow: it implicitly linearizes, unclones and drops offloads from the _skb_.
Comment thread
ippishio marked this conversation as resolved.
Resolved
The basic idea is that the helper performs the needed work to change the size of the packet, then the eBPF program rewrites the rest via helpers like [`bpf_skb_store_bytes`](bpf_skb_store_bytes.md), [`bpf_l3_csum_replace`](bpf_l3_csum_replace.md), [`bpf_l4_csum_replace`](bpf_l4_csum_replace.md) and others. This helper is a slow path utility intended for replies with control messages. And because it is targeted for slow path, the helper itself can afford to be slow: it implicitly <nospell>linearizes</nospell>, un-clones and drops offloads from the `skb`.

A call to this helper is susceptible to change the underlying packet buffer. Therefore, at load time, all checks on pointers previously done by the verifier are invalidated and must be performed again, if the helper is used in combination with direct packet access.

Expand All @@ -25,7 +24,7 @@ A call to this helper is susceptible to change the underlying packet buffer. The
0 on success, or a negative error in case of failure.

`#!c static long (* const bpf_skb_change_tail)(struct __sk_buff *skb, __u32 len, __u64 flags) = (void *) 38;`
<!-- [/HELPER_FUNC_DEF] -->


## Usage

Expand Down
Loading