* [Patch net] vxlan: use dev->needed_headroom instead of dev->hard_header_len
@ 2014-06-12 18:53 Cong Wang
2014-06-13 22:29 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Cong Wang @ 2014-06-12 18:53 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, stephen hemminger, Pravin B Shelar, Cong Wang,
Cong Wang
From: Cong Wang <cwang@twopensource.com>
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>
---
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 1610d51..e0995ff 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2247,9 +2247,9 @@ static void vxlan_setup(struct net_device *dev)
eth_hw_addr_random(dev);
ether_setup(dev);
if (vxlan->default_dst.remote_ip.sa.sa_family == AF_INET6)
- dev->hard_header_len = ETH_HLEN + VXLAN6_HEADROOM;
+ dev->needed_headroom = ETH_HLEN + VXLAN6_HEADROOM;
else
- dev->hard_header_len = ETH_HLEN + VXLAN_HEADROOM;
+ dev->needed_headroom = ETH_HLEN + VXLAN_HEADROOM;
dev->netdev_ops = &vxlan_netdev_ops;
dev->destructor = free_netdev;
@@ -2646,8 +2646,7 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
if (!tb[IFLA_MTU])
dev->mtu = lowerdev->mtu - (use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
- /* update header length based on lower device */
- dev->hard_header_len = lowerdev->hard_header_len +
+ dev->needed_headroom = lowerdev->hard_header_len +
(use_ipv6 ? VXLAN6_HEADROOM : VXLAN_HEADROOM);
} else if (use_ipv6)
vxlan->flags |= VXLAN_F_IPV6;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Patch net] vxlan: use dev->needed_headroom instead of dev->hard_header_len
2014-06-12 18:53 [Patch net] vxlan: use dev->needed_headroom instead of dev->hard_header_len Cong Wang
@ 2014-06-13 22:29 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-06-13 22:29 UTC (permalink / raw)
To: xiyou.wangcong; +Cc: netdev, stephen, pshelar, cwang
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Thu, 12 Jun 2014 11:53:10 -0700
> From: Cong Wang <cwang@twopensource.com>
>
> 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>
This looks good, and as you say consistent with how other IP tunnel
types are handled.
Applied, and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-13 22:29 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-12 18:53 [Patch net] vxlan: use dev->needed_headroom instead of dev->hard_header_len Cong Wang
2014-06-13 22:29 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).