From: Lina Wang <lina.wang@mediatek.com>
To: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Matthias Brugger <matthias.bgg@gmail.com>,
"Alexei Starovoitov" <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
"Andrii Nakryiko" <andrii@kernel.org>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<bpf@vger.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>, <maze@google.com>,
<willemb@google.com>, <edumazet@google.com>,
<zhuoliang.zhang@mediatek.com>, <chao.song@mediatek.com>
Subject: Re: [PATCH] net: fix wrong network header length
Date: Fri, 11 Feb 2022 12:06:29 +0800 [thread overview]
Message-ID: <20220211040629.23703-1-lina.wang@mediatek.com> (raw)
In-Reply-To: <d5dd3f10c144f7150ec508fa8e6d7a78ceabfc10.camel@redhat.com>
On Thu, 2022-02-10 at 17:02 +0100, Paolo Abeni wrote:
> > @@ -3682,6 +3682,7 @@ struct sk_buff *skb_segment_list(struct
> > sk_buff *skb,
> > struct sk_buff *tail = NULL;
> > struct sk_buff *nskb, *tmp;
> > int err;
> > + unsigned int len_diff = 0;
>
> Mintor nit: please respect the reverse x-mas tree order.
>
Yes,v2 has change unsigned int to int
> >
> > skb_push(skb, -skb_network_offset(skb) + offset);
> > @@ -3721,9 +3722,11 @@ struct sk_buff *skb_segment_list(struct
> > sk_buff *skb,
> > skb_push(nskb, -skb_network_offset(nskb) + offset);
> >
> > skb_release_head_state(nskb);
> > + len_diff = skb_network_header_len(nskb) -
> > skb_network_header_len(skb);
> > __copy_skb_header(nskb, skb);
> >
> > skb_headers_offset_update(nskb, skb_headroom(nskb) -
> > skb_headroom(skb));
> > + nskb->transport_header += len_diff;
>
> This does not look correct ?!? the network hdr position for nskb will
> still be uncorrect?!? and even the mac hdr likely?!? possibly you
> need
> to change the offset in skb_headers_offset_update().
>
Network hdr position and mac hdr are both right, because bpf processing &
skb_headers_offset_update have updated them to right position. After bpf
loading, the first skb's network header&mac_header became 44, transport
header still is 64. After skb_headers_offset_update, fraglist skb's mac
header and network header are still 24, the same with original packet.
Just fraglist skb's transport header became 44, as original is 64.
Only transport header cannot be easily updated the same offset, because
6to4 has different network header.
Actually,at the beginning, I want to change skb_headers_offset_update, but
it has been called also in other place, maybe a new function should be
needed here.
Skb_headers_offset_update has other wrong part in my scenary,
inner_transport_header\inner_network_header\inner_mac_header shouldnot be
changed, but they are been updated because of different headroom. They are
not used later, so wrong value didnot affect anything.
> Paolo
>
Thanks!
next prev parent reply other threads:[~2022-02-11 4:12 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-08 2:55 [PATCH] net: fix wrong network header length Lina Wang
2022-02-08 8:25 ` Paolo Abeni
2022-02-08 12:57 ` Maciej Żenczykowski
2022-02-08 16:01 ` Paolo Abeni
[not found] ` <5ca86c46109794a627e6e2a62b140963217984a0.camel@mediatek.com>
2022-02-10 1:06 ` Jakub Kicinski
2022-02-10 11:56 ` Lina Wang
2022-02-10 16:02 ` Paolo Abeni
2022-02-10 18:06 ` Maciej Żenczykowski
2022-02-11 4:06 ` Lina Wang [this message]
2022-02-11 5:54 ` Maciej Żenczykowski
2022-02-16 12:52 ` Lina Wang
2022-02-10 7:49 ` Steffen Klassert
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=20220211040629.23703-1-lina.wang@mediatek.com \
--to=lina.wang@mediatek.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=chao.song@mediatek.com \
--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=linux-kernel@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=maze@google.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=willemb@google.com \
--cc=yhs@fb.com \
--cc=zhuoliang.zhang@mediatek.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 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.