From 5382a3cf9be0632c83cff17f08c9b46036a8ad88 Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Mon, 24 Mar 2014 17:34:48 -0700 Subject: [PATCH] lib/flow: Fix flow_hash_5tuple(). First part of the hash was discarded as basis was used too late. Also be explicit about the input type expected by mhash_add(). Signed-off-by: Jarno Rajahalme Signed-off-by: Alex Wang --- lib/flow.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/flow.c b/lib/flow.c index 00e66a40f..ac8d748c4 100644 --- a/lib/flow.c +++ b/lib/flow.c @@ -828,10 +828,10 @@ flow_hash_5tuple(const struct flow *flow, uint32_t basis) return 0; } - hash = mhash_add(hash, (OVS_FORCE unsigned int) flow->nw_src); - hash = mhash_add(basis, (OVS_FORCE unsigned int) flow->nw_dst); - hash = mhash_add(hash, ((OVS_FORCE unsigned int) flow->tp_src << 16) - | (OVS_FORCE unsigned int) flow->tp_dst); + hash = mhash_add(basis, (OVS_FORCE uint32_t) flow->nw_src); + hash = mhash_add(hash, (OVS_FORCE uint32_t) flow->nw_dst); + hash = mhash_add(hash, ((OVS_FORCE uint32_t) flow->tp_src << 16) + | (OVS_FORCE uint32_t) flow->tp_dst); hash = mhash_add(hash, flow->nw_proto); return mhash_finish(hash, 13); -- 2.47.0