flow: change flow id computation method

Previous method was truncating the flow hash value when building
the flow_id. It is interesting not to loose the flow hash value
as it can be used in other tools or to interact with a flow that
is still active.
pull/7959/head
Eric Leblond 5 years ago committed by Victor Julien
parent 06b6f85c1f
commit 06756314d6

@ -691,9 +691,8 @@ static inline void FlowDeReference(Flow **d)
*/
static inline int64_t FlowGetId(const Flow *f)
{
int64_t id = (int64_t)f->flow_hash << 31 |
(int64_t)(f->startts.tv_sec & 0x0000FFFF) << 16 |
(int64_t)(f->startts.tv_usec & 0x0000FFFF);
int64_t id = (uint64_t)(f->startts.tv_sec & 0x0000FFFF) << 48 |
(uint64_t)(f->startts.tv_usec & 0x0000FFFF) << 32 | (int64_t)f->flow_hash;
/* reduce to 51 bits as Javascript and even JSON often seem to
* max out there. */
id &= 0x7ffffffffffffLL;

Loading…
Cancel
Save