From: Chen Haiquan <oc@yunify.com>
Date: Fri, 27 May 2016 02:49:11 +0000 (+0800)
Subject: vxlan: Accept user specified MTU value when create new vxlan link
X-Git-Tag: firefly_0821_release~176^2~4^2~40^2~68
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=721976e93e5d8963d0c937ee236489968bfcfb81;p=firefly-linux-kernel-4.4.55.git

vxlan: Accept user specified MTU value when create new vxlan link

[ Upstream commit ce577668a426c6a9e2470a09dcd07fbd6e45272a ]

When create a new vxlan link, example:
  ip link add vtap mtu 1440 type vxlan vni 1 dev eth0

The argument "mtu" has no effect, because it is not set to conf->mtu. The
default value is used in vxlan_dev_configure function.

This problem was introduced by commit 0dfbdf4102b9 (vxlan: Factor out device
configuration).

Fixes: 0dfbdf4102b9 (vxlan: Factor out device configuration)
Signed-off-by:  Chen Haiquan <oc@yunify.com>
Acked-by: Cong Wang <xiyou.wangcong@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---

diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0496f1a8a57d..0b24f51718be 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2985,6 +2985,9 @@ static int vxlan_newlink(struct net *src_net, struct net_device *dev,
 	if (data[IFLA_VXLAN_REMCSUM_NOPARTIAL])
 		conf.flags |= VXLAN_F_REMCSUM_NOPARTIAL;
 
+	if (tb[IFLA_MTU])
+		conf.mtu = nla_get_u32(tb[IFLA_MTU]);
+
 	err = vxlan_dev_configure(src_net, dev, &conf);
 	switch (err) {
 	case -ENODEV: