netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: xiangxia.m.yue@gmail.com
Cc: Network Development <netdev@vger.kernel.org>,
	"David S. Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>, Eric Dumazet <edumazet@google.com>,
	Antoine Tenart <atenart@kernel.org>,
	Alexander Lobakin <alexandr.lobakin@intel.com>,
	Wei Wang <weiwan@google.com>, Arnd Bergmann <arnd@arndb.de>
Subject: Re: [net v6 1/2] net: core: set skb useful vars in __bpf_tx_skb
Date: Thu, 24 Mar 2022 08:15:53 -0700	[thread overview]
Message-ID: <CAADnVQJmwCKUKbVpqa7SX8QiU1UTZVqgGAMBA4WnKKerBgPiUg@mail.gmail.com> (raw)
In-Reply-To: <20220324135653.2189-2-xiangxia.m.yue@gmail.com>

On Thu, Mar 24, 2022 at 6:57 AM <xiangxia.m.yue@gmail.com> wrote:
>
> From: Tonghao Zhang <xiangxia.m.yue@gmail.com>
>
> We may use bpf_redirect to redirect the packets to other
> netdevice (e.g. ifb) in ingress or egress path.
>
> The target netdevice may check the *skb_iif, *redirected
> and *from_ingress. For example, if skb_iif or redirected
> is 0, ifb will drop the packets.
>
> Fixes: a70b506efe89 ("bpf: enforce recursion limit on redirects")
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Jakub Kicinski <kuba@kernel.org>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: Andrii Nakryiko <andrii@kernel.org>
> Cc: Martin KaFai Lau <kafai@fb.com>
> Cc: Song Liu <songliubraving@fb.com>
> Cc: Yonghong Song <yhs@fb.com>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: KP Singh <kpsingh@kernel.org>
> Cc: Eric Dumazet <edumazet@google.com>
> Cc: Antoine Tenart <atenart@kernel.org>
> Cc: Alexander Lobakin <alexandr.lobakin@intel.com>
> Cc: Wei Wang <weiwan@google.com>
> Cc: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Tonghao Zhang <xiangxia.m.yue@gmail.com>
> ---
>  net/core/filter.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/net/core/filter.c b/net/core/filter.c
> index a7044e98765e..c1f45d2e6b0a 100644
> --- a/net/core/filter.c
> +++ b/net/core/filter.c
> @@ -2107,7 +2107,15 @@ static inline int __bpf_tx_skb(struct net_device *dev, struct sk_buff *skb)
>         }
>
>         skb->dev = dev;
> +       /* The target netdevice (e.g. ifb) may use the:
> +        * - redirected
> +        * - from_ingress
> +        */
> +#ifdef CONFIG_NET_CLS_ACT
> +       skb_set_redirected(skb, skb->tc_at_ingress);
> +#else
>         skb_clear_tstamp(skb);
> +#endif

I thought Daniel Nacked it a couple times already.
Please stop this spam.

  reply	other threads:[~2022-03-24 15:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-24 13:56 [net v6 0/2] fix bpf_redirect to ifb netdev xiangxia.m.yue
2022-03-24 13:56 ` [net v6 1/2] net: core: set skb useful vars in __bpf_tx_skb xiangxia.m.yue
2022-03-24 15:15   ` Alexei Starovoitov [this message]
2022-03-25  0:56     ` Tonghao Zhang
2022-03-30 12:00       ` Daniel Borkmann
2022-03-24 13:56 ` [net v6 2/2] selftests: bpf: add bpf_redirect to ifb xiangxia.m.yue

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=CAADnVQJmwCKUKbVpqa7SX8QiU1UTZVqgGAMBA4WnKKerBgPiUg@mail.gmail.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=alexandr.lobakin@intel.com \
    --cc=andrii@kernel.org \
    --cc=arnd@arndb.de \
    --cc=ast@kernel.org \
    --cc=atenart@kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=weiwan@google.com \
    --cc=xiangxia.m.yue@gmail.com \
    --cc=yhs@fb.com \
    /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).