2
0
mirror of https://github.com/openvswitch/ovs synced 2025-10-21 14:49:41 +00:00

multipath: Correctly calculate number of required destination bits.

The previous calculation was wrong when n_links was a power of 2.

Reported-by: Paul Ingram <paul@nicira.com>
Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2011-12-27 13:37:43 -08:00
parent 90bf1e0732
commit 300c69464c
3 changed files with 10 additions and 1 deletions

View File

@@ -38,7 +38,7 @@ enum ofperr
multipath_check(const struct nx_action_multipath *mp, const struct flow *flow)
{
uint32_t n_links = ntohs(mp->max_link) + 1;
size_t min_n_bits = log_2_floor(n_links) + 1;
size_t min_n_bits = log_2_ceil(n_links);
int ofs = nxm_decode_ofs(mp->ofs_nbits);
int n_bits = nxm_decode_n_bits(mp->ofs_nbits);
enum ofperr error;