netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Maciej Żenczykowski" <maze@google.com>
Cc: davem@davemloft.net, netdev@vger.kernel.org, edumazet@google.com,
	pabeni@redhat.com, andrew+netdev@lunn.ch, horms@kernel.org,
	martin.lau@linux.dev, daniel@iogearbox.net,
	john.fastabend@gmail.com, eddyz87@gmail.com, sdf@fomichev.me,
	haoluo@google.com, willemb@google.com,
	william.xuanziyang@huawei.com, alan.maguire@oracle.com,
	bpf@vger.kernel.org
Subject: Re: [PATCH net] net: clear the dst when changing skb protocol
Date: Thu, 5 Jun 2025 07:01:31 -0700	[thread overview]
Message-ID: <20250605070131.53d870f6@kernel.org> (raw)
In-Reply-To: <CANP3RGc=U4g7aGfX9Hmi24FGQ0daBXLVv_S=Srk288x57amVDg@mail.gmail.com>

On Thu, 5 Jun 2025 15:50:31 +0200 Maciej Żenczykowski wrote:
> On Thu, Jun 5, 2025 at 3:22 PM Jakub Kicinski <kuba@kernel.org> wrote:
> > > I wonder if this shouldn't drop dst even when doing ipv4->ipv4 or
> > > ipv6->ipv6 -- it's encapping, presumably old dst is irrelevant...  
> >
> > I keep going back and forth on this. You definitely have a point,
> > but I feel like there are levels to how BPF prog can make the dst
> > irrelevant:
> >  - change proto
> >  - encap
> >  - adjust room but not set any encap flag
> >  - overwrite the addrs without calling any helpers
> > First case we have to cover for safety, last we can't possibly cover.
> > So the question is whether we should draw the line somewhere in
> > the middle, or leave this patch as is and if the actual use case arrives
> > - let BPF call skb_dst_drop() as a kfunc. Right now I'm leaning towards
> > the latter.
> >
> > Does that make sense? Does anyone else have an opinion?  
> 
> It does make a fair bit of sense.
> Question: does calling it as a kfunc require kernel BTF?
> Specifically some ram limited devices want to disable CONFIG_DEBUG_INFO_BTF...
> I know normal bpf helpers don't need that...
> I guess you could always convert ipv4 -> ipv6 -> ipv4 ;-)

Not sure how BPF folks feel about that, but technically we could
also add a flag to bpf_skb_adjust_room() or bpf_skb_change_proto().

  reply	other threads:[~2025-06-05 14:01 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 21:06 [PATCH net] net: clear the dst when changing skb protocol Jakub Kicinski
2025-06-04 21:21 ` Maciej Żenczykowski
2025-06-05 13:22   ` Jakub Kicinski
2025-06-05 13:50     ` Maciej Żenczykowski
2025-06-05 14:01       ` Jakub Kicinski [this message]
2025-06-06  0:09         ` Willem de Bruijn
2025-06-06  0:31           ` Jakub Kicinski
2025-06-06  9:40             ` Maciej Żenczykowski
2025-06-06 17:11               ` Jakub Kicinski
2025-06-06 17:36                 ` Maciej Żenczykowski
2025-06-06 15:55             ` Willem de Bruijn
2025-06-06 17:09               ` Jakub Kicinski
2025-06-04 21:45 ` Daniel Borkmann

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=20250605070131.53d870f6@kernel.org \
    --to=kuba@kernel.org \
    --cc=alan.maguire@oracle.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=davem@davemloft.net \
    --cc=eddyz87@gmail.com \
    --cc=edumazet@google.com \
    --cc=haoluo@google.com \
    --cc=horms@kernel.org \
    --cc=john.fastabend@gmail.com \
    --cc=martin.lau@linux.dev \
    --cc=maze@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sdf@fomichev.me \
    --cc=willemb@google.com \
    --cc=william.xuanziyang@huawei.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).