netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: alexey.kodanev@oracle.com
Cc: netdev@vger.kernel.org, tom@herbertland.com
Subject: Re: [PATCH net v2] ip6_gre: init dev->mtu and dev->hard_header_len correctly
Date: Thu, 18 Jan 2018 21:07:27 -0500 (EST)	[thread overview]
Message-ID: <20180118.210727.161548896193192824.davem@davemloft.net> (raw)
In-Reply-To: <1516297872-17552-1-git-send-email-alexey.kodanev@oracle.com>

From: Alexey Kodanev <alexey.kodanev@oracle.com>
Date: Thu, 18 Jan 2018 20:51:12 +0300

> Commit b05229f44228 ("gre6: Cleanup GREv6 transmit path,
> call common GRE functions") moved dev->mtu initialization
> from ip6gre_tunnel_setup() to ip6gre_tunnel_init(), as a
> result, the previously set values, before ndo_init(), are
> reset in the following cases:
> 
> * rtnl_create_link() can update dev->mtu from IFLA_MTU
>   parameter.
> 
> * ip6gre_tnl_link_config() is invoked before ndo_init() in
>   netlink and ioctl setup, so ndo_init() can reset MTU
>   adjustments with the lower device MTU as well, dev->mtu
>   and dev->hard_header_len.
> 
>   Not applicable for ip6gretap because it has one more call
>   to ip6gre_tnl_link_config(tunnel, 1) in ip6gre_tap_init().
> 
> Fix the first case by updating dev->mtu with 'tb[IFLA_MTU]'
> parameter if a user sets it manually on a device creation,
> and fix the second one by moving ip6gre_tnl_link_config()
> call after register_netdevice().
> 
> Fixes: b05229f44228 ("gre6: Cleanup GREv6 transmit path, call common GRE functions")
> Fixes: db2ec95d1ba4 ("ip6_gre: Fix MTU setting")
> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com>
> ---
> 
> v2: Instead of checking whether dev->mtu equals zero or not
>     in ip6gre_tunnel_init_common(), update 'dev->mtu' once
>     more with 'IFLA_MTU' parameter after register_netdevice().

Applied and queued up for -stable, thanks Alexey.

I was almost tricked that this approach would have problems
because you do the MTU setting after register_netdevice(), but
we hold the RTNL semaphore so even if the device becomes
globally visible the user can't perform a change of the
device's MTU before we do it.

Thanks.

      reply	other threads:[~2018-01-19  2:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-18 17:51 [PATCH net v2] ip6_gre: init dev->mtu and dev->hard_header_len correctly Alexey Kodanev
2018-01-19  2:07 ` David Miller [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=20180118.210727.161548896193192824.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=alexey.kodanev@oracle.com \
    --cc=netdev@vger.kernel.org \
    --cc=tom@herbertland.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 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).