netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net v3] macvtap: fix network header pointer for VLAN tagged pkts
@ 2015-07-23 14:37 Ivan Vecera
  2015-07-27 22:58 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ivan Vecera @ 2015-07-23 14:37 UTC (permalink / raw)
  To: netdev; +Cc: vyasevich, toshiaki.makita1

Network header is set with offset ETH_HLEN but it is not true for VLAN
(multiple-)tagged and results in checksum issues in lower devices.

v2: leave skb->protocol untouched (thx Vlad), comment added
v3: moved after skb_probe_transport_header() call (thx Toshiaki)

Signed-off-by: Ivan Vecera <ivecera@redhat.com>
---
 drivers/net/macvtap.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3b933bb..edd7734 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -719,6 +719,7 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
 	struct virtio_net_hdr vnet_hdr = { 0 };
 	int vnet_hdr_len = 0;
 	int copylen = 0;
+	int depth;
 	bool zerocopy = false;
 	size_t linear;
 	ssize_t n;
@@ -804,6 +805,12 @@ static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m,
 
 	skb_probe_transport_header(skb, ETH_HLEN);
 
+	/* Move network header to the right position for VLAN tagged packets */
+	if ((skb->protocol == htons(ETH_P_8021Q) ||
+	     skb->protocol == htons(ETH_P_8021AD)) &&
+	    __vlan_get_protocol(skb, skb->protocol, &depth) != 0)
+		skb_set_network_header(skb, depth);
+
 	rcu_read_lock();
 	vlan = rcu_dereference(q->vlan);
 	/* copy skb_ubuf_info for callback when skb has no error */
-- 
2.3.6

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net v3] macvtap: fix network header pointer for VLAN tagged pkts
  2015-07-23 14:37 [PATCH net v3] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
@ 2015-07-27 22:58 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-07-27 22:58 UTC (permalink / raw)
  To: ivecera; +Cc: netdev, vyasevich, toshiaki.makita1

From: Ivan Vecera <ivecera@redhat.com>
Date: Thu, 23 Jul 2015 16:37:43 +0200

> Network header is set with offset ETH_HLEN but it is not true for VLAN
> (multiple-)tagged and results in checksum issues in lower devices.
> 
> v2: leave skb->protocol untouched (thx Vlad), comment added
> v3: moved after skb_probe_transport_header() call (thx Toshiaki)
> 
> Signed-off-by: Ivan Vecera <ivecera@redhat.com>

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-07-27 22:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 14:37 [PATCH net v3] macvtap: fix network header pointer for VLAN tagged pkts Ivan Vecera
2015-07-27 22:58 ` 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).