summaryrefslogtreecommitdiffstats
path: root/net/8021q/vlan_netlink.c
diff options
context:
space:
mode:
authorPaolo Abeni <pabeni@redhat.com>2016-07-14 18:00:10 +0200
committerDavid S. Miller <davem@davemloft.net>2016-07-16 20:15:02 -0700
commit18d3df3eab23796d7f852f9c6bb60962b8372ced (patch)
tree4871d69274a682be6379696208efafc622d3234d /net/8021q/vlan_netlink.c
parente86663c475d384ab5f46cb5637e9b7ad08c5c505 (diff)
downloadlinux-18d3df3eab23796d7f852f9c6bb60962b8372ced.tar.bz2
vlan: use a valid default mtu value for vlan over macsec
macsec can't cope with mtu frames which need vlan tag insertion, and vlan device set the default mtu equal to the underlying dev's one. By default vlan over macsec devices use invalid mtu, dropping all the large packets. This patch adds a netif helper to check if an upper vlan device needs mtu reduction. The helper is used during vlan devices initialization to set a valid default and during mtu updating to forbid invalid, too bit, mtu values. The helper currently only check if the lower dev is a macsec device, if we get more users, we need to update only the helper (possibly reserving an additional IFF bit). Signed-off-by: Paolo Abeni <pabeni@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/8021q/vlan_netlink.c')
-rw-r--r--net/8021q/vlan_netlink.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/net/8021q/vlan_netlink.c b/net/8021q/vlan_netlink.c
index c92b52f37d38..1270207f3d7c 100644
--- a/net/8021q/vlan_netlink.c
+++ b/net/8021q/vlan_netlink.c
@@ -118,6 +118,7 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
{
struct vlan_dev_priv *vlan = vlan_dev_priv(dev);
struct net_device *real_dev;
+ unsigned int max_mtu;
__be16 proto;
int err;
@@ -144,9 +145,11 @@ static int vlan_newlink(struct net *src_net, struct net_device *dev,
if (err < 0)
return err;
+ max_mtu = netif_reduces_vlan_mtu(real_dev) ? real_dev->mtu - VLAN_HLEN :
+ real_dev->mtu;
if (!tb[IFLA_MTU])
- dev->mtu = real_dev->mtu;
- else if (dev->mtu > real_dev->mtu)
+ dev->mtu = max_mtu;
+ else if (dev->mtu > max_mtu)
return -EINVAL;
err = vlan_changelink(dev, tb, data);