From: "Toke Høiland-Jørgensen" <toke@redhat.com>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Daniel Borkmann <daniel@iogearbox.net>,
David Ahern <dsahern@kernel.org>,
netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf v2 1/3] bpf_redirect_neigh: Support supplying the nexthop as a helper parameter
Date: Tue, 20 Oct 2020 20:08:18 +0200 [thread overview]
Message-ID: <87v9f422jx.fsf@toke.dk> (raw)
In-Reply-To: <20201020093003.6e1c7fdb@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Jakub Kicinski <kuba@kernel.org> writes:
> On Tue, 20 Oct 2020 12:51:02 +0200 Toke Høiland-Jørgensen wrote:
>> diff --git a/include/linux/filter.h b/include/linux/filter.h
>> index 20fc24c9779a..ba9de7188cd0 100644
>> --- a/include/linux/filter.h
>> +++ b/include/linux/filter.h
>> @@ -607,12 +607,21 @@ struct bpf_skb_data_end {
>> void *data_end;
>> };
>>
>> +struct bpf_nh_params {
>> + u8 nh_family;
>> + union {
>> + __u32 ipv4_nh;
>> + struct in6_addr ipv6_nh;
>> + };
>> +};
>
>> @@ -4906,6 +4910,18 @@ struct bpf_fib_lookup {
>> __u8 dmac[6]; /* ETH_ALEN */
>> };
>>
>> +struct bpf_redir_neigh {
>> + /* network family for lookup (AF_INET, AF_INET6) */
>> + __u8 nh_family;
>> + /* avoid hole in struct - must be set to 0 */
>> + __u8 unused[3];
>> + /* network address of nexthop; skips fib lookup to find gateway */
>> + union {
>> + __be32 ipv4_nh;
>> + __u32 ipv6_nh[4]; /* in6_addr; network order */
>> + };
>> +};
>
> Isn't this backward? The hole could be named in the internal structure.
> This is a bit of a gray area, but if you name this hole in uAPI and
> programs start referring to it you will never be able to reuse it.
> So you may as well not require it to be zeroed..
Hmm, yeah, suppose you're right. Doesn't the verifier prevent any part
of the memory from being unitialised anyway? I seem to recall having run
into verifier complaints when I didn't initialise struct on the stack...
-Toke
next prev parent reply other threads:[~2020-10-20 18:08 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 10:51 [PATCH bpf v2 0/3] bpf: Rework bpf_redirect_neigh() to allow supplying nexthop from caller Toke Høiland-Jørgensen
2020-10-20 10:51 ` [PATCH bpf v2 1/3] bpf_redirect_neigh: Support supplying the nexthop as a helper parameter Toke Høiland-Jørgensen
2020-10-20 15:08 ` Daniel Borkmann
2020-10-20 18:08 ` Toke Høiland-Jørgensen
2020-10-20 16:30 ` Jakub Kicinski
2020-10-20 18:08 ` Toke Høiland-Jørgensen [this message]
2020-10-20 19:01 ` Jakub Kicinski
2020-10-20 19:47 ` Daniel Borkmann
2020-10-20 18:12 ` David Ahern
2020-10-20 18:56 ` Jakub Kicinski
2020-10-20 16:34 ` Jakub Kicinski
2020-10-20 18:03 ` Toke Høiland-Jørgensen
2020-10-20 18:14 ` David Ahern
2020-10-20 18:50 ` Jakub Kicinski
2020-10-20 10:51 ` [PATCH bpf v2 2/3] bpf_fib_lookup: optionally skip neighbour lookup Toke Høiland-Jørgensen
2020-10-20 13:49 ` David Ahern
2020-10-20 15:04 ` Daniel Borkmann
2020-10-20 18:10 ` Toke Høiland-Jørgensen
2020-10-20 10:51 ` [PATCH bpf v2 3/3] selftests: Update test_tc_redirect.sh to use the modified bpf_redirect_neigh() Toke Høiland-Jørgensen
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=87v9f422jx.fsf@toke.dk \
--to=toke@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dsahern@kernel.org \
--cc=kuba@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.