[ovs-dev] [PATCH 05/10] ofproto: Clarify rule_execute packet ownership.

Jarno Rajahalme jarno at ovn.org
Thu Aug 18 22:50:18 UTC 2016


struct rule_execute owns it's 'packet' member, so
rule_execute_destroy() should delete it.

Signed-off-by: Jarno Rajahalme <jarno at ovn.org>
---
 ofproto/ofproto.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 1fc9e30..6adb1a4 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -3072,6 +3072,7 @@ ofproto_rule_has_out_group(const struct rule *rule, uint32_t group_id)
 static void
 rule_execute_destroy(struct rule_execute *e)
 {
+    dp_packet_delete(e->packet);
     ofproto_rule_unref(e->rule);
     ovs_list_remove(&e->list_node);
     free(e);
@@ -3093,7 +3094,7 @@ run_rule_executes(struct ofproto *ofproto)
         flow_extract(e->packet, &flow);
         flow.in_port.ofp_port = e->in_port;
         ofproto->ofproto_class->rule_execute(e->rule, &flow, e->packet);
-
+        e->packet = NULL;
         rule_execute_destroy(e);
     }
 }
@@ -3108,7 +3109,6 @@ destroy_rule_executes(struct ofproto *ofproto)
 
     guarded_list_pop_all(&ofproto->rule_executes, &executes);
     LIST_FOR_EACH_SAFE (e, next, list_node, &executes) {
-        dp_packet_delete(e->packet);
         rule_execute_destroy(e);
     }
 }
-- 
2.1.4




More information about the dev mailing list