diff --git a/src/decode.h b/src/decode.h index 1a510eec46..2f322a02fe 100644 --- a/src/decode.h +++ b/src/decode.h @@ -538,6 +538,9 @@ typedef struct Packet_ /* tunnel packet ref count */ uint16_t tunnel_tpr_cnt; + /** tenant id for this packet, if any. If 0 then no tenant was assigned. */ + uint32_t tenant_id; + /* The Packet pool from which this packet was allocated. Used when returning * the packet to its owner's stack. If NULL, then allocated with malloc. */ @@ -758,6 +761,7 @@ void CaptureStatsSetup(ThreadVars *tv, CaptureStats *s); (p)->livedev = NULL; \ PACKET_RESET_CHECKSUMS((p)); \ PACKET_PROFILING_RESET((p)); \ + p->tenant_id = 0; \ } while (0) #define PACKET_RECYCLE(p) do { \ diff --git a/src/detect.c b/src/detect.c index 19f0da699a..b3f9339ffe 100644 --- a/src/detect.c +++ b/src/detect.c @@ -1985,6 +1985,8 @@ TmEcode Detect(ThreadVars *tv, Packet *p, void *data, PacketQueue *pq, PacketQue uint32_t tenant_id = det_ctx->TenantGetId(det_ctx, p); if (tenant_id > 0 && tenant_id < det_ctx->mt_det_ctxs_cnt) { + p->tenant_id = tenant_id; + det_ctx = det_ctx->mt_det_ctxs[tenant_id]; if (det_ctx == NULL) return TM_ECODE_OK;