[ovs-dev] [PATCH] ofp-actions.c: expand ofpacts_output_to_group to cover Write Actions that include Group action

gavin_remaley at selinc.com gavin_remaley at selinc.com
Tue Sep 1 21:40:53 UTC 2015


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 <gavin_remaley at selinc.com>

---
 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;
+                }
+ 
+            }
         }
     }
 
-- 
1.8.3


More information about the dev mailing list