ofproto: Don't optimize out updating flow cookie.
authorBen Pfaff <blp@nicira.com>
Fri, 19 Mar 2010 18:44:31 +0000 (11:44 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 24 Mar 2010 23:56:28 +0000 (16:56 -0700)
The OFPFC_MODIFY and OFPFC_MODIFY_STRICT optimizes out modifying the
actions if the actions didn't change, but it also skipped updating the
flow cookie in that case, which seems wrong.  This commit fixes the
problem.

ofproto/ofproto.c

index fcc76d6..9efc96e 100644 (file)
@@ -2929,6 +2929,7 @@ modify_flow(struct ofproto *p, const struct ofp_flow_mod *ofm,
     } else {
         size_t actions_len = n_actions * sizeof *rule->actions;
 
+        rule->flow_cookie = ofm->cookie;
         if (n_actions == rule->n_actions
             && !memcmp(ofm->actions, rule->actions, actions_len))
         {
@@ -2938,7 +2939,6 @@ modify_flow(struct ofproto *p, const struct ofp_flow_mod *ofm,
         free(rule->actions);
         rule->actions = xmemdup(ofm->actions, actions_len);
         rule->n_actions = n_actions;
-        rule->flow_cookie = ofm->cookie;
 
         if (rule->cr.wc.wildcards) {
             COVERAGE_INC(ofproto_mod_wc_flow);