From patchwork Wed Dec 20 15:39:32 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Garver X-Patchwork-Id: 851530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=openvswitch.org (client-ip=140.211.169.12; helo=mail.linuxfoundation.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3z1zTz1VfFz9s1h for ; Thu, 21 Dec 2017 02:39:34 +1100 (AEDT) Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 475B1CEA; Wed, 20 Dec 2017 15:39:31 +0000 (UTC) X-Original-To: ovs-dev@openvswitch.org Delivered-To: ovs-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id E6EF6CA6 for ; Wed, 20 Dec 2017 15:39:29 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by smtp1.linuxfoundation.org (Postfix) with ESMTPS id 6296E3D9 for ; Wed, 20 Dec 2017 15:39:29 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C8F4883B0; Wed, 20 Dec 2017 15:39:28 +0000 (UTC) Received: from dev-rhel7.localdomain (wsfd-netdev-vmhost.ntdv.lab.eng.bos.redhat.com [10.19.188.17]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAEF85D969; Wed, 20 Dec 2017 15:39:27 +0000 (UTC) From: Eric Garver To: netdev@vger.kernel.org Date: Wed, 20 Dec 2017 10:39:32 -0500 Message-Id: <20171220153932.1362-1-e@erig.me> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 20 Dec 2017 15:39:28 +0000 (UTC) X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: ovs-dev@openvswitch.org, Jiri Benc Subject: [ovs-dev] [PATCH net v2] openvswitch: Fix pop_vlan action for double tagged frames X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: ovs-dev-bounces@openvswitch.org Errors-To: ovs-dev-bounces@openvswitch.org 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 --- 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; }