multi-detect: store tenant id in packet

Store tenant id in the packet so that the output API's can log it.
pull/1608/head
Victor Julien 11 years ago
parent 642c267dc4
commit f4c9915066

@ -538,6 +538,9 @@ typedef struct Packet_
/* tunnel packet ref count */ /* tunnel packet ref count */
uint16_t tunnel_tpr_cnt; 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 pool from which this packet was allocated. Used when returning
* the packet to its owner's stack. If NULL, then allocated with malloc. * 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; \ (p)->livedev = NULL; \
PACKET_RESET_CHECKSUMS((p)); \ PACKET_RESET_CHECKSUMS((p)); \
PACKET_PROFILING_RESET((p)); \ PACKET_PROFILING_RESET((p)); \
p->tenant_id = 0; \
} while (0) } while (0)
#define PACKET_RECYCLE(p) do { \ #define PACKET_RECYCLE(p) do { \

@ -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); uint32_t tenant_id = det_ctx->TenantGetId(det_ctx, p);
if (tenant_id > 0 && tenant_id < det_ctx->mt_det_ctxs_cnt) { 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]; det_ctx = det_ctx->mt_det_ctxs[tenant_id];
if (det_ctx == NULL) if (det_ctx == NULL)
return TM_ECODE_OK; return TM_ECODE_OK;

Loading…
Cancel
Save