From: Eric Garver <e@erig.me>
To: netdev@vger.kernel.org
Cc: ovs-dev@openvswitch.org, Jiri Benc <jbenc@redhat.com>
Subject: [PATCH net v2] openvswitch: Fix pop_vlan action for double tagged frames
Date: Wed, 20 Dec 2017 10:39:32 -0500 [thread overview]
Message-ID: <20171220153932.1362-1-e@erig.me> (raw)
skb_vlan_pop() expects skb->protocol to be a valid TPID for double
tagged frames, but skb->protocol is set to the ethertype by
key_extract(). So temporarily set it to the TPID when doing a pop_vlan.
Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
Signed-off-by: Eric Garver <e@erig.me>
---
net/openvswitch/actions.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/net/openvswitch/actions.c b/net/openvswitch/actions.c
index 30a5df27116e..c484e0941047 100644
--- a/net/openvswitch/actions.c
+++ b/net/openvswitch/actions.c
@@ -280,6 +280,13 @@ static int set_mpls(struct sk_buff *skb, struct sw_flow_key *flow_key,
static int pop_vlan(struct sk_buff *skb, struct sw_flow_key *key)
{
int err;
+ __be16 proto = skb->protocol;
+
+ /* skb->protocol is set to the inner most parsed ethertype. To satisfy
+ * skb_vlan_pop() for multi-tagged frames we must set it to the tpid.
+ */
+ if (is_flow_key_valid(key) && key->eth.vlan.tci && key->eth.cvlan.tci)
+ skb->protocol = key->eth.cvlan.tpid;
err = skb_vlan_pop(skb);
if (skb_vlan_tag_present(skb)) {
@@ -288,6 +295,9 @@ static int pop_vlan(struct sk_buff *skb, struct sw_flow_key *key)
key->eth.vlan.tci = 0;
key->eth.vlan.tpid = 0;
}
+
+ skb->protocol = proto;
+
return err;
}
--
2.12.0
next reply other threads:[~2017-12-20 15:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-20 15:39 Eric Garver [this message]
2017-12-20 17:41 ` [PATCH net v2] openvswitch: Fix pop_vlan action for double tagged frames Jiri Benc
2017-12-20 18:13 ` Eric Garver
2017-12-20 17:41 ` Jiri Benc
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=20171220153932.1362-1-e@erig.me \
--to=e@erig.me \
--cc=jbenc@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=ovs-dev@openvswitch.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 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).