Skip to content

KFunc bpf_ct_insert_entry


Add the provided entry into a CT map


This must be invoked for referenced PTR_TO_BTF_ID.


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

struct nf_conn *bpf_ct_insert_entry(struct nf_conn___init *nfct_i)


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.


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).


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.


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:


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