* [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames
@ 2017-12-20 20:09 Eric Garver
2017-12-20 20:17 ` Jiri Benc
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Eric Garver @ 2017-12-20 20:09 UTC (permalink / raw)
To: netdev; +Cc: ovs-dev, Jiri Benc
skb_vlan_pop() expects skb->protocol to be a valid TPID for double
tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
shift the true ethertype into position for us.
Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
Signed-off-by: Eric Garver <e@erig.me>
---
net/openvswitch/flow.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/net/openvswitch/flow.c b/net/openvswitch/flow.c
index dbe2379329c5..f039064ce922 100644
--- a/net/openvswitch/flow.c
+++ b/net/openvswitch/flow.c
@@ -579,6 +579,7 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
return -EINVAL;
skb_reset_network_header(skb);
+ key->eth.type = skb->protocol;
} else {
eth = eth_hdr(skb);
ether_addr_copy(key->eth.src, eth->h_source);
@@ -592,15 +593,23 @@ static int key_extract(struct sk_buff *skb, struct sw_flow_key *key)
if (unlikely(parse_vlan(skb, key)))
return -ENOMEM;
- skb->protocol = parse_ethertype(skb);
- if (unlikely(skb->protocol == htons(0)))
+ key->eth.type = parse_ethertype(skb);
+ if (unlikely(key->eth.type == htons(0)))
return -ENOMEM;
+ /* Multiple tagged packets need to retain TPID to satisfy
+ * skb_vlan_pop(), which will later shift the ethertype into
+ * skb->protocol.
+ */
+ if (key->eth.cvlan.tci & htons(VLAN_TAG_PRESENT))
+ skb->protocol = key->eth.cvlan.tpid;
+ else
+ skb->protocol = key->eth.type;
+
skb_reset_network_header(skb);
__skb_push(skb, skb->data - skb_mac_header(skb));
}
skb_reset_mac_len(skb);
- key->eth.type = skb->protocol;
/* Network layer. */
if (key->eth.type == htons(ETH_P_IP)) {
--
2.12.0
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames
2017-12-20 20:09 [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames Eric Garver
@ 2017-12-20 20:17 ` Jiri Benc
2017-12-20 20:17 ` Jiri Benc
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Jiri Benc @ 2017-12-20 20:17 UTC (permalink / raw)
To: Eric Garver; +Cc: netdev, ovs-dev
On Wed, 20 Dec 2017 15:09:22 -0500, Eric Garver wrote:
> skb_vlan_pop() expects skb->protocol to be a valid TPID for double
> tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
> shift the true ethertype into position for us.
>
> Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
> Signed-off-by: Eric Garver <e@erig.me>
Thanks!
Reviewed-by: Jiri Benc <jbenc@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames
2017-12-20 20:09 [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames Eric Garver
2017-12-20 20:17 ` Jiri Benc
@ 2017-12-20 20:17 ` Jiri Benc
2017-12-21 18:05 ` David Miller
2017-12-21 18:05 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: Jiri Benc @ 2017-12-20 20:17 UTC (permalink / raw)
To: Eric Garver; +Cc: netdev, ovs-dev
On Wed, 20 Dec 2017 15:09:22 -0500, Eric Garver wrote:
> skb_vlan_pop() expects skb->protocol to be a valid TPID for double
> tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
> shift the true ethertype into position for us.
>
> Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
> Signed-off-by: Eric Garver <e@erig.me>
Thanks!
Reviewed-by: Jiri Benc <jbenc@redhat.com>
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames
2017-12-20 20:09 [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames Eric Garver
2017-12-20 20:17 ` Jiri Benc
2017-12-20 20:17 ` Jiri Benc
@ 2017-12-21 18:05 ` David Miller
2017-12-21 18:05 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-12-21 18:05 UTC (permalink / raw)
To: e; +Cc: netdev, ovs-dev, jbenc
From: Eric Garver <e@erig.me>
Date: Wed, 20 Dec 2017 15:09:22 -0500
> skb_vlan_pop() expects skb->protocol to be a valid TPID for double
> tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
> shift the true ethertype into position for us.
>
> Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
> Signed-off-by: Eric Garver <e@erig.me>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames
2017-12-20 20:09 [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames Eric Garver
` (2 preceding siblings ...)
2017-12-21 18:05 ` David Miller
@ 2017-12-21 18:05 ` David Miller
3 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2017-12-21 18:05 UTC (permalink / raw)
To: e; +Cc: netdev, ovs-dev, jbenc
From: Eric Garver <e@erig.me>
Date: Wed, 20 Dec 2017 15:09:22 -0500
> skb_vlan_pop() expects skb->protocol to be a valid TPID for double
> tagged frames. So set skb->protocol to the TPID and let skb_vlan_pop()
> shift the true ethertype into position for us.
>
> Fixes: 5108bbaddc37 ("openvswitch: add processing of L3 packets")
> Signed-off-by: Eric Garver <e@erig.me>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-12-21 18:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-20 20:09 [PATCH net v3] openvswitch: Fix pop_vlan action for double tagged frames Eric Garver
2017-12-20 20:17 ` Jiri Benc
2017-12-20 20:17 ` Jiri Benc
2017-12-21 18:05 ` David Miller
2017-12-21 18:05 ` 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).