All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Benc <jbenc@redhat.com>
To: netdev@vger.kernel.org
Cc: pravin shelar <pshelar@ovn.org>, Eric Garver <e@erig.me>
Subject: [PATCH net 2/3] openvswitch: fix vlan subtraction from packet length
Date: Mon, 10 Oct 2016 17:02:43 +0200	[thread overview]
Message-ID: <310ec523056b4f4747e800333498ef27ad1248aa.1476111550.git.jbenc@redhat.com> (raw)
In-Reply-To: <cover.1476111550.git.jbenc@redhat.com>

When the packet has its vlan tag in skb->vlan_tci, the length of the VLAN
header is not counted in skb->len. It doesn't make sense to subtract it.

Fixes: 018c1dda5ff1 ("openvswitch: 802.1AD Flow handling, actions, vlan parsing, netlink attributes")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
 net/openvswitch/vport.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/openvswitch/vport.c b/net/openvswitch/vport.c
index 8f198437c724..7387418ac514 100644
--- a/net/openvswitch/vport.c
+++ b/net/openvswitch/vport.c
@@ -485,7 +485,8 @@ static unsigned int packet_length(const struct sk_buff *skb)
 {
 	unsigned int length = skb->len - ETH_HLEN;
 
-	if (skb_vlan_tagged(skb))
+	if (!skb_vlan_tag_present(skb) &&
+	    eth_type_vlan(skb->protocol))
 		length -= VLAN_HLEN;
 
 	/* Don't subtract for multiple VLAN tags. Most (all?) drivers allow
-- 
1.8.3.1

  parent reply	other threads:[~2016-10-10 15:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-10 15:02 [PATCH net 0/3] openvswitch: vlan fixes Jiri Benc
2016-10-10 15:02 ` [PATCH net 1/3] openvswitch: vlan: remove wrong likely statement Jiri Benc
2016-10-10 20:05   ` Pravin Shelar
2016-10-11 17:38   ` Eric Garver
2016-10-10 15:02 ` Jiri Benc [this message]
2016-10-10 20:05   ` [PATCH net 2/3] openvswitch: fix vlan subtraction from packet length Pravin Shelar
2016-10-11 17:41   ` Eric Garver
2016-10-10 15:02 ` [PATCH net 3/3] openvswitch: add NETIF_F_HW_VLAN_STAG_TX to internal dev Jiri Benc
2016-10-10 20:05   ` Pravin Shelar
2016-10-11 17:41   ` Eric Garver
2016-10-13 14:03 ` [PATCH net 0/3] openvswitch: vlan fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=310ec523056b4f4747e800333498ef27ad1248aa.1476111550.git.jbenc@redhat.com \
    --to=jbenc@redhat.com \
    --cc=e@erig.me \
    --cc=netdev@vger.kernel.org \
    --cc=pshelar@ovn.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.