[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YbxHy7yLwMQ7L0mN@salvia>
Date: Fri, 17 Dec 2021 09:18:19 +0100
From: Pablo Neira Ayuso <pablo@...filter.org>
To: Kumar Kartikeya Dwivedi <memxor@...il.com>
Cc: bpf@...r.kernel.org, netdev@...r.kernel.org,
netfilter-devel@...r.kernel.org,
Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andrii Nakryiko <andrii@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
John Fastabend <john.fastabend@...il.com>,
Maxim Mikityanskiy <maximmi@...dia.com>,
Florian Westphal <fw@...len.de>,
Jesper Dangaard Brouer <brouer@...hat.com>,
Toke Høiland-Jørgensen <toke@...hat.com>
Subject: Re: [PATCH bpf-next v4 07/10] net/netfilter: Add unstable CT lookup
helpers for XDP and TC-BPF
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@nvidia.com
>
> Signed-off-by: Kumar Kartikeya Dwivedi <memxor@...il.com>
> ---
> 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
Powered by blists - more mailing lists