netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* The check of upper MTU limit when changing it in ip6 gre tunnel seems incorrect.
@ 2013-10-02 16:44 Oussama Ghorbel
  2013-10-04  9:58 ` Oussama Ghorbel
  0 siblings, 1 reply; 2+ messages in thread
From: Oussama Ghorbel @ 2013-10-02 16:44 UTC (permalink / raw)
  To: netdev

The check of upper MTU limit when changing it in ip6 gre tunnel seems incorrect.
The function in question is:

static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
{
    struct ip6_tnl *tunnel = netdev_priv(dev);

    if (new_mtu < 68 ||
        new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen)
        return -EINVAL;
    dev->mtu = new_mtu;
    return 0;
}

However the dev->hard_header_len and tunnel->hlen are initialized in
the following way in ip6gre_tnl_link_config():

int addend = sizeof(struct ipv6hdr) + 4;
...
dev->hard_header_len = rt->dst.dev->hard_header_len + addend;
...
t->hlen = addend; // t is ip6_tnl pointer

As you see the information t->hlen is already included in
dev->hard_header_len, so why calculate it twice?

Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: The check of upper MTU limit when changing it in ip6 gre tunnel seems incorrect.
  2013-10-02 16:44 The check of upper MTU limit when changing it in ip6 gre tunnel seems incorrect Oussama Ghorbel
@ 2013-10-04  9:58 ` Oussama Ghorbel
  0 siblings, 0 replies; 2+ messages in thread
From: Oussama Ghorbel @ 2013-10-04  9:58 UTC (permalink / raw)
  To: netdev

I have sent this patch to address the issue.

[PATCH] Fix the upper MTU limit in ipv6 GRE tunnel

On Wed, Oct 2, 2013 at 5:44 PM, Oussama Ghorbel <ou.ghorbel@gmail.com> wrote:
> The check of upper MTU limit when changing it in ip6 gre tunnel seems incorrect.
> The function in question is:
>
> static int ip6gre_tunnel_change_mtu(struct net_device *dev, int new_mtu)
> {
>     struct ip6_tnl *tunnel = netdev_priv(dev);
>
>     if (new_mtu < 68 ||
>         new_mtu > 0xFFF8 - dev->hard_header_len - tunnel->hlen)
>         return -EINVAL;
>     dev->mtu = new_mtu;
>     return 0;
> }
>
> However the dev->hard_header_len and tunnel->hlen are initialized in
> the following way in ip6gre_tnl_link_config():
>
> int addend = sizeof(struct ipv6hdr) + 4;
> ...
> dev->hard_header_len = rt->dst.dev->hard_header_len + addend;
> ...
> t->hlen = addend; // t is ip6_tnl pointer
>
> As you see the information t->hlen is already included in
> dev->hard_header_len, so why calculate it twice?
>
> Thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-04  9:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-02 16:44 The check of upper MTU limit when changing it in ip6 gre tunnel seems incorrect Oussama Ghorbel
2013-10-04  9:58 ` Oussama Ghorbel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).