aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCong Wang <cwang@twopensource.com>2014-06-12 14:53:10 -0400
committerDavid S. Miller <davem@davemloft.net>2014-06-13 18:27:59 -0400
commit2853af6a2ea1a8ed09b09dd4fb578e7f435e8d34 (patch)
tree5fe67955fc104ebd852e3a3c7fcea1cea5713efa
parent56f16c74ca25649691fcfe4eedfb8ecadec830cb (diff)
vxlan: use dev->needed_headroom instead of dev->hard_header_len
When we mirror packets from a vxlan tunnel to other device, the mirror device should see the same packets (that is, without outer header). Because vxlan tunnel sets dev->hard_header_len, tcf_mirred() resets mac header back to outer mac, the mirror device actually sees packets with outer headers Vxlan tunnel should set dev->needed_headroom instead of dev->hard_header_len, like what other ip tunnels do. This fixes the above problem. Cc: "David S. Miller" <davem@davemloft.net> Cc: stephen hemminger <stephen@networkplumber.org> Cc: Pravin B Shelar <pshelar@nicira.com> Signed-off-by: Cong Wang <cwang@twopensource.com> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/vxlan.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1610d51dbb5c..e0995ffd046d 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2247,9 +2247,9 @@ static void vxlan_setup(struct net_device *dev)
2247 eth_hw_addr_random(dev); 2247 eth_hw_addr_random(dev);
2248 ether_setup(dev); 2248 ether_setup(dev);
2249 if (vxlan->default_dst.remote_ip.sa.sa_family == AF_INET6) 2249 if (vxlan->default_dst.remote_ip.sa.sa_family == AF_INET6)
2250 dev->hard_header_len = ETH_HLEN + VXLAN6_HEADROOM; 2250 dev->needed_headroom = ETH_HLEN + VXLAN6_HEADROOM;
2251 else 2251 else
2252 dev->hard_header_len = ETH_HLEN + VXLAN_HEADROOM; 2252 dev->needed_headroom = ETH_HLEN + VXLAN_HEADROOM;
2253 2253
2254 dev->netdev_ops = &vxlan_netdev_ops; 2254 dev->netdev_ops = &vxlan_netdev_ops;
2255 dev->destructor = free_netdev; 2255 dev->destructor = free_netdev;
@@ -2646,8 +2646,7 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
2646 if (!tb[IFLA_MTU]) 2646 if (!tb[IFLA_MTU])
2647 dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); 2647 dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
2648 2648
2649 /* update header length based on lower device */ 2649 dev->needed_headroom = lowerdev->hard_header_len +
2650 dev->hard_header_len = lowerdev->hard_header_len +
2651 (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM); 2650 (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
2652 } else if (use_ipv6) 2651 } else if (use_ipv6)
2653 vxlan->flags |= VXLAN_F_IPV6; 2652 vxlan->flags |= VXLAN_F_IPV6;