ofproto-dpif-rid: correct logic error in rid_pool_alloc_id()
authorSimon Horman <simon.horman@netronome.com>
Wed, 24 Sep 2014 12:41:02 +0000 (12:41 +0000)
committerAndy Zhou <azhou@nicira.com>
Fri, 26 Sep 2014 18:35:57 +0000 (11:35 -0700)
commit8dba24782fa8a9786184cb24718abbd28e115dd6
tree48102b1bbaaeefa4d3fbd7bbf380a315fc59a9d0
parent825bce7473d9282cdf2f08d09584d3edcd7526ed
ofproto-dpif-rid: correct logic error in rid_pool_alloc_id()

When searching through the valid ids an id should
be used if is not found rather than if it is found.

It appears to me that without this change duplicate recirculation
ids may used in cases where the last recirculation id has
been allocated; selection loops back to the beginning of the pool and;
reaches a recirculation id that is still in use.

As the number of recirculation ids is currently RECIRC_ID_N_IDS = 1024 this
does not seem beyond the bounds of possibility.

I have not verified that such a scenario can actually occur.  But it seems
that a likely consequence would be that some packets may be forwarded
incorrectly.

Signed-off-by: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
ofproto/ofproto-dpif-rid.c