vxlan: Accept user specified MTU value when create new vxlan link
Subsystems (2)
PATCH 1/1 vxlan: Accept user specified MTU value when create new vxlan link
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).
--- drivers/net/vxlan.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/vxlan.c +3 -0
@@ -3086,6 +3086,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 :
Signature · 1 line
2.7.4
Quoted 21 lines · Chen Haiquan
When create a new vxlan link, example:
ip link add vtap mtu 1440 type vxlan vni 1 dev eth0The argument "mtu" has no effect, because it is not set to
conf->mtu. The default value is used invxlan_dev_configurefunction.This problem was introduced by commit
0dfbdf4102b9(vxlan: Factor out device configuration).Fixes 0dfbdf4102b9 (vxlan: Factor out device configuration)Signed-off-by Chen Haiquan <[email protected]>--- drivers/net/vxlan.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/vxlan.c +0
-0
drivers/net/vxlan.c static int vxlan_newlink(struct net *src_net, struct net_device *dev, · line 3091
Quoted 6 lines
drivers/net/vxlan.c +3
-0@@ -3086,6 +3086,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 ]); +
IFLA_MTU is already parsed in rtnl_create_link(),
so just use dev->mtu here? conf.mtu = dev->mtu?
Quoted 25 lines · Cong Wang
Quoted 24 lines · Chen Haiquan
When create a new vxlan link, example:
ip link add vtap mtu 1440 type vxlan vni 1 dev eth0The argument "mtu" has no effect, because it is not set to
conf->mtu. The default value is used invxlan_dev_configurefunction.This problem was introduced by commit
0dfbdf4102b9(vxlan: Factor out device configuration).Fixes 0dfbdf4102b9 (vxlan: Factor out device configuration)Signed-off-by Chen Haiquan <[email protected]>--- drivers/net/vxlan.c | 3 +++ 1 file changed, 3 insertions(+)drivers/net/vxlan.c +0
-0@@ -3086,6 +3086,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 ;
Quoted 5 lines
drivers/net/vxlan.c static int vxlan_newlink(struct net *src_net, struct net_device *dev, · line 3091
Quoted 3 lines
drivers/net/vxlan.c +3
-0+if (tb[IFLA_MTU ]) + conf.mtu =nla_get_u32 (tb[IFLA_MTU ]); +
IFLA_MTUis already parsed inrtnl_create_link(),
so just usedev->mtuhere? conf.mtu =dev->mtu?
Two reasons:
1. vxlan_dev_configure function check conf->mtu to determine if it need to change value of dev->mtu. The logical looks better to get conf->mtu from IFLA_MTU directly.
2. This problem is a regression. The old code check tb[IFLA_MTU]. I want to use the same way as the past.
Cong Wang
Acked-byQuoted 3 lines · oc
1.
vxlan_dev_configurefunction checkconf->mtuto determine if it need to change value ofdev->mtu.
The logical looks better to getconf->mtufromIFLA_MTUdirectly.
Fair enough,