flow: enforce 51 bits id globally

pull/2729/head
Victor Julien 8 years ago
parent 71c6df1655
commit 41e6c6dc36

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

@ -381,9 +381,6 @@ void CreateJSONFlowId(json_t *js, const Flow *f)
if (f == NULL)
return;
int64_t flow_id = FlowGetId(f);
/* reduce to 51 bits as Javascript and even JSON often seem to
* max out there. */
flow_id &= 0x7ffffffffffffLL;
json_object_set_new(js, "flow_id", json_integer(flow_id));
}

@ -524,10 +524,7 @@ static int LuaCallbackStatsFlow(lua_State *luastate)
*/
static int LuaCallbackPushFlowIdToStackFromFlow(lua_State *luastate, const Flow *f)
{
uint64_t id = FlowGetId(f);
/* reduce to 51 bits as Javascript and even JSON often seem to
* max out there. */
id &= 0x7ffffffffffffLL;
int64_t id = FlowGetId(f);
lua_pushinteger(luastate, id);
return 1;
}

Loading…
Cancel
Save