From a2c6a63cc06f4edbce32b6ae5f500b89b3dcd1a6 Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Thu, 24 Feb 2011 13:53:02 -0800 Subject: [PATCH] ofproto: Guarantee uninstalled facets have no dp_packet_count. facet_push_stats() implicitly assumes that uninstalled facets have no dp_[packet|byte]_count. This commit guarantees and enforces this invariant. Bug #4732. --- ofproto/ofproto.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index 456dcb19..61d08ea4 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -1526,6 +1526,8 @@ ofproto_flush_flows(struct ofproto *ofproto) * individually since we are about to blow away all the facets with * dpif_flow_flush(). */ facet->installed = false; + facet->dp_packet_count = 0; + facet->dp_byte_count = 0; facet_remove(ofproto, facet); } @@ -2401,6 +2403,9 @@ facet_uninstall(struct ofproto *p, struct facet *facet) facet->installed = false; facet->dp_packet_count = 0; facet->dp_byte_count = 0; + } else { + assert(facet->dp_packet_count == 0); + assert(facet->dp_byte_count == 0); } } -- 2.30.2