Skip to content

Latest commit

 

History

History
55 lines (38 loc) · 2.07 KB

bpf_ct_insert_entry.md

File metadata and controls

55 lines (38 loc) · 2.07 KB
title description
KFunc 'bpf_ct_insert_entry'
This page documents the 'bpf_ct_insert_entry' eBPF kfunc, including its defintion, usage, program types that can use it, and examples.

KFunc bpf_ct_insert_entry

:octicons-tag-24: v6.0

Add the provided entry into a CT map

Definition

This must be invoked for referenced PTR_TO_BTF_ID.

Parameters

nfct__ref: Pointer to referenced nf_conn___init object, obtained using bpf_xdp_ct_alloc or bpf_skb_ct_alloc.

#!c struct nf_conn *bpf_ct_insert_entry(struct nf_conn___init *nfct_i)

!!! note This kfunc returns a pointer to a refcounted object. The verifier will then ensure that the pointer to the object is eventually released using a release kfunc, or transferred to a map using a referenced kptr (by invoking bpf_kptr_xchg). If not, the verifier fails the loading of the BPF program until no lingering references remain in all possible explored states of the program.

!!! note The pointer returned by the kfunc may be NULL. Hence, it forces the user to do a NULL check on the pointer returned from the kfunc before making use of it (dereferencing or passing to another helper).

!!! note This kfunc releases the pointer passed in to it. There can be only one referenced pointer that can be passed in. All copies of the pointer being released are invalidated as a result of invoking this kfunc.

Usage

!!! example "Docs could be improved" This part of the docs is incomplete, contributions are very welcome

Program types

The following program types can make use of this kfunc:

Example

See bpf_ct_set_nat_info for an example of how to use this kfunc.