secchan: Properly maintain super-rule's list of subrules when revalidating.
authorBen Pfaff <blp@nicira.com>
Wed, 18 Mar 2009 17:59:48 +0000 (10:59 -0700)
committerBen Pfaff <blp@nicira.com>
Wed, 18 Mar 2009 17:59:48 +0000 (10:59 -0700)
When we revalidated a subrule and found that it had a new super-rule,
we changed the subrule's pointer to its super-rule (rule->super), but
we failed to actually transfer it from the previous super-rule's list
of subrules to the new super-rule's list.  This fixes the problem.

secchan/ofproto.c

index c76ad3dcdf8dc5605c93663e774a7ff4b3702af7..781cd98c892792b8d5378c00495186d73fb47e47 100644 (file)
@@ -2846,7 +2846,11 @@ revalidate_rule(struct ofproto *p, struct rule *rule)
             classifier_remove(&p->cls, &rule->cr);
             rule_destroy(rule);
             return false;
-        } else {
+        } else if (super != rule->super) {
+            if (rule->super != UNKNOWN_SUPER) {
+                list_remove(&rule->list);
+            }
+            list_push_back(&super->list, &rule->list);
             rule->super = super;
             rule->hard_timeout = super->hard_timeout;
             rule->idle_timeout = super->idle_timeout;