[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211217084003.dr2gv6hismpyib3y@apollo.legion>
Date: Fri, 17 Dec 2021 14:10:03 +0530
From: Kumar Kartikeya Dwivedi <memxor@...il.com>
To: Pablo Neira Ayuso <pablo@...filter.org>
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 01:48:19PM IST, Pablo Neira Ayuso wrote:
> 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
Ugh, sorry. I think I completely missed that mail, but I see it now.
I'll wait for this review cycle to conclude, and then put the code in its own
file in the next version.
Thanks.
--
Kartikeya
Powered by blists - more mailing lists