From: Martin KaFai Lau <martin.lau@linux.dev>
To: Daniel Borkmann <daniel@iogearbox.net>
Cc: bpf@vger.kernel.org, 'Alexei Starovoitov ' <ast@kernel.org>,
'Andrii Nakryiko ' <andrii@kernel.org>,
netdev@vger.kernel.org, kernel-team@meta.com
Subject: Re: [PATCH bpf-next 3/4] bpf: Add BPF_FIB_LOOKUP_SKIP_NEIGH for bpf_fib_lookup
Date: Fri, 17 Feb 2023 09:13:11 -0800 [thread overview]
Message-ID: <16cc33fe-4759-0a7b-1e03-0d77d2f79351@linux.dev> (raw)
In-Reply-To: <dd4e2b92-53c9-6973-86ff-8cb04913c3ca@iogearbox.net>
On 2/17/23 8:00 AM, Daniel Borkmann wrote:
>> diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h
>> index 1503f61336b6..6c1956e36c97 100644
>> --- a/include/uapi/linux/bpf.h
>> +++ b/include/uapi/linux/bpf.h
> [...]
>> @@ -5838,21 +5836,28 @@ static int bpf_ipv4_fib_lookup(struct net *net, struct
>> bpf_fib_lookup *params,
>> if (likely(nhc->nhc_gw_family != AF_INET6)) {
>> if (nhc->nhc_gw_family)
>> params->ipv4_dst = nhc->nhc_gw.ipv4;
>> -
>> - neigh = __ipv4_neigh_lookup_noref(dev,
>> - (__force u32)params->ipv4_dst);
>> } else {
>> struct in6_addr *dst = (struct in6_addr *)params->ipv6_dst;
>> params->family = AF_INET6;
>> *dst = nhc->nhc_gw.ipv6;
>> - neigh = __ipv6_neigh_lookup_noref_stub(dev, dst);
>> }
>> + if (flags & BPF_FIB_LOOKUP_SKIP_NEIGH)
>> + goto set_fwd_params;
>> +
>> + if (params->family == AF_INET6)
>
> Nit, would have probably more intuitive to keep the same test also here
> (nhc->nhc_gw_family != AF_INET6), but either way, lgtm.
Ack.
>
> Are you still required to fill the params->smac in bpf_fib_set_fwd_params()
> in that case, meaning, shouldn't bpf_redirect_neigh() take care of it as well
> from neigh_output()? Looks unnecessary and could be moved out too.
Good point. will move it out from bpf_fib_set_fwd_params also. Thanks for the
review.
next prev parent reply other threads:[~2023-02-17 17:13 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-17 0:41 [PATCH bpf-next 0/4] bpf: A fix and a change to bpf_fib_lookup Martin KaFai Lau
2023-02-17 0:41 ` [PATCH bpf-next 1/4] bpf: Disable bh in bpf_test_run for xdp and tc prog Martin KaFai Lau
2023-02-17 0:41 ` [PATCH bpf-next 2/4] bpf: bpf_fib_lookup should not return neigh in NUD_FAILED state Martin KaFai Lau
2023-02-17 0:41 ` [PATCH bpf-next 3/4] bpf: Add BPF_FIB_LOOKUP_SKIP_NEIGH for bpf_fib_lookup Martin KaFai Lau
2023-02-17 16:00 ` Daniel Borkmann
2023-02-17 17:13 ` Martin KaFai Lau [this message]
2023-02-17 0:41 ` [PATCH bpf-next 4/4] selftests/bpf: Add bpf_fib_lookup test Martin KaFai Lau
2023-02-17 23:02 ` Andrii Nakryiko
2023-02-17 23:08 ` Martin KaFai Lau
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=16cc33fe-4759-0a7b-1e03-0d77d2f79351@linux.dev \
--to=martin.lau@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@meta.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).