From: Victor Julien Date: Sun, 1 Mar 2015 09:09:21 +0000 (+0100) Subject: multi-detect: store tenant id in packet X-Git-Tag: suricata-3.0RC1~204 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4c9915066402852e647346ed8c9d797ba6781f3;p=thirdparty%2Fsuricata.git multi-detect: store tenant id in packet Store tenant id in the packet so that the output API's can log it. --- 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;