From: Steffen Klassert <steffen.klassert@secunet.com>
To: Lina Wang <lina.wang@mediatek.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
"David Ahern" <dsahern@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
"Matthias Brugger" <matthias.bgg@gmail.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH] xfrm: fix tunnel model fragmentation behavior
Date: Wed, 23 Feb 2022 09:31:55 +0100 [thread overview]
Message-ID: <20220223083155.GM17351@gauss3.secunet.de> (raw)
In-Reply-To: <20220221051648.22660-1-lina.wang@mediatek.com>
On Mon, Feb 21, 2022 at 01:16:48PM +0800, Lina Wang wrote:
> in tunnel mode, if outer interface(ipv4) is less, it is easily to let
> inner IPV6 mtu be less than 1280. If so, a Packet Too Big ICMPV6 message
> is received. When send again, packets are fragmentized with 1280, they
> are still rejected with ICMPV6(Packet Too Big) by xfrmi_xmit2().
>
> According to RFC4213 Section3.2.2:
> if (IPv4 path MTU - 20) is less than 1280
> if packet is larger than 1280 bytes
> Send ICMPv6 "packet too big" with MTU = 1280.
> Drop packet.
> else
> Encapsulate but do not set the Don't Fragment
> flag in the IPv4 header. The resulting IPv4
> packet might be fragmented by the IPv4 layer
> on the encapsulator or by some router along
> the IPv4 path.
> endif
> else
> if packet is larger than (IPv4 path MTU - 20)
> Send ICMPv6 "packet too big" with
> MTU = (IPv4 path MTU - 20).
> Drop packet.
> else
> Encapsulate and set the Don't Fragment flag
> in the IPv4 header.
> endif
> endif
> Packets should be fragmentized with ipv4 outer interface, so change it.
>
> After it is fragemtized with ipv4, there will be double fragmenation.
> No.48 & No.51 are ipv6 fragment packets, No.48 is double fragmentized,
> then tunneled with IPv4(No.49& No.50), which obey spec. And received peer
> cannot decrypt it rightly.
>
> 48 2002::10 2002::11 1296(length) IPv6 fragment (off=0 more=y ident=0xa20da5bc nxt=50)
> 49 0x0000 (0) 2002::10 2002::11 1304 IPv6 fragment (off=0 more=y ident=0x7448042c nxt=44)
> 50 0x0000 (0) 2002::10 2002::11 200 ESP (SPI=0x00035000)
> 51 2002::10 2002::11 180 Echo (ping) request
> 52 0x56dc 2002::10 2002::11 248 IPv6 fragment (off=1232 more=n ident=0xa20da5bc nxt=50)
>
> esp_noneed_fragment has fixed above issues. Finally, it acted like below:
> 1 0x6206 192.168.1.138 192.168.1.1 1316 Fragmented IP protocol (proto=Encap Security Payload 50, off=0, ID=6206) [Reassembled in #2]
> 2 0x6206 2002::10 2002::11 88 IPv6 fragment (off=0 more=y ident=0x1f440778 nxt=50)
> 3 0x0000 2002::10 2002::11 248 ICMPv6 Echo (ping) request
>
> Signed-off-by: Lina Wang <lina.wang@mediatek.com>
Can you please add a 'Fixes' tag?
> ---
> net/ipv6/xfrm6_output.c | 16 ++++++++++++++++
> net/xfrm/xfrm_interface.c | 5 ++++-
> 2 files changed, 20 insertions(+), 1 deletion(-)
>
> diff --git a/net/ipv6/xfrm6_output.c b/net/ipv6/xfrm6_output.c
> index d0d280077721..ab4384e22b4f 100644
> --- a/net/ipv6/xfrm6_output.c
> +++ b/net/ipv6/xfrm6_output.c
> @@ -45,6 +45,19 @@ static int __xfrm6_output_finish(struct net *net, struct sock *sk, struct sk_buf
> return xfrm_output(sk, skb);
> }
>
> +static int esp_noneed_fragment(struct sk_buff *skb)
> +{
> + struct frag_hdr *fh;
> + u8 prevhdr = ipv6_hdr(skb)->nexthdr;
> +
> + if (prevhdr != NEXTHDR_FRAGMENT)
> + return 0;
> + fh = (struct frag_hdr *)(skb->data + sizeof(struct ipv6hdr));
> + if (fh->nexthdr == NEXTHDR_ESP)
> + return 1;
Shouldn't this problem exist for NEXTHDR_AUTH too?
next prev parent reply other threads:[~2022-02-23 8:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-21 5:16 Lina Wang
2022-02-21 11:04 ` Steffen Klassert
2022-02-22 2:18 ` Lina Wang
2022-02-23 8:25 ` Steffen Klassert
2022-02-23 8:31 ` Steffen Klassert [this message]
2022-02-24 6:15 ` Lina Wang
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=20220223083155.GM17351@gauss3.secunet.de \
--to=steffen.klassert@secunet.com \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=herbert@gondor.apana.org.au \
--cc=kuba@kernel.org \
--cc=lina.wang@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthias.bgg@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.org \
/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
all inboxes | Powered by JetHome®