From patchwork Tue Sep 8 22:23:37 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ben Pfaff X-Patchwork-Id: 515618 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from archives.nicira.com (unknown [IPv6:2600:3c00::f03c:91ff:fe6e:bdf7]) by ozlabs.org (Postfix) with ESMTP id 56E78140342 for ; Wed, 9 Sep 2015 08:23:37 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id 205AA10256; Tue, 8 Sep 2015 15:23:36 -0700 (PDT) X-Original-To: dev@openvswitch.org Delivered-To: dev@openvswitch.org Received: from mx1e4.cudamail.com (mx1.cudamail.com [69.90.118.67]) by archives.nicira.com (Postfix) with ESMTPS id 9F25010200 for ; Tue, 8 Sep 2015 15:23:34 -0700 (PDT) Received: from bar2.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 9CAE71E049A for ; Tue, 8 Sep 2015 16:23:33 -0600 (MDT) X-ASG-Debug-ID: 1441751012-03dc531aa2f79c0001-byXFYA Received: from mx1-pf1.cudamail.com ([192.168.24.1]) by bar2.cudamail.com with ESMTP id tdasMCNR6d9rvyKD (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 08 Sep 2015 16:23:32 -0600 (MDT) X-Barracuda-Envelope-From: blp@nicira.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.1 Received: from unknown (HELO mail-pa0-f51.google.com) (209.85.220.51) by mx1-pf1.cudamail.com with ESMTPS (RC4-SHA encrypted); 8 Sep 2015 22:23:32 -0000 Received-SPF: unknown (mx1-pf1.cudamail.com: Multiple SPF records returned) X-Barracuda-RBL-Trusted-Forwarder: 209.85.220.51 Received: by padhy16 with SMTP id hy16so133589447pad.1 for ; Tue, 08 Sep 2015 15:23:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5UzgJLAjPOgifbIHkzI0JhE1SSiOFVbDXauBE5lRtc8=; b=QVsG9poYN+SalBsNCeLBIPzCo6+SqoMM25FEADFH70ozUJ3RBr9JxI4c24M50BdFGf FOmy0d5fRdRUIY1arX2ImdQqdJdOtW1dhHeBEp+VJVhB31FbRuK/XV8lu+7PPy4CR5Ts 5QMKVI+LrqAqbHvKSIm6Ar+V7nF5PF69JRgi+6NZM3JBNrTmeWpLWaCjydep4HXK9v6z othe4L+w8sl20dwvGA/7N2Ril1ey3onFLIotLZHcC4PXelijsrURcOcCrvVjIvWtIHT1 x4HribzE/ayp8v36bY069oFkyvZQvzs23tKQGuAEJvdPPkPJz63nUgdNBalXkuKFz/sl +9LQ== X-Gm-Message-State: ALoCoQlwep7INJYXDKeMc5x2c6Mnsfs/50Km0tjtDtf12i3t0uRLLupT+Pb06Y8WaWjNRFOEhiqR X-Received: by 10.66.152.200 with SMTP id va8mr53376207pab.17.1441751011450; Tue, 08 Sep 2015 15:23:31 -0700 (PDT) Received: from sigabrt.benpfaff.org (173-228-112-165.dsl.dynamic.fusionbroadband.com. [173.228.112.165]) by smtp.gmail.com with ESMTPSA id j4sm4622527pdk.9.2015.09.08.15.23.29 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Sep 2015 15:23:30 -0700 (PDT) X-CudaMail-Envelope-Sender: blp@nicira.com X-Barracuda-Apparent-Source-IP: 173.228.112.165 From: Ben Pfaff To: dev@openvswitch.org X-CudaMail-Whitelist-To: dev@openvswitch.org X-CudaMail-MID: CM-E1-907096313 X-CudaMail-DTE: 090815 X-CudaMail-Originating-IP: 209.85.220.51 Date: Tue, 8 Sep 2015 15:23:37 -0700 X-ASG-Orig-Subj: [##CM-E1-907096313##][PATCH 1/3] ofp-actions: Look inside write_actions for output ports and groups. Message-Id: <1441751019-8625-1-git-send-email-blp@nicira.com> X-Mailer: git-send-email 2.1.3 X-Barracuda-Connect: UNKNOWN[192.168.24.1] X-Barracuda-Start-Time: 1441751012 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-ASG-Whitelist: Header =?UTF-8?B?eFwtY3VkYW1haWxcLXdoaXRlbGlzdFwtdG8=?= X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 Cc: Ben Pfaff , Gavin Remaley Subject: [ovs-dev] [PATCH 1/3] ofp-actions: Look inside write_actions for output ports and groups. X-BeenThere: dev@openvswitch.org X-Mailman-Version: 2.1.16 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dev-bounces@openvswitch.org Sender: "dev" The out_port and out_group matches only looked at apply_actions instructions, but my interpretation of the OpenFlow spec is that they should also look inside write_actions. Reported-by: Gavin Remaley Signed-off-by: Ben Pfaff --- AUTHORS | 1 + lib/ofp-actions.c | 21 +++++++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index a7f40bb..0c4d020 100644 --- a/AUTHORS +++ b/AUTHORS @@ -259,6 +259,7 @@ Eivind Bulie Haanaes Eric Lopez elopez@nicira.com Frido Roose fr.roose@gmail.com Gaetano Catalli gaetano.catalli@gmail.com +Gavin Remaley gavin_remaley@selinc.com George Shuklin amarao@desunote.ru Gerald Rogers gerald.rogers@intel.com Ghanem Bahri bahri.ghanem@gmail.com diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index c46ce97..ee686c1 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -6072,6 +6072,12 @@ ofpact_outputs_to_port(const struct ofpact *ofpact, ofp_port_t port) return ofpact_get_ENQUEUE(ofpact)->port == port; case OFPACT_CONTROLLER: return port == OFPP_CONTROLLER; + case OFPACT_WRITE_ACTIONS: { + const struct ofpact_nest *nested = ofpact_get_WRITE_ACTIONS(ofpact); + return ofpacts_output_to_port(nested->actions, + ofpact_nest_get_action_len(nested), + port); + } case OFPACT_OUTPUT_REG: case OFPACT_BUNDLE: @@ -6113,7 +6119,6 @@ ofpact_outputs_to_port(const struct ofpact *ofpact, ofp_port_t port) case OFPACT_POP_MPLS: case OFPACT_SAMPLE: case OFPACT_CLEAR_ACTIONS: - case OFPACT_WRITE_ACTIONS: case OFPACT_GOTO_TABLE: case OFPACT_METER: case OFPACT_GROUP: @@ -6149,9 +6154,17 @@ ofpacts_output_to_group(const struct ofpact *ofpacts, size_t ofpacts_len, const struct ofpact *a; OFPACT_FOR_EACH (a, ofpacts, ofpacts_len) { - if (a->type == OFPACT_GROUP - && ofpact_get_GROUP(a)->group_id == group_id) { - return true; + if (a->type == OFPACT_GROUP) { + if (ofpact_get_GROUP(a)->group_id == group_id) { + return true; + } + } else if (a->type == OFPACT_WRITE_ACTIONS) { + const struct ofpact_nest *nested = ofpact_get_WRITE_ACTIONS(a); + if (ofpacts_output_to_group(nested->actions, + ofpact_nest_get_action_len(nested), + group_id)) { + return true; + } } }