* \param flow_id Flow ID of the flow to look for
* \retval f *LOCKED* flow or NULL
*/
-Flow *FlowGetExistingFlowFromFlowId(int64_t flow_id)
+Flow *FlowGetExistingFlowFromFlowId(uint64_t flow_id)
{
uint32_t hash = flow_id & 0x0000FFFF;
FlowBucket *fb = &flow_hash[hash % flow_config.hash_size];
Flow *FlowGetFlowFromHash(ThreadVars *tv, FlowLookupStruct *tctx, Packet *, Flow **);
Flow *FlowGetFromFlowKey(FlowKey *key, struct timespec *ttime, const uint32_t hash);
-Flow *FlowGetExistingFlowFromFlowId(int64_t flow_id);
+Flow *FlowGetExistingFlowFromFlowId(uint64_t flow_id);
uint32_t FlowKeyGetHash(FlowKey *flow_key);
uint32_t FlowGetIpPairProtoHash(const Packet *p);
uint64_t bytes_todst = fc->todstbytecnt;
bool update = fc->BypassUpdate(f, fc->bypass_data, SCTIME_SECS(ts));
if (update) {
- SCLogDebug("Updated flow: %"PRId64"", FlowGetId(f));
+ SCLogDebug("Updated flow: %" PRIu64 "", FlowGetId(f));
pkts_tosrc = fc->tosrcpktcnt - pkts_tosrc;
bytes_tosrc = fc->tosrcbytecnt - bytes_tosrc;
pkts_todst = fc->todstpktcnt - pkts_todst;
counters->bypassed_bytes += bytes_tosrc + bytes_todst;
return false;
}
- SCLogDebug("No new packet, dead flow %" PRId64 "", FlowGetId(f));
+ SCLogDebug("No new packet, dead flow %" PRIu64 "", FlowGetId(f));
if (f->livedev) {
if (FLOW_IS_IPV4(f)) {
LiveDevSubBypassStats(f->livedev, 1, AF_INET);
}
/** \brief create a flow id that is as unique as possible
- * \retval flow_id signed 64bit id
- * \note signed because of the signedness of json_integer_t in
- * the json output
+ * \retval flow_id unsigned 64bit id
*/
-static inline int64_t FlowGetId(const Flow *f)
+static inline uint64_t FlowGetId(const Flow *f)
{
- int64_t id = (uint64_t)(SCTIME_SECS(f->startts) & 0x0000FFFF) << 48 |
- (uint64_t)(SCTIME_USECS(f->startts) & 0x0000FFFF) << 32 | (int64_t)f->flow_hash;
+ uint64_t id = (uint64_t)(SCTIME_SECS(f->startts) & 0xFFFF) << 48 |
+ (uint64_t)(SCTIME_USECS(f->startts) & 0xFFFF) << 32 | (uint64_t)f->flow_hash;
/* reduce to 51 bits as JavaScript and even JSON often seem to
* max out there. */
id &= 0x7ffffffffffffLL;
if (f == NULL) {
return;
}
- int64_t flow_id = FlowGetId(f);
+ uint64_t flow_id = FlowGetId(f);
SCJbSetUint(js, "flow_id", flow_id);
if (f->parent_id) {
SCJbSetUint(js, "parent_id", f->parent_id);
bool activity = EBPFBypassCheckHalfFlow(f, fc, eb, eb->key[0], 0);
activity |= EBPFBypassCheckHalfFlow(f, fc, eb, eb->key[1], 1);
if (!activity) {
- SCLogDebug("Delete entry: %u (%ld)", FLOW_IS_IPV6(f), FlowGetId(f));
+ SCLogDebug("Delete entry: %u (%" PRIu64 ")", FLOW_IS_IPV6(f), FlowGetId(f));
/* delete the entries if no time update */
EBPFDeleteKey(eb->mapfd, eb->key[0]);
EBPFDeleteKey(eb->mapfd, eb->key[1]);
Flow *f = s->f;
- int64_t id = FlowGetId(f);
+ int64_t id = (int64_t)FlowGetId(f);
lua_pushinteger(luastate, id);
return 1;
}