public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Timo Teras <timo.teras@iki•fi>
To: Pravin Shelar <pshelar@nicira•com>
Cc: netdev@vger•kernel.org
Subject: Re: ip_tunnel mtu calculation
Date: Sun, 30 Jun 2013 10:46:53 +0300	[thread overview]
Message-ID: <20130630104653.2717bfde@vostro> (raw)
In-Reply-To: <CALnjE+pTXGwhePigZRyfVORkgbpwRDF1hTBRnR24fcsqvsP9ug@mail.gmail.com>

On Sat, 29 Jun 2013 21:36:39 -0700
Pravin Shelar <pshelar@nicira•com> wrote:

> On Sat, Jun 29, 2013 at 7:57 AM, Timo Teras <timo.teras@iki•fi> wrote:
> > Hi,
> >
> > I'm reviewing changes since 3.9 to net-next and observed that, the
> > tunnel refactoring had the following change in ip_gre xmit path.
> >
> > In ip_tunnel_xmit() mtu is now calculated as:
> >         if (df)
> >                 mtu = dst_mtu(&rt->dst) - dev->hard_header_len
> >                                         - sizeof(struct iphdr);
> >         else
> >                 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) :
> > dev->mtu;
> >
> > And it used to be in ip_gre.c: ipgre_tunnel_xmit():
> >         if (df)
> >                 mtu = dst_mtu(&rt->dst) - dev->hard_header_len -
> > tunnel->hlen; else
> >                 mtu = skb_dst(skb) ? dst_mtu(skb_dst(skb)) :
> > dev->mtu;
> >
> > I notice that tunnel->hlen is replaced with sizeof(struct iphdr),
> > but in case of GRE those are not the same thing. And the refactored
> > ip_gre.c does not set hard_header_len either. So it would like the
> > mtu is now miscalculated (planning to give a full test-spin for
> > net-next next week).
> >
> > It seems the tunnel->hlen used to be the full length, including
> > sizeof(struct iphdr).
> >
> > But the new, refactored code seems exclude sizeof(struct iphdr) from
> > the tunnel->hlen. So would the following be appropriate?
> >
> This is ip-tunnel layer, skb has gre header pushed. so mtu does not
> need to account gre header when compared to skb->len.
>
> But I missed one comparison for mtu check where iph->tot-len is used
> rather that skb-len, which is correct length.
>
> gre module is using iph->tot_len for pmtu check which is wrong for
> gre-tap device. This bug is there even before restructuring.
> I will send out patch for ip-tunnels code for now.

This fixes only the first part of the problem.

The mtu is sent out few lines below as ICMP message. That MTU needs to
contain also the tunnel header's length. Other wise the remote gets
wrong impression of path mtu.

- Timo

      reply	other threads:[~2013-06-30  7:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-29 14:57 ip_tunnel mtu calculation Timo Teras
2013-06-30  4:36 ` Pravin Shelar
2013-06-30  7:46   ` Timo Teras [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=20130630104653.2717bfde@vostro \
    --to=timo.teras@iki$(echo .)fi \
    --cc=netdev@vger$(echo .)kernel.org \
    --cc=pshelar@nicira$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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