From patchwork Tue Sep 1 21:40:53 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: gavin_remaley@selinc.com X-Patchwork-Id: 513063 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 C75E01401C7 for ; Wed, 2 Sep 2015 07:40:55 +1000 (AEST) Received: from archives.nicira.com (localhost [127.0.0.1]) by archives.nicira.com (Postfix) with ESMTP id C54AF10935; Tue, 1 Sep 2015 14:40:54 -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 0C7FF1092F for ; Tue, 1 Sep 2015 14:40:53 -0700 (PDT) Received: from bar2.cudamail.com (unknown [192.168.21.12]) by mx1e4.cudamail.com (Postfix) with ESMTPS id 6EF6A1E0365 for ; Tue, 1 Sep 2015 15:40:52 -0600 (MDT) X-ASG-Debug-ID: 1441143651-03dc53680b53f20001-byXFYA Received: from mx1-pf2.cudamail.com ([192.168.24.2]) by bar2.cudamail.com with ESMTP id SryX7r7WnblhJwJr (version=TLSv1 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Tue, 01 Sep 2015 15:40:51 -0600 (MDT) X-Barracuda-Envelope-From: gavin_remaley@selinc.com X-Barracuda-RBL-Trusted-Forwarder: 192.168.24.2 Received: from unknown (HELO scamp.selinc.com) (74.117.214.142) by mx1-pf2.cudamail.com with SMTP; 1 Sep 2015 21:40:51 -0000 Received-SPF: pass (mx1-pf2.cudamail.com: SPF record at selinc.com designates 74.117.214.142 as permitted sender) X-Barracuda-Apparent-Source-IP: 74.117.214.142 X-Barracuda-RBL-IP: 74.117.214.142 Received: from edison.ad.selinc.com (edison.ad.selinc.com [10.100.0.15]) by scamp.selinc.com (8.15.0.59/8.14.7) with ESMTP id t81LeoAH028375 for ; Tue, 1 Sep 2015 14:40:50 -0700 To: dev@openvswitch.org MIME-Version: 1.0 X-CudaMail-MID: CM-E2-831088616 X-CudaMail-DTE: 090115 X-CudaMail-Originating-IP: 74.117.214.142 X-KeepSent: D287FC2B:3AB649A1-88257EB3:00733A88; type=4; name=$KeepSent X-ASG-Orig-Subj: [##CM-E2-831088616##][PATCH] ofp-actions.c: expand ofpacts_output_to_group to cover Write Actions that include Group action X-Mailer: Lotus Notes Release 8.5.2 August 10, 2010 Message-ID: X-CudaMail-Envelope-Sender: gavin_remaley@selinc.com From: gavin_remaley@selinc.com Date: Tue, 1 Sep 2015 15:40:53 -0600 X-MIMETrack: Serialize by Router on Edison/SEL(Release 9.0.1FP3 HF515|April 25, 2015) at 09/01/2015 02:40:50 PM, Serialize complete at 09/01/2015 02:40:50 PM X-Proofpoint-Virus-Version: vendor=nai engine=5700 definitions=7911 signatures=670629 X-GBUdb-Analysis: 0, 74.117.214.142, Ugly c=0.25607 p=0 Source Normal X-MessageSniffer-Rules: 0-0-0-12100-c X-Barracuda-Connect: UNKNOWN[192.168.24.2] X-Barracuda-Start-Time: 1441143651 X-Barracuda-Encrypted: DHE-RSA-AES256-SHA X-Barracuda-URL: https://web.cudamail.com:443/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at cudamail.com X-Barracuda-BRTS-Status: 1 X-Barracuda-Spam-Score: 0.60 X-Barracuda-Spam-Status: No, SCORE=0.60 using per-user scores of TAG_LEVEL=3.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=3.0 tests=BSF_SC5_MJ1963, HTML_MESSAGE, NO_REAL_NAME, RDNS_NONE X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.22134 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 NO_REAL_NAME From: does not include a real name 0.00 HTML_MESSAGE BODY: HTML included in message 0.10 RDNS_NONE Delivered to trusted network by a host with no rDNS 0.50 BSF_SC5_MJ1963 Custom Rule MJ1963 X-Content-Filtered-By: Mailman/MimeDel 2.1.16 Subject: [ovs-dev] [PATCH] ofp-actions.c: expand ofpacts_output_to_group to cover Write Actions that include Group action 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: , Errors-To: dev-bounces@openvswitch.org Sender: "dev" When a Group is deleted, all Flows that reference the deleted Group should also be deleted (automatically). Flows that reference a Group via Write Actions are not found by the function ofpacts_output_to_group and are therefore not deleted. Testing: I only tested that the patch fixed the described problem. I did no other testing to verify that it could not possibly break anything. There appears to be only one call to the changed function so probability seems low. Signed-off-by: Gavin Remaley --- lib/ofp-actions.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) } } diff --git a/lib/ofp-actions.c b/lib/ofp-actions.c index ea47ff9..b575cbc 100644 --- a/lib/ofp-actions.c +++ b/lib/ofp-actions.c @@ -3183,9 +3183,26 @@ 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) { + /* Get the nested actions */ + const struct ofpact_nest *nested_actions = ofpact_get_WRITE_ACTIONS(a); + struct ofpact const *nested; + + /* Loop through all the nested actions and check for Group */ + OFPACT_FOR_EACH (nested, + nested_actions->actions, + ofpact_nest_get_action_len(nested_actions)) { + if (nested->type == OFPACT_GROUP && + ofpact_get_GROUP(nested)->group_id == group_id) { + return true; + } + + }