Re: [PATCH bpf-next v4 07/10] net/netfilter: Add unstable CT lookup helpers for XDP and TC-BPF

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Dec 17, 2021 at 07:20:28AM +0530, Kumar Kartikeya Dwivedi wrote:
> This change adds conntrack lookup helpers using the unstable kfunc call
> interface for the XDP and TC-BPF hooks. The primary usecase is
> implementing a synproxy in XDP, see Maxim's patchset at [0].
> 
> Export get_net_ns_by_id as nf_conntrack needs to call it.
> 
> Note that we search for acquire, release, and null returning kfuncs in
> the intersection of those sets and main set.
> 
> This implies that the kfunc_btf_id_list acq_set, rel_set, null_set may
> contain BTF ID not in main set, this is explicitly allowed and
> recommended (to save on definining more and more sets), since
> check_kfunc_call verifier operation would filter out the invalid BTF ID
> fairly early, so later checks for acquire, release, and ret_type_null
> kfunc will only consider allowed BTF IDs for that program that are
> allowed in main set. This is why the nf_conntrack_acq_ids set has BTF
> IDs for both xdp and tc hook kfuncs.
> 
>   [0]: https://lore.kernel.org/bpf/20211019144655.3483197-1-maximmi@xxxxxxxxxx
> 
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@xxxxxxxxx>
> ---
>  include/linux/btf.h               |   2 +
>  kernel/bpf/btf.c                  |   1 +
>  net/core/filter.c                 |  24 +++
>  net/core/net_namespace.c          |   1 +
>  net/netfilter/nf_conntrack_core.c | 278 ++++++++++++++++++++++++++++++

Toke proposed to move it to net/netfilter/nf_conntrack_bpf.c



[Index of Archives]     [Netfitler Users]     [Berkeley Packet Filter]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux