public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail•com>
To: Daniel Borkmann <daniel@iogearbox•net>,
	dsahern@kernel•org, netdev@vger•kernel.org,
	borkmann@iogearbox•net, ast@kernel•org
Cc: davem@davemloft•net, kafai@fb•com
Subject: Re: [PATCH v2 bpf-net] bpf: Change bpf_fib_lookup to return lookup status
Date: Tue, 26 Jun 2018 07:53:41 -0600	[thread overview]
Message-ID: <f33d42e4-ec29-bb5a-967e-dbacbd8ec076@gmail.com> (raw)
In-Reply-To: <4cd62659-1b52-6746-5a37-faa01d476476@iogearbox.net>

On 6/26/18 3:50 AM, Daniel Borkmann wrote:

> [...]
> You change all the semantics of return code here, but this breaks bpf_skb_fib_lookup().
> I cannot see how this would work in that case. The code does the following with the
> bpf_ipv{4,6}_fib_lookup() return code:
> 
> [...]
>         switch (params->family) {
> #if IS_ENABLED(CONFIG_INET)
>         case AF_INET:
>                 index = bpf_ipv4_fib_lookup(net, params, flags, false);
>                 break;
> #endif
> #if IS_ENABLED(CONFIG_IPV6)
>         case AF_INET6:
>                 index = bpf_ipv6_fib_lookup(net, params, flags, false);
>                 break;
> #endif
>         }
> 
>         if (index > 0) {
>                 struct net_device *dev;
> 
>                 dev = dev_get_by_index_rcu(net, index);
>                 if (!is_skb_forwardable(dev, skb))
>                         index = 0;
>         }

Yes, I forgot to update the skb path. That should be rc now and then the
dev lookup based on params->ifindex. Will fix.

> [...]
> 
> So the BPF_FIB_LKUP_* results become the dev ifindex here and the !is_skb_forwardable()
> case further suggests that the packet *can* be forwarded based on the new semantics
> whereas MTU check is bypassed on success.
> 
> It probably helps to craft a selftest for XDP *and* tc case in future, so we can be sure
> nothing breaks with new changes.

yes, will do.

      reply	other threads:[~2018-06-26 13:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-21  3:00 [PATCH v2 bpf-net] bpf: Change bpf_fib_lookup to return lookup status dsahern
2018-06-21 17:09 ` Martin KaFai Lau
2018-06-22 15:49   ` Jesper Dangaard Brouer
2018-06-26  9:50 ` Daniel Borkmann
2018-06-26 13:53   ` David Ahern [this message]

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=f33d42e4-ec29-bb5a-967e-dbacbd8ec076@gmail.com \
    --to=dsahern@gmail$(echo .)com \
    --cc=ast@kernel$(echo .)org \
    --cc=borkmann@iogearbox$(echo .)net \
    --cc=daniel@iogearbox$(echo .)net \
    --cc=davem@davemloft$(echo .)net \
    --cc=dsahern@kernel$(echo .)org \
    --cc=kafai@fb$(echo .)com \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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