netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] vxlan: Restore initial MTU setting based on lower device
@ 2017-12-13 22:37 Stefano Brivio
  2017-12-13 23:19 ` Stephen Hemminger
  2017-12-13 23:57 ` Matthias Schiffer
  0 siblings, 2 replies; 10+ messages in thread
From: Stefano Brivio @ 2017-12-13 22:37 UTC (permalink / raw)
  To: David S . Miller, netdev
  Cc: Matthias Schiffer, Junhan Yan, Jiri Benc, Hangbin Liu

Commit a985343ba906 ("vxlan: refactor verification and
application of configuration") introduced a change in the
behaviour of initial MTU setting: earlier, the MTU for a link
created on top of a given lower device, without an initial MTU
specification, was set to the MTU of the lower device minus
headroom as a result of this path in vxlan_dev_configure():

	if (!conf->mtu)
		dev->mtu = lowerdev->mtu -
			   (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);

which is now gone. Now, the initial MTU, in absence of a
configured value, is simply set by ether_setup() to ETH_DATA_LEN
(1500 bytes).

This breaks userspace expectations in case the MTU of
the lower device is higher than 1500 bytes minus headroom.

Restore the previous behaviour by calculating, for a new link,
the MTU from the lower device, if present, and if no value is
explicitly configured.

Reported-by: Junhan Yan <juyan@redhat.com>
Fixes: a985343ba906 ("vxlan: refactor verification and application of configuration")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
I guess this should be queued up for -stable, back to 4.13.

I'm actually introducing the third occurrence of this calculation (there's
another one in vxlan_config_apply(), and one in vxlan_change_mtu()). I would
anyway fix the userspace breakage first, and then plan on getting rid of several
bits of MTU logic duplication, which spans further than this.

 drivers/net/vxlan.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 19b9cc51079e..3a7e36cdf2c7 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -3085,6 +3085,9 @@ static void vxlan_config_apply(struct net_device *dev,
 
 		if (conf->mtu)
 			dev->mtu = conf->mtu;
+		else if (lowerdev)
+			dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM :
+							       VXLAN_HEADROOM);
 
 		vxlan->net = src_net;
 	}
-- 
2.9.4

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

end of thread, other threads:[~2017-12-14 16:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-13 22:37 [PATCH net] vxlan: Restore initial MTU setting based on lower device Stefano Brivio
2017-12-13 23:19 ` Stephen Hemminger
2017-12-13 23:57 ` Matthias Schiffer
2017-12-14  0:10   ` Stefano Brivio
2017-12-14  0:25     ` Matthias Schiffer
2017-12-14  0:31       ` Stefano Brivio
2017-12-14  0:53         ` Matthias Schiffer
2017-12-14 11:23         ` Alexey Kodanev
2017-12-14 12:36           ` Stefano Brivio
2017-12-14 16:26             ` Alexey Kodanev

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).