]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
multi-detect: store tenant id in packet
authorVictor Julien <victor@inliniac.net>
Sun, 1 Mar 2015 09:09:21 +0000 (10:09 +0100)
committerVictor Julien <victor@inliniac.net>
Thu, 23 Jul 2015 17:36:15 +0000 (19:36 +0200)
Store tenant id in the packet so that the output API's can log it.

src/decode.h
src/detect.c

index 1a510eec46f248407c8af04e344f594080dc41d1..2f322a02fec30b431ee55cf6676551a53634bc9a 100644 (file)
@@ -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 { \
index 19f0da699a46bf67d4ddc909f815cc1e9770b37f..b3f9339ffec4693f0f838f5cc7e6bad40e105fa8 100644 (file)
@@ -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;