ofproto: Avoid removing rules from meter lists twice.
authorBen Pfaff <blp@nicira.com>
Thu, 29 Aug 2013 23:49:51 +0000 (16:49 -0700)
committerBen Pfaff <blp@nicira.com>
Thu, 29 Aug 2013 23:49:51 +0000 (16:49 -0700)
commit51b50dfd0bbbaba9cd62d42530a3538b47785b15
tree4a9a07176d78add1a55b7468b2e197930dac417e
parent08bdac6f8edcfe3bf3cf5609d2e6f03c368f14de
ofproto: Avoid removing rules from meter lists twice.

Since the meter code was introduced, the oftable_remove_rule() function
(recently renamed oftable_remove_rule__()) has had two blocks of code to
remove a rule from its meter's list of rules that reference that meter.
This commit reduces that to one.

Also modifies oftable_remove_rule__() to maintain the invariant that
'rule' is in a meter's list if and only if
!list_is_empty(&rule->meter_list_node).  I don't believe that that fixes
a real bug, but it seems like a good idea.

(This seemed like a serious bug at first, but in fact list_remove() is
idempotent: calling it two times in a row has the same effect as calling
it once.)

Signed-off-by: Ben Pfaff <blp@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
ofproto/ofproto.c