public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Eric Dumazet <eric.dumazet@gmail.com>
To: Oliver Herms <oliver.peter.herms@gmail.com>, netdev@vger.kernel.org
Cc: davem@davemloft.net, kuznet@ms2.inr.ac.ru,
	yoshfuji@linux-ipv6.org, kuba@kernel.org
Subject: Re: [PATCH] IPv4: Tunnel: Fix effective path mtu calculation
Date: Wed, 24 Jun 2020 09:43:49 -0700	[thread overview]
Message-ID: <a3d6baa0-7f72-adf3-0082-df42a05858b1@gmail.com> (raw)
In-Reply-To: <20200624114852.GA153778@tws>



On 6/24/20 4:48 AM, Oliver Herms wrote:
> The calculation of the effective tunnel mtu, that is used to create
> mtu exceptions if necessary, is currently not done correctly. This
> leads to unnecessary entries in the IPv6 route cache for any packet
> to be sent through the tunnel.
> 
> The root cause is, that "dev->hard_header_len" is subtracted from the
> tunnel destinations path mtu. Thus subtracting too much, if
> dev->hard_header_len is filled in. This is that case for SIT tunnels
> where hard_header_len is the underlyings dev's hard_header_len (e.g. 14
> for ethernet) + 20 bytes IP header (see net/ipv6/sit.c:1091).
> 
> However, the MTU of the path is exclusive of the ethernet header
> and the 20 bytes for the IP header are being subtracted separately
> already. Thus hard_header_len is removed from this calculation.
> 
> For IPIP and GRE tunnels this doesn't change anything as hard_header_len
> is zero in those cases anyways.
> 
> Signed-off-by: Oliver Herms <oliver.peter.herms@gmail.com>
> ---
>  net/ipv4/ip_tunnel.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c
> index f4f1d11eab50..871d28bd29fa 100644
> --- a/net/ipv4/ip_tunnel.c
> +++ b/net/ipv4/ip_tunnel.c
> @@ -495,8 +495,7 @@ static int tnl_update_pmtu(struct net_device *dev, struct sk_buff *skb,
>  	pkt_size = skb->len - tunnel_hlen - dev->hard_header_len;
>  
>  	if (df)
> -		mtu = dst_mtu(&rt->dst) - dev->hard_header_len
> -					- sizeof(struct iphdr) - tunnel_hlen;
> +		mtu = dst_mtu(&rt->dst) - sizeof(struct iphdr) - tunnel_hlen;
>  	else
>  		mtu = skb_valid_dst(skb) ? dst_mtu(skb_dst(skb)) : dev->mtu;
>  
> 


Can you add a Fixes: tag, to help stable teams work ?

Thanks.

      reply	other threads:[~2020-06-24 16:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-24 11:48 [PATCH] IPv4: Tunnel: Fix effective path mtu calculation Oliver Herms
2020-06-24 16:43 ` Eric Dumazet [this message]

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=a3d6baa0-7f72-adf3-0082-df42a05858b1@gmail.com \
    --to=eric.dumazet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=netdev@vger.kernel.org \
    --cc=oliver.peter.herms@gmail.com \
    --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