Skip to content

Commit

Permalink
ofproto-dpif-rid: correct logic error in rid_pool_alloc_id()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
shorman-netronome authored and azhou-nicira committed Sep 24, 2014
1 parent ea1f765 commit 6db454d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ofproto/ofproto-dpif-rid.c
Expand Up @@ -157,7 +157,7 @@ rid_pool_alloc_id(struct rid_pool *rids)
}

for(id = rids->base; id < rids->base + rids->n_ids; id++) {
if (rid_pool_find(rids, id)) {
if (!rid_pool_find(rids, id)) {
goto found_free_id;
}
}
Expand Down

0 comments on commit 6db454d

Please sign in to comment.