vxlan: Update hard_header_len based on lowerdev when instantiating VXLAN
authorAlexander Duyck <alexander.h.duyck@intel.com>
Tue, 13 Nov 2012 13:10:59 +0000 (13:10 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 13 Nov 2012 23:19:50 +0000 (18:19 -0500)
In the event of a VXLAN device being linked to a device that has a
hard_header_len greater than that of standard ethernet we could end up with
the hard_header_len not being large enough for outgoing frames.  In order to
prevent this we should update the length when a lowerdev is provided.

Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Acked-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan.c

index 3d0bf664ea3518a13b33ab3e433805d8af592cf3..8b5c6191707626ba64bad7bdceeab2c299e5bcfc 100644 (file)
@@ -1102,6 +1102,10 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
 
                if (!tb[IFLA_MTU])
                        dev->mtu = lowerdev->mtu - VXLAN_HEADROOM;
+
+               /* update header length based on lower device */
+               dev->hard_header_len = lowerdev->hard_header_len +
+                                      VXLAN_HEADROOM;
        }
 
        if (data[IFLA_VXLAN_TOS])