public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Antonio Pastor <antonio.pastor@gmail.com>
To: Eric Dumazet <edumazet@google.com>
Cc: netdev@vger.kernel.org, pabeni@redhat.com, horms@kernel.org,
	kuba@kernel.org, "David S. Miller" <davem@davemloft.net>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2] net: llc: explicitly set skb->transport_header
Date: Tue, 24 Dec 2024 20:35:36 -0500	[thread overview]
Message-ID: <38130786-702c-4089-a518-cba7857448ca@gmail.com> (raw)
In-Reply-To: <CANn89i+jk=OWS3L1OV-aVbeO85eU6u6yK=FRoRadNEihpAOcHQ@mail.gmail.com>

On 2024-12-23 13:18, Eric Dumazet wrote:
> I see skb->transport_header being advanced at line 61 :
>
>      /* Pass the frame on. */
>      skb->transport_header += 5;

Same treatment as before? Reset after pull?

@@ -58,8 +58,8 @@ static int snap_rcv(struct sk_buff *skb, struct 
net_device *dev,
         proto = find_snap_client(skb_transport_header(skb));
         if (proto) {
                 /* Pass the frame on. */
-               skb->transport_header += 5;
                 skb_pull_rcsum(skb, 5);
+               skb_reset_transport_header(skb);
                 rc = proto->rcvfunc(skb, dev, &snap_packet_type, orig_dev);
         }
         rcu_read_unlock();

I'll submit that as a separate patch.

> Note that setting the transport header (conditionally or not) in
> __netif_receive_skb()
> is probably a mistake. Only network (ipv4, ipv6) handlers can possibly
> know the concept
> of transport header.
Not too sure about that, but I don't have specifics. Non-IP stacks are 
probably all ancient, but some might care.
> Hopefully at some point we can remove this defensive code.
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index c7f3dea3e0eb9eb05865e49dd7a8535afb974149..b6722e11ee4e171e6a2f379fc1d0197dfcb1a842
> 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -5474,8 +5474,6 @@ static int __netif_receive_skb_core(struct
> sk_buff **pskb, bool pfmemalloc,
>          orig_dev = skb->dev;
>
>          skb_reset_network_header(skb);
> -       if (!skb_transport_header_was_set(skb))
> -               skb_reset_transport_header(skb);
>          skb_reset_mac_len(skb);
>
>          pt_prev = NULL;

I don't know the code well enough to identify all possible paths after 
this point to ensure all of them set transport header. I'd expect 
IPv4/IPv6 are OK and we are making LLC whole, but don't know what else 
to test beyond that. My testing is limited to SNAP... taking that out 
requires regression testing at a level I'm not comfortable running.



  reply	other threads:[~2024-12-25  1:35 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20241220142020.1131017-1-antonio.pastor@gmail.com>
2024-12-23 13:39 ` [PATCH net v2] net: llc: explicitly set skb->transport_header Antonio Pastor
2024-12-23 13:54   ` Eric Dumazet
     [not found]     ` <c8145fd0-df13-4c6a-8678-fbf9547cc112@gmail.com>
2024-12-23 18:18       ` Eric Dumazet
2024-12-25  1:35         ` Antonio Pastor [this message]
2024-12-28  2:12           ` [PATCH net] net: 802: reset skb->transport_header Antonio Pastor
2024-12-30  8:26             ` Eric Dumazet
2025-01-03  0:18               ` Antonio Pastor
2025-01-03  1:23               ` [PATCH net v2] net: 802: LLC+SNAP OID:PID lookup on start of skb data Antonio Pastor
2025-01-03  8:46                 ` Eric Dumazet
2025-01-04 16:20                 ` patchwork-bot+netdevbpf
2024-12-25  1:07     ` [PATCH net v3] net: llc: reset skb->transport_header Antonio Pastor
2024-12-26  9:38       ` Eric Dumazet
2024-12-27 19:30       ` patchwork-bot+netdevbpf

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=38130786-702c-4089-a518-cba7857448ca@gmail.com \
    --to=antonio.pastor@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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