From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefano Brivio Subject: [PATCH net] vxlan: Restore initial MTU setting based on lower device Date: Wed, 13 Dec 2017 23:37:00 +0100 Message-ID: <0c6caef03156aa51673c50ebb59889fc001b74be.1513198761.git.sbrivio@redhat.com> Cc: Matthias Schiffer , Junhan Yan , Jiri Benc , Hangbin Liu To: "David S . Miller" , netdev@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:44758 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750916AbdLMWhL (ORCPT ); Wed, 13 Dec 2017 17:37:11 -0500 Sender: netdev-owner@vger.kernel.org List-ID: 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 Fixes: a985343ba906 ("vxlan: refactor verification and application of configuration") Signed-off-by: Stefano Brivio --- 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