suricata
detect.h
Go to the documentation of this file.
1 /* Copyright (C) 2007-2025 Open Information Security Foundation
2  *
3  * You can copy, redistribute or modify this Program under the terms of
4  * the GNU General Public License version 2 as published by the Free
5  * Software Foundation.
6  *
7  * This program is distributed in the hope that it will be useful,
8  * but WITHOUT ANY WARRANTY; without even the implied warranty of
9  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10  * GNU General Public License for more details.
11  *
12  * You should have received a copy of the GNU General Public License
13  * version 2 along with this program; if not, write to the Free Software
14  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15  * 02110-1301, USA.
16  */
17 
18 /**
19  * \file
20  *
21  * \author Victor Julien <victor@inliniac.net>
22  */
23 
24 #ifndef SURICATA_DETECT_H
25 #define SURICATA_DETECT_H
26 
27 #include "suricata-common.h"
28 #include "flow.h"
29 
30 #include "app-layer-parser.h"
31 #include "detect-engine-proto.h"
32 #include "detect-reference.h"
33 #include "detect-metadata.h"
34 #include "detect-engine-register.h"
36 
37 #include "util-prefilter.h"
38 #include "util-mpm.h"
39 #include "util-spm.h"
40 #include "util-hash.h"
41 #include "util-hashlist.h"
42 #include "util-radix4-tree.h"
43 #include "util-radix6-tree.h"
44 #include "util-file.h"
45 #include "reputation.h"
46 
47 #define DETECT_MAX_RULE_SIZE 8192
48 
49 #define DETECT_TRANSFORMS_MAX 16
50 
51 /** default rule priority if not set through priority keyword or via
52  * classtype. */
53 #define DETECT_DEFAULT_PRIO 3
54 
55 // tx_id value to use when there is no transaction
56 #define PACKET_ALERT_NOTX UINT64_MAX
57 
58 /* forward declaration for sigorder logic in detect-engine-sigorder.[ch] */
59 struct SCSigOrderFunc_;
60 
61 /* Forward declarations for structures from Rust. */
63 
64 // rule types documentation tag start: SignatureType
67  SIG_TYPE_IPONLY, // rule is handled by IPONLY engine
68  SIG_TYPE_LIKE_IPONLY, // rule is handled by pkt engine, has action effect like ip-only
69  /** Proto detect only signature.
70  * Inspected once per direction when protocol detection is done. */
71  SIG_TYPE_PDONLY, // rule is handled by PDONLY engine
76 
77  SIG_TYPE_APPLAYER, // app-layer but not tx, e.g. appproto
78  SIG_TYPE_APP_TX, // rule is handled by TX engine
79 
81 };
82 // rule types documentation tag end: SignatureType
83 
88 };
89 
92 };
93 
95 
96 /*
97  The detection engine groups similar signatures/rules together. Internally a
98  tree of different types of data is created on initialization. This is it's
99  global layout:
100 
101  For TCP/UDP
102 
103  - Flow direction
104  -- Protocol
105  -=- Dst port
106 
107  For the other protocols
108 
109  - Flow direction
110  -- Protocol
111 */
112 
113 /* holds the values for different possible lists in struct Signature.
114  * These codes are access points to particular lists in the array
115  * Signature->init_data->smlists[DETECT_SM_LIST_MAX]. */
117  /* list for non-payload per packet matches, e.g. ttl, flow keyword */
119  /* list for payload and stream match */
121 
122  /* base64_data keyword uses some hardcoded logic so consider
123  * built-in
124  * TODO convert to inspect engine */
126 
127  /* list for post match actions: flowbit set, flowint increment, etc */
129 
130  DETECT_SM_LIST_TMATCH, /**< post-detection tagging */
131 
132  /* lists for alert thresholding and suppression */
135 
137 
138  /* start of dynamically registered lists */
140 };
141 
142 /* used for Signature->list, which indicates which list
143  * we're adding keywords to in cases of sticky buffers like
144  * file_data */
145 #define DETECT_SM_LIST_NOTSET INT_MAX
146 
147 /*
148  * DETECT ADDRESS
149  */
150 
151 /* a is ... than b */
152 enum {
153  ADDRESS_ER = -1, /**< error e.g. compare ipv4 and ipv6 */
154  ADDRESS_LT, /**< smaller [aaa] [bbb] */
155  ADDRESS_LE, /**< smaller with overlap [aa[bab]bb] */
156  ADDRESS_EQ, /**< exactly equal [abababab] */
157  ADDRESS_ES, /**< within [bb[aaa]bb] and [[abab]bbb] and [bbb[abab]] */
158  ADDRESS_EB, /**< completely overlaps [aa[bbb]aa] and [[baba]aaa] and [aaa[baba]] */
159  ADDRESS_GE, /**< bigger with overlap [bb[aba]aa] */
160  ADDRESS_GT, /**< bigger [bbb] [aaa] */
161 };
162 
163 #define ADDRESS_FLAG_NOT 0x01 /**< address is negated */
164 #define ADDRESS_FLAG_RANGE 0x02 /**< address has range */
165 
166 /** \brief address structure for use in the detection engine.
167  *
168  * Contains the address information and matching information.
169  */
170 typedef struct DetectAddress_ {
171  /** address data for this group */
174 
175  /** flags affecting this address */
176  uint8_t flags;
177 
178  /** ptr to the previous address in the list */
180  /** ptr to the next address in the list */
183 
184 /** Address grouping head. IPv4 and IPv6 are split out */
185 typedef struct DetectAddressHead_ {
188 
191 
192 
193 typedef struct DetectMatchAddressIPv4_ {
194  uint32_t ip; /**< address in host order, start of range */
195  uint32_t ip2; /**< address in host order, end of range */
197 
198 typedef struct DetectMatchAddressIPv6_ {
199  uint32_t ip[4];
200  uint32_t ip2[4];
202 
203 /*
204  * DETECT PORT
205  */
206 
207 /* a is ... than b */
208 enum {
209  PORT_ER = -1, /* error */
210  PORT_LT, /* smaller [aaa] [bbb] */
211  PORT_LE, /* smaller with overlap [aa[bab]bb] */
212  PORT_EQ, /* exactly equal [abababab] */
213  PORT_ES, /* within [bb[aaa]bb] and [[abab]bbb] and [bbb[abab]] */
214  PORT_EB, /* completely overlaps [aa[bbb]aa] and [[baba]aaa] and [aaa[baba]] */
215  PORT_GE, /* bigger with overlap [bb[aba]aa] */
216  PORT_GT, /* bigger [bbb] [aaa] */
217 };
218 
219 #define PORT_FLAG_NOT 0x02 /**< negated port */
220 #define PORT_SIGGROUPHEAD_COPY 0x04 /**< sgh is a ptr copy */
221 
222 /** \brief Port structure for detection engine */
223 typedef struct DetectPort_ {
224  uint16_t port;
225  uint16_t port2;
226 
227  uint8_t flags; /**< flags for this port */
228 
229  /* signatures that belong in this group
230  *
231  * If the PORT_SIGGROUPHEAD_COPY flag is set, we don't own this pointer
232  * (memory is freed elsewhere).
233  */
234  struct SigGroupHead_ *sh;
235 
236  struct DetectPort_ *prev;
237  struct DetectPort_ *next;
238  struct DetectPort_ *last; /* Pointer to the last node in the list */
240 
241 /* Signature flags */
242 /** \note: additions should be added to the rule analyzer as well */
243 
244 #define SIG_FLAG_SRC_ANY BIT_U32(0) /**< source is any */
245 #define SIG_FLAG_DST_ANY BIT_U32(1) /**< destination is any */
246 #define SIG_FLAG_SP_ANY BIT_U32(2) /**< source port is any */
247 #define SIG_FLAG_DP_ANY BIT_U32(3) /**< destination port is any */
248 
249 #define SIG_FLAG_FIREWALL BIT_U32(4) /**< sig is a firewall rule */
250 
251 #define SIG_FLAG_DSIZE BIT_U32(5) /**< signature has a dsize setting */
252 #define SIG_FLAG_APPLAYER BIT_U32(6) /**< signature applies to app layer instead of packets */
253 #define SIG_FLAG_TXBOTHDIR BIT_U32(7) /**< signature needs tx with both directions to match */
254 
255 #define SIG_FLAG_FW_HOOK_LTE BIT_U32(8) /**< Signature::app_progress_hook is to be used as LTE */
256 
257 #define SIG_FLAG_REQUIRE_PACKET BIT_U32(9) /**< signature is requiring packet match */
258 #define SIG_FLAG_REQUIRE_STREAM BIT_U32(10) /**< signature is requiring stream match */
259 
260 #define SIG_FLAG_MPM_NEG BIT_U32(11)
261 
262 #define SIG_FLAG_FLUSH BIT_U32(12) /**< detection logic needs stream flush notification */
263 
264 #define SIG_FLAG_REQUIRE_STREAM_ONLY \
265  BIT_U32(13) /**< signature is requiring stream match. Stream match is not optional, so no \
266  fallback to packet payload. */
267 
268 // vacancies
269 
270 #define SIG_FLAG_REQUIRE_FLOWVAR BIT_U32(17) /**< signature can only match if a flowbit, flowvar or flowint is available. */
271 
272 #define SIG_FLAG_FILESTORE BIT_U32(18) /**< signature has filestore keyword */
273 
274 #define SIG_FLAG_TOSERVER BIT_U32(19)
275 #define SIG_FLAG_TOCLIENT BIT_U32(20)
276 
277 #define SIG_FLAG_TLSSTORE BIT_U32(21)
278 
279 #define SIG_FLAG_BYPASS BIT_U32(22)
280 
281 #define SIG_FLAG_PREFILTER BIT_U32(23) /**< sig is part of a prefilter engine */
282 
283 // vacancy
284 
285 /** Info for Source and Target identification */
286 #define SIG_FLAG_SRC_IS_TARGET BIT_U32(25)
287 /** Info for Source and Target identification */
288 #define SIG_FLAG_DEST_IS_TARGET BIT_U32(26)
289 
290 #define SIG_FLAG_HAS_TARGET (SIG_FLAG_DEST_IS_TARGET|SIG_FLAG_SRC_IS_TARGET)
291 
292 /* signature init flags */
293 // available 0
294 #define SIG_FLAG_INIT_PACKET BIT_U32(1) /**< signature has matches against a packet (as opposed to app layer) */
295 #define SIG_FLAG_INIT_FLOW BIT_U32(2) /**< signature has a flow setting */
296 #define SIG_FLAG_INIT_BIDIREC BIT_U32(3) /**< signature has bidirectional operator */
297 #define SIG_FLAG_INIT_FIRST_IPPROTO_SEEN \
298  BIT_U32(4) /** < signature has seen the first ip_proto keyword */
299 #define SIG_FLAG_INIT_FRAME BIT_U32(5) /**< signature uses frames */
300 #define SIG_FLAG_INIT_STATE_MATCH BIT_U32(6) /**< signature has matches that require stateful inspection */
301 #define SIG_FLAG_INIT_NEED_FLUSH BIT_U32(7)
302 #define SIG_FLAG_INIT_PRIO_EXPLICIT \
303  BIT_U32(8) /**< priority is explicitly set by the priority keyword */
304 #define SIG_FLAG_INIT_FILEDATA BIT_U32(9) /**< signature has filedata keyword */
305 #define SIG_FLAG_INIT_FORCE_TOCLIENT BIT_U32(10) /**< signature now takes keywords toclient */
306 #define SIG_FLAG_INIT_FORCE_TOSERVER BIT_U32(11) /**< signature now takes keywords toserver */
307 // Two following flags are meant to be mutually exclusive
308 #define SIG_FLAG_INIT_TXDIR_STREAMING_TOSERVER \
309  BIT_U32(12) /**< transactional signature uses a streaming buffer to server */
310 #define SIG_FLAG_INIT_TXDIR_FAST_TOCLIENT \
311  BIT_U32(13) /**< transactional signature uses a fast pattern to client */
312 
313 /* signature mask flags */
314 /** \note: additions should be added to the rule analyzer as well */
315 #define SIG_MASK_REQUIRE_PAYLOAD BIT_U8(0)
316 #define SIG_MASK_REQUIRE_FLOW BIT_U8(1)
317 #define SIG_MASK_REQUIRE_FLAGS_INITDEINIT BIT_U8(2) /* SYN, FIN, RST */
318 #define SIG_MASK_REQUIRE_FLAGS_UNUSUAL BIT_U8(3) /* URG, ECN, CWR */
319 #define SIG_MASK_REQUIRE_NO_PAYLOAD BIT_U8(4)
320 #define SIG_MASK_REQUIRE_REAL_PKT BIT_U8(5)
321 // vacancy 1x
322 #define SIG_MASK_REQUIRE_ENGINE_EVENT BIT_U8(7)
323 
324 #define FILE_SIG_NEED_FILE 0x01
325 #define FILE_SIG_NEED_FILENAME 0x02
326 #define FILE_SIG_NEED_MAGIC 0x04 /**< need the start of the file */
327 #define FILE_SIG_NEED_FILECONTENT 0x08
328 #define FILE_SIG_NEED_MD5 0x10
329 #define FILE_SIG_NEED_SHA1 0x20
330 #define FILE_SIG_NEED_SHA256 0x40
331 #define FILE_SIG_NEED_SIZE 0x80
332 
333 /* Detection Engine flags */
334 #define DE_QUIET 0x01 /**< DE is quiet (esp for unittests) */
335 
336 typedef struct IPOnlyCIDRItem_ {
337  /* address data for this item */
338  uint8_t family;
339  /* netmask in CIDR values (ex. /16 /18 /24..) */
340  uint8_t netmask;
341  /* If this host or net is negated for the signum */
342  uint8_t negated;
343 
344  uint32_t ip[4];
345  SigIntId signum; /**< our internal id */
346 
347  /* linked list, the header should be the biggest network */
349 
351 
352 /** \brief Used to start a pointer to SigMatch context
353  * Should never be dereferenced without casting to something else.
354  */
355 typedef struct SigMatchCtx_ {
356  int foo;
358 
359 /** \brief a single match condition for a signature */
360 typedef struct SigMatch_ {
361  uint16_t type; /**< match type */
362  uint16_t idx; /**< position in the signature */
363  SigMatchCtx *ctx; /**< plugin specific data */
364  struct SigMatch_ *next;
365  struct SigMatch_ *prev;
367 
368 /** \brief Data needed for Match() */
369 typedef struct SigMatchData_ {
370  uint16_t type; /**< match type */
371  bool is_last; /**< Last element of the list */
372  SigMatchCtx *ctx; /**< plugin specific data */
374 
375 struct DetectEngineThreadCtx_;// DetectEngineThreadCtx;
376 
377 /* inspection buffers are kept per tx (in det_ctx), but some protocols
378  * need a bit more. A single TX might have multiple buffers, e.g. files in
379  * SMTP or DNS queries. Since all prefilters+transforms run before the
380  * individual rules need the same buffers, we need a place to store the
381  * transformed data. This array of arrays is that place. */
382 
385  uint32_t size; /**< size in number of elements */
386  uint32_t max:31; /**< max id in use in this run */
387  uint32_t init:1; /**< first time used this run. Used for clean logic */
389 
390 typedef struct TransformData_ {
392  void *options;
394 
395 typedef struct DetectEngineTransforms {
397  uint8_t cnt;
399 
400 /** callback for getting the buffer we need to prefilter/inspect */
401 typedef InspectionBuffer *(*InspectionBufferGetDataPtr)(
402  struct DetectEngineThreadCtx_ *det_ctx,
403  const DetectEngineTransforms *transforms,
404  Flow *f, const uint8_t flow_flags,
405  void *txv, const int list_id);
406 
408  const void *txv, const uint8_t flow_flags, const uint8_t **buf, uint32_t *buf_len);
409 
411  const void *txv, const uint8_t flow_flags, uint32_t local_id, const uint8_t **buf,
412  uint32_t *buf_len);
414 
415 typedef uint8_t (*InspectEngineFuncPtr)(struct DetectEngineCtx_ *de_ctx,
416  struct DetectEngineThreadCtx_ *det_ctx,
417  const struct DetectEngineAppInspectionEngine_ *engine, const struct Signature_ *s, Flow *f,
418  uint8_t flags, void *alstate, void *txv, uint64_t tx_id);
419 
422  uint8_t dir;
423  uint8_t id; /**< per sig id used in state keeping */
424  bool mpm;
425  bool stream;
426  /** will match on a NULL buffer (so an absent buffer) */
428  uint16_t sm_list;
429  uint16_t sm_list_base; /**< base buffer being transformed */
430  uint8_t progress;
431  uint8_t sub_state; /**< matches tx type */
432 
433  struct {
434  union {
438  };
440  /** pointer to the transforms in the 'DetectBuffer entry for this list */
442  } v2;
443 
445 
448 
449 typedef struct TransformIdData_ {
450  const uint8_t *id_data;
451  uint32_t id_data_len;
453 
454 typedef struct DetectBufferType_ {
455  char name[64];
456  char description[128];
457  int id;
459  bool mpm;
460  bool packet; /**< compat to packet matches */
461  bool frame; /**< is about Frame inspection */
462  /** the buffer's keywords can change as the transaction advances: run
463  * the inspect engine on every tx update instead of only at its progress. */
466  bool multi_instance; /**< buffer supports multiple buffer instances per tx */
467  void (*SetupCallback)(
468  const struct DetectEngineCtx_ *, struct Signature_ *, const struct DetectBufferType_ *);
470  const struct Signature_ *, const char **sigerror, const struct DetectBufferType_ *);
474 
476 
477 /**
478  * \param alert_flags[out] for setting PACKET_ALERT_FLAG_*
479  */
481  struct DetectEngineThreadCtx_ *,
482  const struct DetectEnginePktInspectionEngine *engine,
483  const struct Signature_ *s,
484  Packet *p, uint8_t *alert_flags);
485 
486 /** callback for getting the buffer we need to prefilter/inspect */
487 typedef InspectionBuffer *(*InspectionBufferGetPktDataPtr)(
488  struct DetectEngineThreadCtx_ *det_ctx,
489  const DetectEngineTransforms *transforms,
490  Packet *p, const int list_id);
491 
494  bool mpm;
495  uint16_t sm_list;
496  uint16_t sm_list_base;
497  struct {
500  /** pointer to the transforms in the 'DetectBuffer entry for this list */
502  } v1;
505 
506 struct Frame;
507 struct Frames;
509 
510 /**
511  * \param alert_flags[out] for setting PACKET_ALERT_FLAG_*
512  */
514  const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s,
515  Packet *p, const struct Frames *frames, const struct Frame *frame);
516 
519  uint8_t dir;
520  uint8_t type;
521  bool mpm;
522  uint16_t sm_list;
523  uint16_t sm_list_base;
524  struct {
526  /** pointer to the transforms in the 'DetectBuffer entry for this list */
528  } v1;
532 
533 typedef struct SignatureInitDataBuffer_ {
534  uint32_t id; /**< buffer id */
535  bool sm_init; /**< initialized by sigmatch, which is likely something like `urilen:10; http.uri;
536  content:"abc";`. These need to be in the same list. Unset once `http.uri` is
537  set up. */
538  bool multi_capable; /**< true if we can have multiple instances of this buffer, so e.g. for
539  http.uri. */
540  bool only_tc; /**< true if we can only used toclient. */
541  bool only_ts; /**< true if we can only used toserver. */
542  /* sig match list */
546 
552  SIGNATURE_HOOK_PKT_ALL, /**< match each packet */
553 };
554 
559 };
560 
561 /** detect table identifiers, ordered by how they logically
562  * evaluated. Used in rule ordering to ensure the correct order
563  * of rule actions. */
572 
573 #define DETECT_TABLE_PACKET_PRE_FLOW_FLAG BIT_U8(DETECT_TABLE_PACKET_PRE_FLOW)
574 #define DETECT_TABLE_PACKET_PRE_STREAM_FLAG BIT_U8(DETECT_TABLE_PACKET_PRE_STREAM)
575 #define DETECT_TABLE_PACKET_FILTER_FLAG BIT_U8(DETECT_TABLE_PACKET_FILTER)
576 #define DETECT_TABLE_PACKET_TD_FLAG BIT_U8(DETECT_TABLE_PACKET_TD)
577 #define DETECT_TABLE_APP_FILTER_FLAG BIT_U8(DETECT_TABLE_APP_FILTER)
578 #define DETECT_TABLE_APP_TD_FLAG BIT_U8(DETECT_TABLE_APP_TD)
579 };
580 
581 // dns:request_complete should add DetectBufferTypeGetByName("dns:request_complete");
582 // TODO to json
583 typedef struct SignatureHook_ {
584  enum SignatureHookType type;
585  int sm_list; /**< list id for the hook's generic list. e.g. for dns:request_complete:generic */
586  union {
587  struct {
589  /** sub state for a specific transaction type or 0 if not used */
590  uint8_t sub_state;
591  /** progress value of the app-layer hook specified in the rule. Sets the app_proto
592  * specific progress value. */
593  uint8_t app_progress;
594  } app;
595  struct {
596  enum SignatureHookPkt ph;
597  } pkt;
598  } t;
600 
601 #define SIG_ALPROTO_MAX 4
602 
603 typedef struct SignatureInitData_ {
605 
606  /** Number of sigmatches. Used for assigning SigMatch::idx */
607  uint16_t sm_cnt;
608 
609  /** option was prefixed with '!'. Only set for sigmatches that
610  * have the SIGMATCH_HANDLE_NEGATION flag set. */
611  bool negated;
612 
613  /* track if we saw any negation in the addresses. If so, we
614  * skip it for ip-only */
617  /* see if the address contains range and skip it from iponly engine */
620 
621  /** see if any of the sigmatches supports an enabled prefilter */
623 
624  /* used to hold flags that are used during init */
625  uint32_t init_flags;
626  /* coccinelle: SignatureInitData:init_flags:SIG_FLAG_INIT_ */
627 
628  /* alproto mask if multiple protocols are possible */
630 
631  /* used at init to determine max dsize */
633 
634  /** netblocks and hosts specified at the sid, in CIDR format */
636 
637  /* list id for `mpm_sm`. Should always match `SigMatchListSMBelongsTo(s, mpm_sm)`. */
639  /* the fast pattern added from this signature */
641  /* used to speed up init of prefilter */
643 
644  /* SigMatch list used for adding content and friends. E.g. file_data; */
645  int list;
646  bool list_set;
647 
648  /* Total number of times flowbits keyword is referenced in this signature (flowbits:noalert; not
649  * included) */
650  uint16_t total_flowbits;
651 
653 
654  /** rule protocol settings */
656 
657  /** score to influence rule grouping. A higher value leads to a higher
658  * likelihood of a rulegroup with this sig ending up as a contained
659  * group. */
660  int score;
661 
662  /** address settings for this signature */
664 
665  /* holds built-in sm lists */
667  /* holds built-in sm lists' tails */
669 
670  /* Storage for buffers. */
672  uint32_t buffer_index;
673  uint32_t buffers_size;
675 
676  /* highest list/buffer id which holds a DETECT_CONTENT */
678 
679  /* inter-signature state dependency */
686 
687  /* Signature is a "firewall" rule. */
690 
691 /** \brief Signature container */
692 typedef struct Signature_ {
693  uint32_t flags;
694  /* coccinelle: Signature:flags:SIG_FLAG_ */
695  enum SignatureType type;
696 
698 
699  uint16_t dsize_low;
700  uint16_t dsize_high;
701  uint8_t dsize_mode;
702 
704  SigIntId iid; /**< signature internal id */
705 
706  /** inline -- action */
707  uint8_t action;
708  uint8_t file_flags;
709 
710  /** rule protocol: can be NULL if the check can be skipped */
712 
713  /* scope setting for the action: enum ActionScope */
714  uint8_t action_scope;
715 
716  /** ipv4 match arrays */
721 
722  /** classification id **/
723  uint16_t class_id;
724 
725  /** detect: pseudo table this rule is part of (enum DetectTable) */
726  uint8_t detect_table;
727 
728  /** firewall: progress value for this signature */
730  /** firewall: sub state (transaction type) of the hook on protocols with sub
731  * states (http2 stream/global, DoH2); 0 when the hook has no sub state.
732  * Signatures are zero initialized, so unused stays 0. */
733  uint8_t sub_state;
734 
737  /** ipv6 match arrays */
740 
741  uint32_t id; /**< sid, set by the 'sid' rule keyword */
742  uint32_t gid; /**< generator id */
743  uint32_t rev;
744  int prio;
745 
746  /** port settings for this signature */
748 
749 #ifdef PROFILE_RULES
750  uint16_t profiling_id;
751 #endif
752 
756 
757  /* Matching structures for the built-ins. The others are in
758  * their inspect engines. */
760 
761  /* memory is still owned by the sm_lists/sm_arrays entry */
763 
764  char *msg;
765 
766  /** classification message */
767  char *class_msg;
768  /** Reference */
770  /** Metadata */
772 
773  char *sig_str;
774 
776 
777  /** ptr to the next sig in the list */
778  struct Signature_ *next;
780 
785  /* must be last */
787 };
788 
789 #define DETECT_PROFILE_NAME_LEN 32
790 /** \brief one time registration of keywords at start up */
791 typedef struct DetectBufferMpmRegistry_ {
792  const char *name;
793  char pname[DETECT_PROFILE_NAME_LEN]; /**< name used in profiling */
794  int direction; /**< SIG_FLAG_TOSERVER or SIG_FLAG_TOCLIENT */
795  int16_t sm_list;
796  int16_t sm_list_base;
797  int priority;
798  int id; /**< index into this array and result arrays */
801 
803  MpmCtx *mpm_ctx, const struct DetectBufferMpmRegistry_ *mpm_reg, int list_id);
805 
806  union {
807  /* app-layer matching: use if type == DETECT_BUFFER_MPM_TYPE_APP */
808  struct {
809  union {
813  };
816  uint8_t sub_state;
818 
819  /* pkt matching: use if type == DETECT_BUFFER_MPM_TYPE_PKT */
820  struct {
822  struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx,
823  const struct DetectBufferMpmRegistry_ *mpm_reg, int list_id);
826 
827  /* frame matching: use if type == DETECT_BUFFER_MPM_TYPE_FRAME */
828  struct {
830  uint8_t type;
832  };
833 
836 
837 /* helper structure to track pattern stats and assign pattern id's. */
838 typedef struct DetectPatternTracker {
839  const struct DetectContentData_ *cd;
840  int sm_list;
841  uint32_t cnt;
842  uint32_t mpm;
844 
845 typedef struct DetectReplaceList_ {
846  const struct DetectContentData_ *cd;
847  uint8_t *found;
850 
851 /** only execute flowvar storage if rule matched */
852 #define DETECT_VAR_TYPE_FLOW_POSTMATCH 1
853 #define DETECT_VAR_TYPE_PKT_POSTMATCH 2
854 
855 /** list for flowvar store candidates, to be stored from
856  * post-match function */
857 typedef struct DetectVarList_ {
858  uint16_t type; /**< type of store candidate POSTMATCH or ALWAYS */
859  uint8_t pad[2];
860  uint32_t idx; /**< flowvar name idx */
861  uint16_t len; /**< data len */
862  uint16_t key_len;
863  uint8_t *key;
864  uint8_t *buffer; /**< alloc'd buffer, may be freed by
865  post-match, post-non-match */
868 
869 typedef struct SCFPSupportSMList_ {
870  int list_id;
871  int priority;
874 
875 /** \brief IP only rules matching ctx. */
876 typedef struct DetectEngineIPOnlyCtx_ {
877  /* Lookup trees */
880 
881  /* Used to build the radix trees */
883  uint32_t max_idx;
884 
885  /* Used to map large signums to smaller values to compact the bitsets
886  * stored in the radix trees */
887  uint32_t *sig_mapping;
890 
891 typedef struct DetectEngineLookupFlow_ {
894  struct SigGroupHead_ *sgh[256];
896 
897 typedef struct SigString_ {
898  char *filename;
899  char *sig_str;
900  char *sig_error;
901  int line;
904 
905 /** \brief Signature loader statistics */
906 typedef struct SigFileLoaderStat_ {
907  TAILQ_HEAD(, SigString_) failed_sigs;
914 
916  void *(*InitFunc)(void *);
917  void (*FreeFunc)(void *);
918  void *data;
920  int id;
921  const char *name; /* keyword name, for error printing */
923 
925 {
926  DETECT_PREFILTER_MPM = 0, /**< use only mpm / fast_pattern */
927  DETECT_PREFILTER_AUTO = 1, /**< use mpm + keyword prefilters */
928 };
929 
931 {
933  DETECT_ENGINE_TYPE_DD_STUB = 1, /* delayed detect stub: can be reloaded */
934  DETECT_ENGINE_TYPE_MT_STUB = 2, /* multi-tenant stub: cannot be reloaded */
936 };
937 
942 #define DETECT_FIREWALL_POLICY_SIZE DETECT_FIREWALL_POLICY_PRE_STREAM + 1
943 };
944 
945 /** Single Firewall Policy */
947  uint8_t action; /**< same as Signature::action. Action flags to apply on policy match. */
948  uint8_t action_scope; /**< same as Signature::action_scope. Scope argument for the action. */
949 };
950 
953  uint8_t sub_state;
954  uint8_t progress;
955  uint8_t direction;
957  /* signature that will be logged if the policy includes "alert". Will
958  * be set to NULL if alert is not part of the policy. */
960 };
961 
963  /** policy for packet_filter, pre_flow, pre_stream hooks */
966 
967  /* hash table with policies, hashed by alproto, sub_state, progress and direction */
969 };
970 
971 /* Flow states:
972  * toserver
973  * toclient
974  */
975 #define FLOW_STATES 2
976 
977 typedef struct {
978  uint32_t content_limit;
981 
983 
984 /**
985  * \brief Function type for rate filter callback.
986  *
987  * This function should return the new action to be applied. If no change to the
988  * action is to be made, the callback should return the current action provided
989  * in the new_action parameter.
990  */
991 typedef uint8_t (*SCDetectRateFilterFunc)(const Packet *p, uint32_t sid, uint32_t gid, uint32_t rev,
992  uint8_t original_action, uint8_t new_action, void *arg);
993 
994 /** \brief main detection engine ctx */
995 typedef struct DetectEngineCtx_ {
997  uint8_t flags; /**< only DE_QUIET */
998  uint8_t mpm_matcher; /**< mpm matcher this ctx uses */
999  uint8_t max_flowbits; /**< maximum number of flowbits per signature */
1000  uint32_t tenant_id;
1001 
1003  uint8_t spm_matcher; /**< spm matcher this ctx uses */
1004 
1006  uint32_t sig_cnt;
1007 
1008  /* version of the srep data */
1009  uint32_t srep_version;
1010 
1011  /* reputation for netblocks */
1013 
1015  uint32_t sig_array_len; /* size in array members */
1016 
1017  uint32_t signum;
1018 
1019  /* used by the signature ordering module */
1021 
1022  /* main sigs */
1024 
1025  /** firewall policy table entry point */
1027 
1028  /* init phase vars */
1030 
1033 
1034  /* hash table used to cull out duplicate sigs */
1036 
1038 
1039  /* maximum recursion depth for content inspection */
1041 
1042  /* maximum number of times a tx will get logged for rules not using app-layer keywords */
1044 
1045  /* force app-layer tx finding for alerts with signatures not having app-layer keywords */
1047 
1048  /* registration id for per thread ctx for the filemagic/file.magic keywords */
1050 
1051  /* spm thread context prototype, built as spm matchers are constructed and
1052  * later used to construct thread context for each thread. */
1054 
1055  /* Config options */
1056 
1059 
1060  /* max flowbit id that is used */
1061  uint32_t max_fb_id;
1062 
1064 
1065  /* array containing all sgh's in use so we can loop
1066  * through it in Stage4. */
1068  uint32_t sgh_array_cnt;
1069  uint32_t sgh_array_size;
1070 
1075 
1076  /* the max local id used amongst all sigs */
1078 
1079  /** version of the detect engine. The version is incremented on reloads */
1080  uint32_t version;
1081 
1082  /** sgh for signatures that match against invalid packets. In those cases
1083  * we can't lookup by proto, address, port as we don't have these */
1085 
1086  /** sgh for `alert ether` / `alert arp` etc. */
1088 
1089  /* Maximum size of the buffer for decoded base64 data. */
1091 
1092  /** Store rule file and line so that parsers can use them in errors. */
1094  const char *rule_file;
1095  const char *sigerror;
1098 
1099  /** The rule errored out due to missing requirements. */
1101 
1102  /* specify the configuration for mpm context factory */
1104 
1106  /** hash list of keywords that need thread local ctxs */
1108 
1110 
1111 #ifdef PROFILE_RULES
1112  struct SCProfileDetectCtx_ *profile_ctx;
1113 #endif
1114 #ifdef PROFILING
1120 #endif
1121  char config_prefix[64];
1122 
1123  enum DetectEngineType type;
1124 
1125  /** how many de_ctx' are referencing this */
1126  uint32_t ref_cnt;
1127  /** list in master: either active or freelist */
1129 
1130  /** id of loader thread 'owning' this de_ctx */
1132 
1133  /** are we using just mpm or also other prefilters */
1135 
1137 
1140 
1141  /** table for storing the string representation with the parsers result */
1143 
1144  /** table to store metadata keys and values */
1146 
1147  /* hash tables with rule-time buffer registration. Start time registration
1148  * is in detect-engine.c::g_buffer_type_hash */
1151  uint32_t buffer_type_id;
1152 
1155  /* list with app inspect engines. Both the start-time registered ones and
1156  * the rule-time registered ones. */
1164 
1165  uint32_t prefilter_id;
1167 
1168  /** time of last ruleset reload */
1169  struct timeval last_reload;
1170 
1171  /** signatures stats */
1173 
1174  /* list of Fast Pattern registrations. Initially filled using a copy of
1175  * `g_fp_support_smlist_list`, then extended at rule loading time if needed */
1177 
1178  /** per keyword flag indicating if a prefilter has been
1179  * set for it. If true, the setup function will have to
1180  * run. */
1183 
1184  /* classification config parsing */
1185 
1186  /* hash table used for holding the classification config info */
1188  pcre2_code *class_conf_regex;
1189  pcre2_match_data *class_conf_regex_match;
1190 
1191  /* reference config parsing */
1192 
1193  /* hash table used for holding the reference config info */
1196  pcre2_match_data *reference_conf_regex_match;
1197 
1198  /* --engine-analysis */
1200 
1201  /* path to the tenant yaml for this engine */
1203 
1204  /* Track rule requirements for reporting after loading rules. */
1206 
1207  /* number of signatures using filestore, limited as u16 */
1208  uint16_t filestore_cnt;
1209 
1210  /* name store for non-prefilter engines. Used in profiling but
1211  * part of the API, so hash is always used. */
1213 
1215 
1216  /* user provided rate filter callbacks. */
1218 
1219  /* use provided data to be passed to rate_filter_callback. */
1221 
1222  /* Hook for pre_stream engine if it is used. */
1224  /** TCP pre_stream hook rule groups. One per direction. */
1226 
1227  /* Hook for pre_flow engine if it is used. */
1229  /** pre_flow hook rule groups. Before flow we don't know a direction yet. */
1232 
1233 /**
1234  * \brief Register a callback when a rate_filter has been applied to
1235  * an alert.
1236  *
1237  * This callback is added to the current detection engine and will be
1238  * copied to all future detection engines over rule reloads.
1239  */
1241 
1242 /* Engine groups profiles (low, medium, high, custom) */
1243 enum {
1249 };
1250 
1251 /* Siggroup mpm context profile */
1252 enum {
1256 #define ENGINE_SGH_MPM_FACTORY_CONTEXT_START_ID_RANGE (ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO + 1)
1257 };
1258 
1259 #define DETECT_FILESTORE_MAX 15
1266 
1267 /** array of TX inspect rule candidates */
1268 typedef struct RuleMatchCandidateTx {
1269  SigIntId id; /**< internal signature id */
1270  bool fw_lte_counted; /**< counted in the firewall LTE hook coverage */
1271  bool fw_lte_header_ok; /**< firewall LTE coverage already passed the rule header check */
1272  uint32_t *flags; /**< inspect flags ptr */
1273  union {
1274  struct {
1276  uint8_t stream_result;
1277  };
1278  uint32_t stream_reset;
1279  };
1280 
1281  const Signature *s; /**< ptr to sig */
1283 
1284 /** Stores a single u32 for a rule match of the type `sm_type`. Used by
1285  * flowbits prefilter to register DETECT_FLOWBITS,<flowbit id> for post
1286  * match handling. */
1288  int sm_type; /**< sigmatch type e.g. DETECT_FLOWBITS */
1289  uint32_t value; /**< value to be interpreted by the sm_type
1290  * implementation. E.g. flowbit id. */
1291 #ifdef DEBUG
1292  SigIntId id;
1293 #endif
1295 
1296 /** Array of PostRuleMatchWorkQueueItem's. */
1297 typedef struct PostRuleMatchWorkQueue {
1298  PostRuleMatchWorkQueueItem *q; /**< array pointer */
1299  uint32_t len; /**< number of array elements in use. */
1300  uint32_t size; /**< allocation size in number of elements. */
1302 
1303 #define SIG_JSON_CONTENT_ARRAY_LEN 16
1304 #define SIG_JSON_CONTENT_ITEM_LEN 1024
1305 #define SIG_JSON_CONTENT_KEY_LEN 32
1307 /** structure to store the json content with info on sig that triggered it */
1308 typedef struct SigJsonContent {
1309  void *id; /**< pointer to the sig that triggered this json content */
1312 
1313 /**
1314  * Detection engine thread data.
1315  */
1316 typedef struct DetectEngineThreadCtx_ {
1317  /** \note multi-tenant hash lookup code from Detect() *depends*
1318  * on this being the first member */
1319  uint32_t tenant_id;
1320 
1321  SC_ATOMIC_DECLARE(int, so_far_used_by_detect);
1322 
1323  /* the thread to which this detection engine thread belongs */
1325 
1329 
1332 
1333  uint32_t (*TenantGetId)(const void *, const Packet *p);
1334 
1335  /* detection engine variables */
1336 
1338 
1339  /** offset into the payload of the end of the last match by: content, pcre, etc */
1340  uint32_t buffer_offset;
1341 
1342  /** used by pcre match function alone: normally in sync with buffer_offset, but
1343  * points to 1 byte after the start of the last pcre match if a pcre match happened. */
1345 
1346  /** SPM thread context used for scanning. This has been cloned from the
1347  * prototype held by DetectEngineCtx. */
1349 
1350  /* byte_* values */
1351  uint64_t *byte_values;
1352 
1356 
1357  /* counter for the filestore array below -- up here for cache reasons. */
1358  uint16_t filestore_cnt;
1359 
1360  /** id for alert counter */
1362  /** id for discarded alerts counter */
1364  /** id for firewall discarded alerts counter */
1366  /** id for suppressed alerts counter */
1368 #ifdef PROFILING
1371 #endif
1372 
1373  struct {
1375  uint32_t buffers_size; /**< in number of elements */
1376  uint32_t to_clear_idx;
1377  uint32_t *to_clear_queue;
1379 
1380  struct {
1381  /** inspection buffers for more complex case. As we can inspect multiple
1382  * buffers in parallel, we need this extra wrapper struct */
1384  uint32_t buffers_size; /**< in number of elements */
1385  uint32_t to_clear_idx;
1386  uint32_t *to_clear_queue;
1388 
1389  /* true if tx_id is set */
1391  /** ID of the transaction currently being inspected. */
1392  uint64_t tx_id;
1393  int64_t frame_id;
1394  uint64_t frame_inspect_progress; /**< used to set Frame::inspect_progress after all inspection
1395  on a frame is complete. */
1397 
1398  uint8_t *base64_decoded;
1400 
1404 
1405  /** array of signature pointers we're going to inspect in the detection
1406  * loop. */
1408  /** temporary array of signature pointers we're going to inspect in the
1409  * detection loop. */
1411  /** size of the array in items (mem size if * sizeof(Signature *)
1412  * Only used during initialization. */
1414  /** size in use */
1416 
1419 
1420  /** Per hook LTE coverage of the current tx walk. Kept here instead of in
1421  * the per-tx firewall state so IDS traffic does not pay to clear it.
1422  * Cleared by the firewall coverage build on first use in a walk. */
1424 
1425  MpmThreadCtx mtc; /**< thread ctx for the mpm */
1426  /* work queue for post-rule matching affecting prefilter */
1428 
1430 
1431  /* string to replace */
1433  /* vars to store in post match function */
1435 
1436  /* Array in which the filestore keyword stores file id and tx id. If the
1437  * full signature matches, these are processed by a post-match filestore
1438  * function to finalize the store. */
1439  struct {
1440  uint32_t file_id;
1441  uint64_t tx_id;
1443 
1445  /** store for keyword contexts that need a per thread storage. Per de_ctx. */
1448  /** store for keyword contexts that need a per thread storage. Global. */
1451 
1453  uint16_t events;
1454 
1455  /** stats id for lua rule errors */
1457 
1458  /** stats id for lua blocked function counts */
1460 
1461  /** stats if for lua instruction limit errors */
1463 
1464  /** stat of lua memory limit errors. */
1466 
1467 #ifdef DEBUG
1468  uint64_t pkt_stream_add_cnt;
1469  uint64_t payload_mpm_cnt;
1470  uint64_t payload_mpm_size;
1471  uint64_t stream_mpm_cnt;
1472  uint64_t stream_mpm_size;
1473  uint64_t payload_persig_cnt;
1474  uint64_t payload_persig_size;
1475  uint64_t stream_persig_cnt;
1476  uint64_t stream_persig_size;
1477 #endif
1478 #ifdef PROFILE_RULES
1479  struct SCProfileData_ *rule_perf_data;
1480  int rule_perf_data_size;
1481  uint32_t rule_perf_last_sync;
1482 #endif
1483 #ifdef PROFILING
1486  int keyword_perf_list; /**< list we're currently inspecting, DETECT_SM_LIST_* */
1488 
1490  /** bytes inspected by current prefilter callback call */
1492  /** number of times we inspected a buffer */
1494 #endif
1496 
1497 // forward declaration
1498 typedef struct SCJsonBuilder SCJsonBuilder;
1499 
1500 /** \brief element in sigmatch type table.
1501  */
1502 typedef struct SigTableElmt_ {
1503  /** Packet match function pointer */
1504  int (*Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *);
1505 
1506  /** AppLayer TX match function pointer */
1508  uint8_t flags, void *alstate, void *txv,
1509  const Signature *, const SigMatchCtx *);
1510 
1511  /** File match function pointer */
1513  Flow *, /**< *LOCKED* flow */
1514  uint8_t flags, File *, const Signature *, const SigMatchCtx *);
1515 
1516  /** InspectionBuffer transformation callback */
1517  void (*Transform)(DetectEngineThreadCtx *, InspectionBuffer *, const void *context);
1518  bool (*TransformValidate)(const uint8_t *content, uint16_t content_len, const void *context);
1519 
1520  /** Transform identity callback */
1521  void (*TransformId)(const uint8_t **data, uint32_t *length, const void *context);
1522 
1523  /** keyword setup function pointer */
1524  int (*Setup)(DetectEngineCtx *, Signature *, const char *);
1525 
1526  bool (*SupportsPrefilter)(const Signature *s);
1528 
1529  void (*Free)(DetectEngineCtx *, void *);
1530 #ifdef UNITTESTS
1531  void (*RegisterTests)(void);
1532 #endif
1533  uint32_t flags;
1534  /* coccinelle: SigTableElmt:flags:SIGMATCH_ */
1535 
1536  /** bitfield of tables supported by this rule: used by DETECT_TABLE_*_FLAG flags. */
1537  uint8_t tables;
1538 
1539  /** better keyword to replace the current one */
1540  uint16_t alternative;
1541 
1542  const char *name; /**< keyword name alias */
1543  const char *alias; /**< name alias */
1544  const char *desc;
1545  const char *url;
1546 
1547  // Cleanup function for freeing rust allocated name or such
1548  void (*Cleanup)(struct SigTableElmt_ *);
1549 
1550  // Cleanup function for freeing rust allocated name or such
1553 
1554 /* event code */
1555 enum {
1569 
1572 };
1573 
1574 #define SIG_GROUP_HEAD_HAVERAWSTREAM BIT_U16(0)
1575 #ifdef HAVE_MAGIC
1576 #define SIG_GROUP_HEAD_HAVEFILEMAGIC BIT_U16(1)
1577 #endif
1578 #define SIG_GROUP_HEAD_HAVEFILEMD5 BIT_U16(2)
1579 // vacancy
1580 #define SIG_GROUP_HEAD_HAVEFILESHA1 BIT_U16(4)
1581 #define SIG_GROUP_HEAD_HAVEFILESHA256 BIT_U16(5)
1592 };
1593 
1594 typedef struct MpmStore_ {
1595  uint8_t *sid_array;
1596  uint32_t sid_array_size;
1597 
1600  int sm_list;
1604 
1606 
1607 typedef void (*PrefilterPktFn)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx);
1608 typedef void (*PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p,
1609  const struct Frames *frames, const struct Frame *frame);
1610 
1611 typedef struct AppLayerTxData AppLayerTxData;
1612 typedef void (*PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f,
1613  void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags);
1614 
1615 typedef struct PrefilterEngineList_ {
1616  uint16_t id;
1617 
1618  /** App Proto this engine applies to: only used with Tx Engines */
1620  /** Minimal Tx progress we need before running the engine. Only used
1621  * with Tx Engine. Set to -1 for all states. */
1623 
1624  uint8_t frame_type;
1625 
1626  SignatureMask pkt_mask; /**< mask for pkt engines */
1627 
1628  uint8_t sub_state;
1629 
1631 
1632  /** Context for matching. Might be MpmCtx for MPM engines, other ctx'
1633  * for other engines. */
1634  void *pectx;
1635 
1640  DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f);
1641 
1643 
1644  /** Free function for pectx data. If NULL the memory is not freed. */
1645  void (*Free)(void *pectx);
1646 
1647  /** Run this tx engine on every tx update, regardless of tx progress.
1648  * Only used with Tx Engines. The engine keeps its real tx_min_progress,
1649  * so it still takes part in the progress bookkeeping. */
1651 
1652  const char *name;
1653  /* global id for this prefilter */
1654  uint32_t gid;
1656 
1657 typedef struct PrefilterEngine_ {
1658  uint16_t local_id;
1659 
1660  /** App Proto this engine applies to: only used with Tx Engines */
1662 
1663  union {
1664  struct {
1665  SignatureMask mask; /**< mask for pkt engines */
1666  uint8_t hook; /**< enum SignatureHookPkt */
1667  } pkt;
1668  struct {
1669  /** Minimal Tx progress we need before running the engine. Only used
1670  * with Tx Engine. Set to -1 for all states. */
1672  uint8_t sub_state;
1673  } app;
1674  uint8_t frame_type;
1675  } ctx;
1676 
1677  bool is_last;
1679 
1680  /** Tx engine must run on every tx update even once the tx progressed past
1681  * its tx_min_progress. Kept separate from tx_min_progress (-1 is the
1682  * proto-agnostic packet-style sentinel). */
1684 
1685  /** Context for matching. Might be MpmCtx for MPM engines, other ctx'
1686  * for other engines. */
1687  void *pectx;
1688 
1689  union {
1694  DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f);
1695  } cb;
1696 
1697  /* global id for this prefilter */
1698  uint32_t gid;
1700 
1701 typedef struct SigGroupHeadInitData_ {
1703 
1704  uint8_t *sig_array; /**< bit array of sig nums (internal id's) */
1705  uint32_t sig_size; /**< size in bytes */
1706 
1707  uint8_t protos[256]; /**< proto(s) this sgh is for */
1708  uint32_t direction; /**< set to SIG_FLAG_TOSERVER, SIG_FLAG_TOCLIENT or both */
1709  int score; /**< try to make this group a unique one */
1710  uint32_t max_sig_id; /**< max signature idx for this sgh */
1711 
1715 
1721 
1722  /** number of sigs in this group */
1724 
1725  /** Array with sig ptrs... size is sig_cnt * sizeof(Signature *) */
1728 
1729 /** \brief Container for matching data for a signature group */
1730 typedef struct SigGroupHead_ {
1731  uint16_t flags;
1732  /* coccinelle: SigGroupHead:flags:SIG_GROUP_HEAD_ */
1733 
1734  /** the number of signatures in this sgh that have the filestore keyword
1735  * set. */
1736  uint16_t filestore_cnt;
1737 
1738  uint32_t id; /**< unique id used to index sgh_array for stats */
1739 
1744  PrefilterEngine *post_rule_match_engines; /**< engines to run after rules modified a state */
1745 
1746  /* ptr to our init data we only use at... init :) */
1748 
1750 
1752 {
1753  TENANT_SELECTOR_UNKNOWN = 0, /**< not set */
1754  TENANT_SELECTOR_DIRECT, /**< method provides direct tenant id */
1755  TENANT_SELECTOR_VLAN, /**< map vlan to tenant id */
1756  TENANT_SELECTOR_LIVEDEV, /**< map livedev to tenant id */
1757 };
1758 
1760  uint32_t tenant_id;
1761 
1762  /* traffic id that maps to the tenant id */
1763  uint32_t traffic_id;
1764 
1767 
1768 typedef struct DetectEngineMasterCtx_ {
1770 
1771  /** enable multi tenant mode */
1773 
1774  /** version, incremented after each 'apply to threads' */
1775  uint32_t version;
1776 
1777  /** list of active detection engines. This list is used to generate the
1778  * threads det_ctx's */
1780 
1781  /** free list, containing detection engines that will be removed but may
1782  * still be referenced by det_ctx's. Freed as soon as all references are
1783  * gone. */
1785 
1787 
1788  /** list of tenant mappings. Updated under lock. Used to generate lookup
1789  * structures. */
1791 
1792  /** list of keywords that need thread local ctxs,
1793  * only updated by keyword registration at start up. Not
1794  * covered by the lock. */
1798 
1799 /* Table with all SigMatch registrations */
1801 
1802 /** Remember to add the options in SignatureIsIPOnly() at detect.c otherwise it wont be part of a signature group */
1803 
1804 #define DETECT_ENGINE_MPM_CACHE_OP_PRUNE BIT_U32(0)
1805 #define DETECT_ENGINE_MPM_CACHE_OP_SAVE BIT_U32(1)
1807 /* detection api */
1808 TmEcode Detect(ThreadVars *tv, Packet *p, void *data);
1811 
1812 SigMatch *SigMatchAlloc(void);
1813 Signature *SigFindSignatureBySidGid(DetectEngineCtx *, uint32_t, uint32_t);
1815 
1816 void SigRegisterTests(void);
1817 
1819 char *DetectLoadCompleteSigPath(const DetectEngineCtx *, const char *sig_file);
1820 int SigLoadSignatures(DetectEngineCtx *, char *, bool);
1822  DetectEngineThreadCtx *det_ctx, Packet *p);
1823 
1826 
1827 int DetectUnregisterThreadCtxFuncs(DetectEngineCtx *, void *data, const char *name);
1828 int DetectRegisterThreadCtxFuncs(DetectEngineCtx *, const char *name, void *(*InitFunc)(void *), void *data, void (*FreeFunc)(void *), int);
1830 void *DetectGetInnerTx(void *tx_ptr, AppProto alproto, AppProto engine_alproto, uint8_t flow_flags);
1831 
1832 void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size);
1834 
1836 
1839 
1840 /* events */
1841 void DetectEngineSetEvent(DetectEngineThreadCtx *det_ctx, uint8_t e);
1842 
1844 
1845 #endif /* SURICATA_DETECT_H */
SCJsonBuilder
struct SCJsonBuilder SCJsonBuilder
Definition: detect-engine-helper.h:83
DetectEngineThreadCtx_::byte_values
uint64_t * byte_values
Definition: detect.h:1351
DetectEngineCtx_::sgh_hash_table
HashListTable * sgh_hash_table
Definition: detect.h:1029
DetectEngineCtx_::pkt_mpms_list_cnt
uint32_t pkt_mpms_list_cnt
Definition: detect.h:1160
DETECT_TABLE_APP_TD
@ DETECT_TABLE_APP_TD
Definition: detect.h:571
DetectEngineAppInspectionEngine_::stream
bool stream
Definition: detect.h:425
DetectEngineCtx_::frame_mpms_list_cnt
uint32_t frame_mpms_list_cnt
Definition: detect.h:1163
SCFPSupportSMList
struct SCFPSupportSMList_ SCFPSupportSMList
SigFileLoaderStat_::bad_files
int bad_files
Definition: detect.h:908
SIG_TYPE_STREAM
@ SIG_TYPE_STREAM
Definition: detect.h:75
DetectEngineTenantMapping_
Definition: detect.h:1759
InspectionSingleBufferGetDataPtr
bool(* InspectionSingleBufferGetDataPtr)(const void *txv, const uint8_t flow_flags, const uint8_t **buf, uint32_t *buf_len)
Definition: detect.h:407
SignatureInitData_::max_content_list_id
uint32_t max_content_list_id
Definition: detect.h:677
DetectAddress_::ip
Address ip
Definition: detect.h:172
SigMatchSignaturesGetSgh
const SigGroupHead * SigMatchSignaturesGetSgh(const DetectEngineCtx *de_ctx, const Packet *p)
Get the SigGroupHead for a packet.
Definition: detect.c:293
DetectFirewallPolicies
Definition: detect.h:962
SignatureInitData_::total_flowbits
uint16_t total_flowbits
Definition: detect.h:650
PrefilterEngine_::mask
SignatureMask mask
Definition: detect.h:1665
DetectPatternTracker
Definition: detect.h:838
SignatureInitData_::rule_state_dependant_sids_idx
uint32_t rule_state_dependant_sids_idx
Definition: detect.h:683
PrefilterEngineList_::frame_type
uint8_t frame_type
Definition: detect.h:1624
SCFPSupportSMList_
Definition: detect.h:869
DetectEngineThreadCtx_::keyword_perf_data_per_list
struct SCProfileKeywordData_ ** keyword_perf_data_per_list
Definition: detect.h:1485
SigGroupHead_::tx_engines
PrefilterEngine * tx_engines
Definition: detect.h:1742
SigMatchAlloc
SigMatch * SigMatchAlloc(void)
Definition: detect-parse.c:311
DetectEngineAppInspectionEngine_
Definition: detect.h:420
SigTableElmt_::url
const char * url
Definition: detect.h:1545
DetectEngineThreadCtx_::inspect
struct DetectEngineThreadCtx_::@101 inspect
DetectBufferType_::supports_transforms
bool supports_transforms
Definition: detect.h:465
SigLoadSignatures
int SigLoadSignatures(DetectEngineCtx *, char *, bool)
Load signatures.
Definition: detect-engine-loader.c:384
MPMB_UDP_TS
@ MPMB_UDP_TS
Definition: detect.h:1588
SignatureInitDataBuffer_::head
SigMatch * head
Definition: detect.h:543
SigMatch_::prev
struct SigMatch_ * prev
Definition: detect.h:365
DetectEngineAppInspectionEngine_::mpm
bool mpm
Definition: detect.h:424
SCProfileKeywordData_
Definition: util-profiling-keywords.c:40
TransformIdData_
Definition: detect.h:449
DetectBufferType_::mpm
bool mpm
Definition: detect.h:459
PrefilterEngineList_::Prefilter
PrefilterPktFn Prefilter
Definition: detect.h:1636
SignatureInitDataBuffer_::sm_init
bool sm_init
Definition: detect.h:535
RuleMatchCandidateTx::stream_stored
bool stream_stored
Definition: detect.h:1275
DetectReplaceList_::cd
const struct DetectContentData_ * cd
Definition: detect.h:846
DetectEngineThreadCtx_::alert_queue_size
uint16_t alert_queue_size
Definition: detect.h:1401
DetectEngineThreadCtx_::buffer_offset
uint32_t buffer_offset
Definition: detect.h:1340
DetectEngineAppInspectionEngine_::v2
struct DetectEngineAppInspectionEngine_::@82 v2
DETECT_PROFILE_NAME_LEN
#define DETECT_PROFILE_NAME_LEN
Definition: detect.h:789
DETECT_SM_LIST_PMATCH
@ DETECT_SM_LIST_PMATCH
Definition: detect.h:120
DetectBufferMpmRegistry_::direction
int direction
Definition: detect.h:794
DetectEngineThreadCtx_::to_clear_idx
uint32_t to_clear_idx
Definition: detect.h:1376
SignatureInitDataBuffer
struct SignatureInitDataBuffer_ SignatureInitDataBuffer
ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_AUTO
Definition: detect.h:1255
PrefilterEngineList_::sub_state
uint8_t sub_state
Definition: detect.h:1628
SigMatchFree
void SigMatchFree(DetectEngineCtx *, SigMatch *sm)
free a SigMatch
Definition: detect-parse.c:325
DetectEngineCtx_::class_conf_ht
HashTable * class_conf_ht
Definition: detect.h:1187
SignatureHook_::app_progress
uint8_t app_progress
Definition: detect.h:593
SignatureInitData_::smlists
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
Definition: detect.h:666
detect-engine-proto.h
DetectEngineThreadCtx_::keyword_perf_data
struct SCProfileKeywordData_ * keyword_perf_data
Definition: detect.h:1484
DetectEngineThreadCtx_::match_array_cnt
SigIntId match_array_cnt
Definition: detect.h:1415
DetectVarList_::idx
uint32_t idx
Definition: detect.h:860
MpmStore_::sid_array_size
uint32_t sid_array_size
Definition: detect.h:1596
PrefilterEngine_::PrefilterPostRule
void(* PrefilterPostRule)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f)
Definition: detect.h:1693
DetectEngineThreadCtx_::counter_alerts
StatsCounterId counter_alerts
Definition: detect.h:1361
SignatureHook_
Definition: detect.h:583
SigTableElmt_::desc
const char * desc
Definition: detect.h:1544
SignatureInitData_::list_set
bool list_set
Definition: detect.h:646
Signature_::addr_src_match6
DetectMatchAddressIPv6 * addr_src_match6
Definition: detect.h:739
ADDRESS_EB
@ ADDRESS_EB
Definition: detect.h:158
ADDRESS_LE
@ ADDRESS_LE
Definition: detect.h:155
DetectEngineThreadCtx_::SC_ATOMIC_DECLARE
SC_ATOMIC_DECLARE(int, so_far_used_by_detect)
Signature_::sig_str
char * sig_str
Definition: detect.h:773
MpmStore_::sid_array
uint8_t * sid_array
Definition: detect.h:1595
RuleMatchCandidateTx::fw_lte_header_ok
bool fw_lte_header_ok
Definition: detect.h:1271
DetectEngineThreadKeywordCtxItem
struct DetectEngineThreadKeywordCtxItem_ DetectEngineThreadKeywordCtxItem
DetectEngineCtx_::sgh_mpm_context_proto_tcp_packet
int32_t sgh_mpm_context_proto_tcp_packet
Definition: detect.h:1071
DetectEngineIPOnlyCtx_::tree_ipv6dst
SCRadix6Tree tree_ipv6dst
Definition: detect.h:879
SIG_TYPE_APP_TX
@ SIG_TYPE_APP_TX
Definition: detect.h:78
DetectPreFlow
uint8_t DetectPreFlow(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p)
Definition: detect.c:3197
DetectVarList_::buffer
uint8_t * buffer
Definition: detect.h:864
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1529
IPOnlyCIDRItem
struct IPOnlyCIDRItem_ IPOnlyCIDRItem
util-hashlist.h
DetectEngineCtx_::decoder_event_sgh
struct SigGroupHead_ * decoder_event_sgh
Definition: detect.h:1084
SignatureHook_::sm_list
int sm_list
Definition: detect.h:585
DetectEngineCtx_::flow_gh
DetectEngineLookupFlow flow_gh[FLOW_STATES]
Definition: detect.h:1023
DETECT_TABLE_APP_FILTER
@ DETECT_TABLE_APP_FILTER
Definition: detect.h:570
SCFPSupportSMList_::next
struct SCFPSupportSMList_ * next
Definition: detect.h:872
DetectFirewallAppPolicy
Definition: detect.h:951
SigString
struct SigString_ SigString
DetectEnginePktInspectionEngine
Definition: detect.h:492
DetectAddressHead_::contains_range
bool contains_range
Definition: detect.h:189
DetectEngineMasterCtx_::tenant_mapping_list
DetectEngineTenantMapping * tenant_mapping_list
Definition: detect.h:1790
Signature_::filestore_ctx
const struct DetectFilestoreData_ * filestore_ctx
Definition: detect.h:762
DetectEngineAppInspectionEngine_::next
struct DetectEngineAppInspectionEngine_ * next
Definition: detect.h:446
SigGroupHead_::flags
uint16_t flags
Definition: detect.h:1731
SignatureIsIPOnly
int SignatureIsIPOnly(DetectEngineCtx *de_ctx, const Signature *s)
Test is a initialized signature is IP only.
Definition: detect-engine-build.c:191
PostRuleMatchWorkQueue::len
uint32_t len
Definition: detect.h:1299
PostRuleMatchWorkQueueItem::sm_type
int sm_type
Definition: detect.h:1288
SCFPSupportSMList_::list_id
int list_id
Definition: detect.h:870
SigTableElmt_::name
const char * name
Definition: detect.h:1542
DetectEngineMasterCtx_::list
DetectEngineCtx * list
Definition: detect.h:1779
SignatureInitData_::smlists_tail
struct SigMatch_ * smlists_tail[DETECT_SM_LIST_MAX]
Definition: detect.h:668
DetectEngineThreadCtx_::filestore
struct DetectEngineThreadCtx_::@103 filestore[DETECT_FILESTORE_MAX]
MpmThreadCtx_
Definition: util-mpm.h:62
SignatureInitData_::dst_contains_range
bool dst_contains_range
Definition: detect.h:619
DetectPatternTracker::mpm
uint32_t mpm
Definition: detect.h:842
DetectEngineCtx
struct DetectEngineCtx_ DetectEngineCtx
main detection engine ctx
IPOnlyCIDRItem_::netmask
uint8_t netmask
Definition: detect.h:340
DetectEngineCtx_::type
enum DetectEngineType type
Definition: detect.h:1123
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1730
DetectEngineCtx_::pattern_hash_table
HashListTable * pattern_hash_table
Definition: detect.h:1032
DetectEngineThreadCtx_::sgh_perf_data
struct SCProfileSghData_ * sgh_perf_data
Definition: detect.h:1487
DetectEngineCtx_::firewall_rule_file_exclusive
const char * firewall_rule_file_exclusive
Definition: detect.h:1214
DetectEngineCtx_::guess_applayer
bool guess_applayer
Definition: detect.h:1046
PostRuleMatchWorkQueueItem
Definition: detect.h:1287
DetectEngineIPOnlyCtx_::tree_ipv4dst
SCRadix4Tree tree_ipv4dst
Definition: detect.h:878
DetectEngineTransforms
Definition: detect.h:395
PORT_EQ
@ PORT_EQ
Definition: detect.h:212
PrefilterEngineList_::id
uint16_t id
Definition: detect.h:1616
DetectBufferMpmRegistry_::sm_list_base
int16_t sm_list_base
Definition: detect.h:796
SigGroupHeadInitData_::sig_array
uint8_t * sig_array
Definition: detect.h:1704
PORT_LT
@ PORT_LT
Definition: detect.h:210
SCProfileSghDetectCtx_
Definition: util-profiling-rulegroups.c:48
DetectEngineCtx_::PreFlowHook
DetectPacketHookFunc PreFlowHook
Definition: detect.h:1228
Signature_::app_progress_hook
uint8_t app_progress_hook
Definition: detect.h:729
DetectAddress_
address structure for use in the detection engine.
Definition: detect.h:170
SigTableElmt_::flags
uint32_t flags
Definition: detect.h:1533
DetectEngineCtx_::max_uniq_toclient_groups
uint16_t max_uniq_toclient_groups
Definition: detect.h:1057
DetectEngineThreadCtx_::buffers
InspectionBufferMultipleForList * buffers
Definition: detect.h:1383
SignatureInitData_::prefilter_sm
SigMatch * prefilter_sm
Definition: detect.h:642
PrefilterRuleStore_
structure for storing potential rule matches
Definition: util-prefilter.h:34
SignatureInitData_::src_contains_negation
bool src_contains_negation
Definition: detect.h:615
DetectEngineCtx_::ref_cnt
uint32_t ref_cnt
Definition: detect.h:1126
DetectEngineCtx_::sigerror_silent
bool sigerror_silent
Definition: detect.h:1096
DetectEngineAppInspectionEngine_::Callback
InspectEngineFuncPtr Callback
Definition: detect.h:439
Signature_::alproto
AppProto alproto
Definition: detect.h:697
DETECT_TABLE_PACKET_PRE_STREAM
@ DETECT_TABLE_PACKET_PRE_STREAM
Definition: detect.h:567
SignatureInitData_::is_rule_state_dependant
bool is_rule_state_dependant
Definition: detect.h:680
SignatureNonPrefilterStore_::id
SigIntId id
Definition: detect.h:1262
SigString_
Definition: detect.h:897
DetectAddressHead_
Definition: detect.h:185
MPMB_OTHERIP
@ MPMB_OTHERIP
Definition: detect.h:1590
DetectEngineCtx_::filedata_config
DetectFileDataCfg * filedata_config
Definition: detect.h:1109
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
DetectEngineFrameInspectionEngine::sm_list_base
uint16_t sm_list_base
Definition: detect.h:523
DetectPort_::port
uint16_t port
Definition: detect.h:224
SigMatchData_::is_last
bool is_last
Definition: detect.h:371
SignatureHook_::app
struct SignatureHook_::@87::@88 app
DetectEngineIPOnlyCtx_::ip_src
IPOnlyCIDRItem * ip_src
Definition: detect.h:882
DetectBufferMpmRegistry_::app_v2
struct DetectBufferMpmRegistry_::@90::@92 app_v2
name
const char * name
Definition: detect-engine-proto.c:47
ADDRESS_LT
@ ADDRESS_LT
Definition: detect.h:154
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:87
DETECT_SM_LIST_DYNAMIC_START
@ DETECT_SM_LIST_DYNAMIC_START
Definition: detect.h:139
IPOnlyCIDRItem_
Definition: detect.h:336
DetectFileDataCfg
Definition: detect.h:977
DetectEngineThreadCtx_::tx_id
uint64_t tx_id
Definition: detect.h:1392
DetectEngineThreadCtx_::decoder_events
AppLayerDecoderEvents * decoder_events
Definition: detect.h:1452
SigMatchData_::ctx
SigMatchCtx * ctx
Definition: detect.h:372
FILE_DECODER_EVENT_INVALID_SWF_VERSION
@ FILE_DECODER_EVENT_INVALID_SWF_VERSION
Definition: detect.h:1558
SignatureHook_::t
union SignatureHook_::@87 t
InspectionBuffer
Definition: detect-engine-inspect-buffer.h:34
DetectVarList_::key_len
uint16_t key_len
Definition: detect.h:862
DetectEngineCtx_::PreStreamHook
DetectPacketHookFunc PreStreamHook
Definition: detect.h:1223
MpmStore_::sm_list
int sm_list
Definition: detect.h:1600
DetectEngineAppInspectionEngine_::GetData
InspectionBufferGetDataPtr GetData
Definition: detect.h:435
DetectEngineThreadKeywordCtxItem_
Definition: detect.h:915
DetectTable
DetectTable
Definition: detect.h:564
DetectEngineCtx_::pkt_mpms_list
DetectBufferMpmRegistry * pkt_mpms_list
Definition: detect.h:1159
DETECT_BUFFER_MPM_TYPE_FRAME
@ DETECT_BUFFER_MPM_TYPE_FRAME
Definition: detect.h:784
Frame
Definition: app-layer-frames.h:49
Flow_
Flow data structure.
Definition: flow.h:359
SigTableElmt_::FileMatch
int(* FileMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, File *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1512
DetectVarList_
Definition: detect.h:857
DETECT_SM_LIST_THRESHOLD
@ DETECT_SM_LIST_THRESHOLD
Definition: detect.h:134
DetectReplaceList_::found
uint8_t * found
Definition: detect.h:847
DetectFirewallPacketPolicies
DetectFirewallPacketPolicies
Definition: detect.h:938
PrefilterEngine_::tx_min_progress
int8_t tx_min_progress
Definition: detect.h:1671
DetectBufferMpmRegistry_::tx_min_progress
uint8_t tx_min_progress
Definition: detect.h:815
DetectEngineThreadKeywordCtxItem_::data
void * data
Definition: detect.h:918
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1429
util-hash.h
EngineAnalysisCtx_
Definition: detect-engine-analyzer.c:89
InspectionBufferGetDataPtr
InspectionBuffer *(* InspectionBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Flow *f, const uint8_t flow_flags, void *txv, const int list_id)
Definition: detect.h:401
SigGroupHeadInitData_::mpm_store
MpmStore mpm_store[MPMB_MAX]
Definition: detect.h:1702
SigFindSignatureBySidGid
Signature * SigFindSignatureBySidGid(DetectEngineCtx *, uint32_t, uint32_t)
Find a specific signature by sid and gid.
Definition: detect-engine-build.c:80
DetectFirewallAppPolicy::sub_state
uint8_t sub_state
Definition: detect.h:953
DetectEngineIPOnlyCtx_::tree_ipv4src
SCRadix4Tree tree_ipv4src
Definition: detect.h:878
DetectEngineCtx_::inspection_recursion_limit
int inspection_recursion_limit
Definition: detect.h:1040
PrefilterEngineList_::name
const char * name
Definition: detect.h:1652
DetectVarList_::len
uint16_t len
Definition: detect.h:861
DetectEngineFrameInspectionEngine::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:527
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:995
DetectEnginePktInspectionEngine::smd
SigMatchData * smd
Definition: detect.h:493
DetectPatternTracker
struct DetectPatternTracker DetectPatternTracker
SCProfilePrefilterDetectCtx_
Definition: util-profiling-prefilter.c:47
SIG_TYPE_PKT_STREAM
@ SIG_TYPE_PKT_STREAM
Definition: detect.h:74
DetectEngineCtx_::pre_stream_sgh
struct SigGroupHead_ * pre_stream_sgh[2]
Definition: detect.h:1225
SigMatchSignatures
void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:3305
DetectEngineThreadCtx_::global_keyword_ctxs_array
void ** global_keyword_ctxs_array
Definition: detect.h:1450
TransformData_::options
void * options
Definition: detect.h:392
DetectFirewallAppPolicy::policy
struct DetectFirewallPolicy policy
Definition: detect.h:956
DetectEngineFrameInspectionEngine::mpm
bool mpm
Definition: detect.h:521
detect-engine-register.h
SIGNATURE_HOOK_PKT_NOT_SET
@ SIGNATURE_HOOK_PKT_NOT_SET
Definition: detect.h:548
SCDetectRateFilterFunc
uint8_t(* SCDetectRateFilterFunc)(const Packet *p, uint32_t sid, uint32_t gid, uint32_t rev, uint8_t original_action, uint8_t new_action, void *arg)
Function type for rate filter callback.
Definition: detect.h:991
DetectFirewallPolicies::pkt_policy_signatures
Signature * pkt_policy_signatures[DETECT_FIREWALL_POLICY_SIZE]
Definition: detect.h:965
DetectEngineCtx_::reference_conf_regex_match
pcre2_match_data * reference_conf_regex_match
Definition: detect.h:1196
RuleMatchCandidateTxArrayFree
void RuleMatchCandidateTxArrayFree(DetectEngineThreadCtx *det_ctx)
Definition: detect.c:1197
DetectEngineThreadCtx_::p
Packet * p
Definition: detect.h:1396
SigTableElmt_::AppLayerTxMatch
int(* AppLayerTxMatch)(DetectEngineThreadCtx *, Flow *, uint8_t flags, void *alstate, void *txv, const Signature *, const SigMatchCtx *)
Definition: detect.h:1507
DetectEngineThreadCtx_::keyword_perf_list
int keyword_perf_list
Definition: detect.h:1486
DetectEngineCtx_::mpm_cfg
MpmConfig * mpm_cfg
Definition: detect.h:1002
InspectionBufferGetPktDataPtr
InspectionBuffer *(* InspectionBufferGetPktDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Packet *p, const int list_id)
Definition: detect.h:487
PrefilterEngine_::cb
union PrefilterEngine_::@105 cb
ADDRESS_EQ
@ ADDRESS_EQ
Definition: detect.h:156
DetectEngineCtx_::keyword_id
int keyword_id
Definition: detect.h:1105
RuleMatchCandidateTx::id
SigIntId id
Definition: detect.h:1269
Detect
TmEcode Detect(ThreadVars *tv, Packet *p, void *data)
Detection engine thread wrapper.
Definition: detect.c:3226
DetectBufferMpmRegistry_::type
uint8_t type
Definition: detect.h:830
SignatureProperties
Definition: detect.h:90
DetectBufferMpmRegistry_::next
struct DetectBufferMpmRegistry_ * next
Definition: detect.h:834
HashTable_
Definition: util-hash.h:35
DetectPatternTracker::cnt
uint32_t cnt
Definition: detect.h:841
DetectEngineTenantMapping_::next
struct DetectEngineTenantMapping_ * next
Definition: detect.h:1765
DetectEngineThreadCtx_::buffers_size
uint32_t buffers_size
Definition: detect.h:1375
DetectEngineCtx_::srep_version
uint32_t srep_version
Definition: detect.h:1009
DetectEngineCtx_::profile_sgh_ctx
struct SCProfileSghDetectCtx_ * profile_sgh_ctx
Definition: detect.h:1118
Frames
Definition: app-layer-frames.h:64
DetectBufferMpmRegistry_
one time registration of keywords at start up
Definition: detect.h:791
DetectPort_::next
struct DetectPort_ * next
Definition: detect.h:237
PORT_EB
@ PORT_EB
Definition: detect.h:214
DetectEngineCtx_::tcp_priorityports
DetectPort * tcp_priorityports
Definition: detect.h:1138
DetectReplaceList_
Definition: detect.h:845
MPMB_TCP_STREAM_TS
@ MPMB_TCP_STREAM_TS
Definition: detect.h:1586
DetectEngineThreadCtx_::counter_alerts_overflow
StatsCounterId counter_alerts_overflow
Definition: detect.h:1363
DetectEngineAppInspectionEngine_::sm_list_base
uint16_t sm_list_base
Definition: detect.h:429
SigTableElmt_::TransformId
void(* TransformId)(const uint8_t **data, uint32_t *length, const void *context)
Definition: detect.h:1521
Address_
Definition: decode.h:113
DetectPatternTracker::cd
const struct DetectContentData_ * cd
Definition: detect.h:839
DetectEngineCtx_::sigerror_requires
bool sigerror_requires
Definition: detect.h:1100
DetectEngineThreadCtx_::spm_thread_ctx
SpmThreadCtx * spm_thread_ctx
Definition: detect.h:1348
DetectAddressHead
struct DetectAddressHead_ DetectAddressHead
FILE_DECODER_EVENT_Z_UNKNOWN_ERROR
@ FILE_DECODER_EVENT_Z_UNKNOWN_ERROR
Definition: detect.h:1562
DetectEngineCtx_::dport_hash_table
HashListTable * dport_hash_table
Definition: detect.h:1136
p
Packet * p
Definition: fuzz_dataset.c:30
SignatureInitDataBuffer_::multi_capable
bool multi_capable
Definition: detect.h:538
Signature_::sm_arrays
SigMatchData * sm_arrays[DETECT_SM_LIST_MAX]
Definition: detect.h:759
SigGroupHead_::payload_engines
PrefilterEngine * payload_engines
Definition: detect.h:1741
StatsCounterId
Definition: counters.h:30
DetectEngineCtx_::mpm_ctx_factory_container
MpmCtxFactoryContainer * mpm_ctx_factory_container
Definition: detect.h:1063
DetectEngineCtx_::prefilter_setting
enum DetectEnginePrefilterSetting prefilter_setting
Definition: detect.h:1134
SignatureInitData_::init_flags
uint32_t init_flags
Definition: detect.h:625
DetectEngineCtx_::reference_conf_regex
pcre2_code * reference_conf_regex
Definition: detect.h:1195
DetectBufferType_
Definition: detect.h:454
DetectPort_::sh
struct SigGroupHead_ * sh
Definition: detect.h:234
DetectEngineCtx_::udp_priorityports
DetectPort * udp_priorityports
Definition: detect.h:1139
DetectContentData_
Definition: detect-content.h:93
DetectEngineSetEvent
void DetectEngineSetEvent(DetectEngineThreadCtx *det_ctx, uint8_t e)
Definition: detect-engine.c:5327
SigFileLoaderStat_::TAILQ_HEAD
TAILQ_HEAD(, SigString_) failed_sigs
PostRuleMatchWorkQueue::size
uint32_t size
Definition: detect.h:1300
ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_FULL
Definition: detect.h:1253
DetectEngineThreadCtx_::counter_alerts_suppressed
StatsCounterId counter_alerts_suppressed
Definition: detect.h:1367
DetectEngineCtx_::sigerror_ok
bool sigerror_ok
Definition: detect.h:1097
DetectEngineCtx_::class_conf_regex
pcre2_code * class_conf_regex
Definition: detect.h:1188
DetectEngineThreadCtx_::lua_instruction_limit_errors
StatsCounterId lua_instruction_limit_errors
Definition: detect.h:1462
DetectEngineThreadCtx_::counter_firewall_discarded_alerts
StatsCounterId counter_firewall_discarded_alerts
Definition: detect.h:1365
PrefilterEngine_::local_id
uint16_t local_id
Definition: detect.h:1658
PrefilterEngineList_::Free
void(* Free)(void *pectx)
Definition: detect.h:1645
PostRuleMatchWorkQueueItem
struct PostRuleMatchWorkQueueItem PostRuleMatchWorkQueueItem
RuleMatchCandidateTxArrayInit
void RuleMatchCandidateTxArrayInit(DetectEngineThreadCtx *det_ctx, uint32_t size)
Definition: detect.c:1184
MPMB_MAX
@ MPMB_MAX
Definition: detect.h:1591
SigTableElmt_
element in sigmatch type table.
Definition: detect.h:1502
SCDetectRequiresStatus
struct SCDetectRequiresStatus SCDetectRequiresStatus
Definition: detect.h:62
SigMatchData_
Data needed for Match()
Definition: detect.h:369
InspectionBufferMultipleForList::init
uint32_t init
Definition: detect.h:387
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1524
DetectFirewallAppPolicy::alert_signature
Signature * alert_signature
Definition: detect.h:959
DetectEngineCtx_::sgh_mpm_context_proto_udp_packet
int32_t sgh_mpm_context_proto_udp_packet
Definition: detect.h:1072
DetectPort
struct DetectPort_ DetectPort
Port structure for detection engine.
RuleMatchCandidateTx::s
const Signature * s
Definition: detect.h:1281
DetectEngineCtx_::reference_conf_ht
HashTable * reference_conf_ht
Definition: detect.h:1194
DetectBufferMpmRegistry_::transforms
DetectEngineTransforms transforms
Definition: detect.h:804
SIG_TYPE_APPLAYER
@ SIG_TYPE_APPLAYER
Definition: detect.h:77
SigMatchData_::type
uint16_t type
Definition: detect.h:370
DetectEngineCtx_::version
uint32_t version
Definition: detect.h:1080
DetectMatchAddressIPv4_::ip
uint32_t ip
Definition: detect.h:194
DetectFirewallPolicy::action
uint8_t action
Definition: detect.h:947
DETECT_TRANSFORMS_MAX
#define DETECT_TRANSFORMS_MAX
Definition: detect.h:49
DetectEngineThreadCtx_::varlist
DetectVarList * varlist
Definition: detect.h:1434
Signature_::dsize_low
uint16_t dsize_low
Definition: detect.h:699
DetectPort_::port2
uint16_t port2
Definition: detect.h:225
DetectEngineCtx_::non_pf_engine_names
HashTable * non_pf_engine_names
Definition: detect.h:1212
SignatureNonPrefilterStore_
Definition: detect.h:1261
MPMB_TCP_STREAM_TC
@ MPMB_TCP_STREAM_TC
Definition: detect.h:1587
DetectEngineThreadCtx_::events
uint16_t events
Definition: detect.h:1453
SIG_JSON_CONTENT_ITEM_LEN
#define SIG_JSON_CONTENT_ITEM_LEN
Definition: detect.h:1304
AppLayerDecoderEvents_
Data structure to store app layer decoder events.
Definition: app-layer-events.h:33
SigGroupHead
struct SigGroupHead_ SigGroupHead
Container for matching data for a signature group.
DetectMatchAddressIPv6
struct DetectMatchAddressIPv6_ DetectMatchAddressIPv6
DetectUnregisterThreadCtxFuncs
int DetectUnregisterThreadCtxFuncs(DetectEngineCtx *, void *data, const char *name)
Remove Thread keyword context registration.
Definition: detect-engine.c:4015
TransformIdData
struct TransformIdData_ TransformIdData
TransformData_
Definition: detect.h:390
FLOW_STATES
#define FLOW_STATES
Definition: detect.h:975
Signature_::frame_inspect
DetectEngineFrameInspectionEngine * frame_inspect
Definition: detect.h:755
DetectEngineIPOnlyCtx_::tree_ipv6src
SCRadix6Tree tree_ipv6src
Definition: detect.h:879
DetectEnginePktInspectionEngine::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:501
MpmBuiltinBuffers
MpmBuiltinBuffers
Definition: detect.h:1583
DetectPort_::flags
uint8_t flags
Definition: detect.h:227
DetectBufferType_::SetupCallback
void(* SetupCallback)(const struct DetectEngineCtx_ *, struct Signature_ *, const struct DetectBufferType_ *)
Definition: detect.h:467
SigRegisterTests
void SigRegisterTests(void)
Definition: detect.c:4808
DetectThreadCtxGetKeywordThreadCtx
void * DetectThreadCtxGetKeywordThreadCtx(DetectEngineThreadCtx *, int)
Retrieve thread local keyword ctx by id.
Definition: detect-engine.c:4033
DetectEngineFrameInspectionEngine::Callback
InspectionBufferFrameInspectFunc Callback
Definition: detect.h:525
RuleMatchCandidateTx::fw_lte_counted
bool fw_lte_counted
Definition: detect.h:1270
InspectionBufferMultipleForList::size
uint32_t size
Definition: detect.h:385
DetectEngineThreadCtx_::mt_det_ctxs_hash
HashTable * mt_det_ctxs_hash
Definition: detect.h:1328
DetectBufferMpmRegistry_::pkt_v1
struct DetectBufferMpmRegistry_::@90::@93 pkt_v1
DetectAddress_::prev
struct DetectAddress_ * prev
Definition: detect.h:179
DETECT_PREFILTER_AUTO
@ DETECT_PREFILTER_AUTO
Definition: detect.h:927
DetectEngineThreadCtx_::keyword_ctxs_size
int keyword_ctxs_size
Definition: detect.h:1447
PrefilterEngine_::is_last_for_progress
bool is_last_for_progress
Definition: detect.h:1678
detect-reference.h
Signature_::gid
uint32_t gid
Definition: detect.h:742
DetectEngineCtx_::prefilter_id
uint32_t prefilter_id
Definition: detect.h:1165
DetectEngineCtx_::sgh_array_size
uint32_t sgh_array_size
Definition: detect.h:1069
SigGroupHeadInitData_::pkt_mpms
MpmCtx ** pkt_mpms
Definition: detect.h:1713
SigString_::sig_error
char * sig_error
Definition: detect.h:900
DetectMatchAddressIPv6_::ip2
uint32_t ip2[4]
Definition: detect.h:200
DetectEngineAppInspectionEngine_::id
uint8_t id
Definition: detect.h:423
SCRadix4Tree_
Structure for the radix tree.
Definition: util-radix4-tree.h:66
PrefilterEngineList_::next
struct PrefilterEngineList_ * next
Definition: detect.h:1642
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1527
DetectEngineCtx_::base64_decode_max_len
uint16_t base64_decode_max_len
Definition: detect.h:1090
SIGNATURE_HOOK_TYPE_APP
@ SIGNATURE_HOOK_TYPE_APP
Definition: detect.h:558
Signature_::next
struct Signature_ * next
Definition: detect.h:778
DetectEngineThreadCtx_::multi_inspect
struct DetectEngineThreadCtx_::@102 multi_inspect
DetectEngineCtx_::sgh_mpm_context_proto_other_packet
int32_t sgh_mpm_context_proto_other_packet
Definition: detect.h:1073
DetectVarList
struct DetectVarList_ DetectVarList
DetectEngineAppInspectionEngine_::sm_list
uint16_t sm_list
Definition: detect.h:428
TENANT_SELECTOR_UNKNOWN
@ TENANT_SELECTOR_UNKNOWN
Definition: detect.h:1753
DetectEngineTenantMapping_::tenant_id
uint32_t tenant_id
Definition: detect.h:1760
InspectionBufferMultipleForList
Definition: detect.h:383
SigFileLoaderStat_::skipped_sigs_total
int skipped_sigs_total
Definition: detect.h:912
DetectBufferMpmType
DetectBufferMpmType
Definition: detect.h:781
DETECT_SM_LIST_POSTMATCH
@ DETECT_SM_LIST_POSTMATCH
Definition: detect.h:128
DetectEngineTenantMapping
struct DetectEngineTenantMapping_ DetectEngineTenantMapping
DetectEngineCtx_::prefilter_hash_table
HashListTable * prefilter_hash_table
Definition: detect.h:1166
SigGroupHeadInitData_::score
int score
Definition: detect.h:1709
DetectReplaceList
struct DetectReplaceList_ DetectReplaceList
SignatureHook_::sub_state
uint8_t sub_state
Definition: detect.h:590
SignaturePropertyFlowAction
SignaturePropertyFlowAction
Definition: detect.h:84
DetectPreStream
uint8_t DetectPreStream(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p)
Definition: detect.c:3207
SigString_::TAILQ_ENTRY
TAILQ_ENTRY(SigString_) next
DetectEngineTenantSelectors
DetectEngineTenantSelectors
Definition: detect.h:1752
DetectBufferMpmRegistry_::GetData
InspectionBufferGetDataPtr GetData
Definition: detect.h:810
detect-engine-inspect-buffer.h
DetectFileDataCfg::content_inspect_min_size
uint32_t content_inspect_min_size
Definition: detect.h:979
InspectionBufferPktInspectFunc
int(* InspectionBufferPktInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEnginePktInspectionEngine *engine, const struct Signature_ *s, Packet *p, uint8_t *alert_flags)
Definition: detect.h:480
DetectEngineCtx_::pre_flow_sgh
struct SigGroupHead_ * pre_flow_sgh
Definition: detect.h:1230
DetectBufferType
struct DetectBufferType_ DetectBufferType
DetectEngineCtx_::class_conf_regex_match
pcre2_match_data * class_conf_regex_match
Definition: detect.h:1189
DetectEngineThreadCtx_::tx_candidates
RuleMatchCandidateTx * tx_candidates
Definition: detect.h:1417
SIG_TYPE_PKT
@ SIG_TYPE_PKT
Definition: detect.h:73
DetectEngineCtx_::requirements
SCDetectRequiresStatus * requirements
Definition: detect.h:1205
DetectEngineMasterCtx
struct DetectEngineMasterCtx_ DetectEngineMasterCtx
Signature_::addr_src_match4
DetectMatchAddressIPv4 * addr_src_match4
Definition: detect.h:736
DetectBufferMpmRegistry_::pname
char pname[DETECT_PROFILE_NAME_LEN]
Definition: detect.h:793
PrefilterEngineList_::pkt_hook
enum SignatureHookPkt pkt_hook
Definition: detect.h:1630
Signature_::class_id
uint16_t class_id
Definition: detect.h:723
DetectBufferMpmRegistry_::frame_v1
struct DetectBufferMpmRegistry_::@90::@94 frame_v1
DetectBufferType_::ValidateCallback
bool(* ValidateCallback)(const struct Signature_ *, const char **sigerror, const struct DetectBufferType_ *)
Definition: detect.h:469
DETECT_FILESTORE_MAX
#define DETECT_FILESTORE_MAX
Definition: detect.h:1259
PrefilterEngineList_::alproto
AppProto alproto
Definition: detect.h:1619
DetectEngineCtx_::fw_policies
struct DetectFirewallPolicies * fw_policies
Definition: detect.h:1026
SigTableElmt_::TransformValidate
bool(* TransformValidate)(const uint8_t *content, uint16_t content_len, const void *context)
Definition: detect.h:1518
SignatureInitData
struct SignatureInitData_ SignatureInitData
SigGroupHeadInitData_::sig_cnt
SigIntId sig_cnt
Definition: detect.h:1723
DetectEngineThreadCtx_::counter_mpm_list
StatsCounterAvgId counter_mpm_list
Definition: detect.h:1369
SRepCIDRTree_
Definition: reputation.h:40
AppLayerTxData
Definition: app-layer-parser.h:172
DetectBufferMpmRegistry_::sgh_mpm_context
int sgh_mpm_context
Definition: detect.h:800
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:22
DetectEnginePktInspectionEngine::sm_list
uint16_t sm_list
Definition: detect.h:495
DetectEngineThreadCtx_::match_array_len
uint32_t match_array_len
Definition: detect.h:1413
DetectBufferMpmRegistry_::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect.h:824
DETECT_EVENT_TOO_MANY_BUFFERS
@ DETECT_EVENT_TOO_MANY_BUFFERS
Definition: detect.h:1570
IPOnlyCIDRItem_::negated
uint8_t negated
Definition: detect.h:342
PrefilterEngineList_::run_always
bool run_always
Definition: detect.h:1650
SignatureInitData_::buffers_size
uint32_t buffers_size
Definition: detect.h:673
DetectEngineThreadCtx_
Definition: detect.h:1316
DetectEngineThreadCtx_::lua_memory_limit_errors
StatsCounterId lua_memory_limit_errors
Definition: detect.h:1465
PrefilterEngine_
Definition: detect.h:1657
MpmStore_
Definition: detect.h:1594
SigGroupHeadInitData_::tx_engines
PrefilterEngineList * tx_engines
Definition: detect.h:1718
SIG_TYPE_IPONLY
@ SIG_TYPE_IPONLY
Definition: detect.h:67
SCProfileKeywordDetectCtx_
Definition: util-profiling-keywords.c:48
SignatureInitData_::mpm_sm
SigMatch * mpm_sm
Definition: detect.h:640
length
uint16_t length
Definition: decode-sctp.h:2
DetectEngineCtx_::srepCIDR_ctx
SRepCIDRTree * srepCIDR_ctx
Definition: detect.h:1012
SignatureInitData_::src
const DetectAddressHead * src
Definition: detect.h:663
DetectEngineThreadCtx_::tx_candidates_size
uint32_t tx_candidates_size
Definition: detect.h:1418
signature_properties
const struct SignatureProperties signature_properties[SIG_TYPE_MAX]
Definition: detect-engine.c:118
DETECT_SM_LIST_BASE64_DATA
@ DETECT_SM_LIST_BASE64_DATA
Definition: detect.h:125
ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE
@ ENGINE_SGH_MPM_FACTORY_CONTEXT_SINGLE
Definition: detect.h:1254
DetectEngineThreadKeywordCtxItem_::id
int id
Definition: detect.h:920
DetectBufferMpmRegistry_::sm_list
int16_t sm_list
Definition: detect.h:795
DetectEngineThreadCtx_::buffers
InspectionBuffer * buffers
Definition: detect.h:1374
DetectEngineMasterCtx_::keyword_list
DetectEngineThreadKeywordCtxItem * keyword_list
Definition: detect.h:1795
SigTableElmt_::Cleanup
void(* Cleanup)(struct SigTableElmt_ *)
Definition: detect.h:1548
SignatureInitData_::mpm_sm_list
int mpm_sm_list
Definition: detect.h:638
PrefilterEngineList_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1638
PrefilterEngine_::ctx
union PrefilterEngine_::@104 ctx
DetectEngineMasterCtx_::tenant_selector
enum DetectEngineTenantSelectors tenant_selector
Definition: detect.h:1786
DetectEngineCtx_::keyword_hash
HashListTable * keyword_hash
Definition: detect.h:1107
PrefilterEngineList_::pectx
void * pectx
Definition: detect.h:1634
SignatureInitData_::cidr_dst
IPOnlyCIDRItem * cidr_dst
Definition: detect.h:635
ADDRESS_GE
@ ADDRESS_GE
Definition: detect.h:159
DetectEngineCtx_::last_reload
struct timeval last_reload
Definition: detect.h:1169
SignatureInitData_::list
int list
Definition: detect.h:645
DetectEngineCtx_::failure_fatal
bool failure_fatal
Definition: detect.h:996
Signature_::pkt_inspect
DetectEnginePktInspectionEngine * pkt_inspect
Definition: detect.h:754
DetectEngineAppInspectionEngine_::GetMultiData
InspectionMultiBufferGetDataPtr GetMultiData
Definition: detect.h:437
DetectEngineCtx_::max_flowbits
uint8_t max_flowbits
Definition: detect.h:999
SCProfileSghData_
Definition: util-profiling-rulegroups.c:37
DetectReplaceList_::next
struct DetectReplaceList_ * next
Definition: detect.h:848
DetectEngineLookupFlow_::sgh
struct SigGroupHead_ * sgh[256]
Definition: detect.h:894
Signature_::references
DetectReference * references
Definition: detect.h:769
SigTableElmt_::tables
uint8_t tables
Definition: detect.h:1537
PrefilterEngineList_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1637
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
DetectEngineCtx_::sm_types_prefilter
bool * sm_types_prefilter
Definition: detect.h:1181
SignatureNonPrefilterStore_::alproto
AppProto alproto
Definition: detect.h:1264
SignatureInitData_::rule_state_flowbits_ids_size
uint32_t rule_state_flowbits_ids_size
Definition: detect.h:685
SignatureHookPkt
SignatureHookPkt
Definition: detect.h:547
PrefilterEngineList_::gid
uint32_t gid
Definition: detect.h:1654
DetectEngineFrameInspectionEngine::sm_list
uint16_t sm_list
Definition: detect.h:522
DetectMetadataHead
Definition: detect-metadata.h:39
SigTableElmt
struct SigTableElmt_ SigTableElmt
element in sigmatch type table.
SigMatch
struct SigMatch_ SigMatch
a single match condition for a signature
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:364
DetectFirewallPolicies::pkt
struct DetectFirewallPolicy pkt[DETECT_FIREWALL_POLICY_SIZE]
Definition: detect.h:964
DetectEngineCtx_::mpm_matcher
uint8_t mpm_matcher
Definition: detect.h:998
DETECT_TABLE_PACKET_PRE_FLOW
@ DETECT_TABLE_PACKET_PRE_FLOW
Definition: detect.h:566
DetectBufferMpmRegistry_::GetDataSingle
InspectionSingleBufferGetDataPtr GetDataSingle
Definition: detect.h:811
SignatureInitData_::proto
DetectProto proto
Definition: detect.h:655
DETECT_TABLE_PACKET_FILTER
@ DETECT_TABLE_PACKET_FILTER
Definition: detect.h:568
DetectFirewallAppPolicy::progress
uint8_t progress
Definition: detect.h:954
DetectEngineCtx_::frame_inspect_engines
DetectEngineFrameInspectionEngine * frame_inspect_engines
Definition: detect.h:1161
DetectBufferMpmRegistry_::priority
int priority
Definition: detect.h:797
PORT_ES
@ PORT_ES
Definition: detect.h:213
PrefilterEngineList
struct PrefilterEngineList_ PrefilterEngineList
DetectEngineMasterCtx_::free_list
DetectEngineCtx * free_list
Definition: detect.h:1784
DetectVarList_::type
uint16_t type
Definition: detect.h:858
DetectEngineCtx_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1208
DetectEngineThreadKeywordCtxItem_::next
struct DetectEngineThreadKeywordCtxItem_ * next
Definition: detect.h:919
DetectAddress_::ip2
Address ip2
Definition: detect.h:173
PrefilterFrameFn
void(* PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, const struct Frames *frames, const struct Frame *frame)
Definition: detect.h:1608
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:118
DetectPort_
Port structure for detection engine.
Definition: detect.h:223
SigGroupHead_::init
SigGroupHeadInitData * init
Definition: detect.h:1747
DetectEngineCtx_::sig_cnt
uint32_t sig_cnt
Definition: detect.h:1006
SignatureHook_::pkt
struct SignatureHook_::@87::@89 pkt
DetectEngineThreadCtx_::json_content_capacity
uint8_t json_content_capacity
Definition: detect.h:1354
SigTableElmt_::alternative
uint16_t alternative
Definition: detect.h:1540
SignatureInitData_::cidr_src
IPOnlyCIDRItem * cidr_src
Definition: detect.h:635
app-layer-parser.h
Signature_::app_inspect
DetectEngineAppInspectionEngine * app_inspect
Definition: detect.h:753
PrefilterEngine_::sub_state
uint8_t sub_state
Definition: detect.h:1672
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:363
DetectReference_
Signature reference list.
Definition: detect-reference.h:30
SignatureInitData_::hook
SignatureHook hook
Definition: detect.h:604
SIGNATURE_HOOK_TYPE_NOT_SET
@ SIGNATURE_HOOK_TYPE_NOT_SET
Definition: detect.h:556
SigFileLoaderStat_::bad_sigs_total
int bad_sigs_total
Definition: detect.h:911
Signature_::sub_state
uint8_t sub_state
Definition: detect.h:733
SigGroupHeadInitData_::direction
uint32_t direction
Definition: detect.h:1708
DetectEngineThreadCtx_::lua_rule_errors
StatsCounterId lua_rule_errors
Definition: detect.h:1456
DetectLoadCompleteSigPath
char * DetectLoadCompleteSigPath(const DetectEngineCtx *, const char *sig_file)
Create the path if default-rule-path was specified.
Definition: detect-engine-loader.c:108
PrefilterEngine_::pkt
struct PrefilterEngine_::@104::@106 pkt
MpmStore_::direction
int direction
Definition: detect.h:1598
DetectEngineThreadCtx_::base64_decoded_len
int base64_decoded_len
Definition: detect.h:1399
DetectVarList_::next
struct DetectVarList_ * next
Definition: detect.h:866
RuleMatchCandidateTx::stream_result
uint8_t stream_result
Definition: detect.h:1276
Signature_::action
uint8_t action
Definition: detect.h:707
DetectEngineLookupFlow_::udp
DetectPort * udp
Definition: detect.h:893
DetectEngineThreadCtx_::raw_stream_progress
uint64_t raw_stream_progress
Definition: detect.h:1337
SignatureHook_::alproto
AppProto alproto
Definition: detect.h:588
SignatureHookType
SignatureHookType
Definition: detect.h:555
SigIntId
#define SigIntId
Definition: detect-engine-state.h:38
PrefilterEngine_::alproto
AppProto alproto
Definition: detect.h:1661
Signature_::flags
uint32_t flags
Definition: detect.h:693
DetectEngineFrameInspectionEngine::v1
struct DetectEngineFrameInspectionEngine::@86 v1
PostRuleMatchWorkQueue
struct PostRuleMatchWorkQueue PostRuleMatchWorkQueue
DetectBufferType_::xform_id
TransformIdData xform_id[DETECT_TRANSFORMS_MAX]
Definition: detect.h:472
IPOnlyCIDRItem_::next
struct IPOnlyCIDRItem_ * next
Definition: detect.h:348
DetectEngineCtx_::max_fb_id
uint32_t max_fb_id
Definition: detect.h:1061
DetectEngineIPOnlyCtx_::sig_mapping
uint32_t * sig_mapping
Definition: detect.h:887
Packet_
Definition: decode.h:516
DetectEngineFrameInspectionEngine::alproto
AppProto alproto
Definition: detect.h:518
DetectEngineCtx_::sgh_mpm_context_stream
int32_t sgh_mpm_context_stream
Definition: detect.h:1074
SignatureNonPrefilterStore
struct SignatureNonPrefilterStore_ SignatureNonPrefilterStore
DetectBufferMpmRegistry
struct DetectBufferMpmRegistry_ DetectBufferMpmRegistry
one time registration of keywords at start up
DetectPort_::last
struct DetectPort_ * last
Definition: detect.h:238
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:78
DetectEngineThreadCtx_::frame_id
int64_t frame_id
Definition: detect.h:1393
FILE_DECODER_EVENT_Z_BUF_ERROR
@ FILE_DECODER_EVENT_Z_BUF_ERROR
Definition: detect.h:1561
InspectionBufferFrameInspectFunc
int(* InspectionBufferFrameInspectFunc)(struct DetectEngineThreadCtx_ *, const struct DetectEngineFrameInspectionEngine *engine, const struct Signature_ *s, Packet *p, const struct Frames *frames, const struct Frame *frame)
Definition: detect.h:513
DetectEngineCtx_::frame_mpms_list
DetectBufferMpmRegistry * frame_mpms_list
Definition: detect.h:1162
TransformData
struct TransformData_ TransformData
DetectEngineCtx_::sgh_mpm_ctx_cnf
uint8_t sgh_mpm_ctx_cnf
Definition: detect.h:1103
DetectEngineAppInspectionEngine_::match_on_null
bool match_on_null
Definition: detect.h:427
DetectBufferType_::packet
bool packet
Definition: detect.h:460
SCSigOrderFunc_
Structure holding the signature ordering function used by the signature ordering module.
Definition: detect-engine-sigorder.c:100
PrefilterEngine
struct PrefilterEngine_ PrefilterEngine
MpmStore_::alproto
AppProto alproto
Definition: detect.h:1602
SigTableElmt_::JsonAdditionalInfo
void(* JsonAdditionalInfo)(struct SCJsonBuilder *)
Definition: detect.h:1551
DetectEngineMasterCtx_::multi_tenant_enabled
int multi_tenant_enabled
Definition: detect.h:1772
DetectRegisterThreadCtxFuncs
int DetectRegisterThreadCtxFuncs(DetectEngineCtx *, const char *name, void *(*InitFunc)(void *), void *data, void(*FreeFunc)(void *), int)
Register Thread keyword context Funcs.
Definition: detect-engine.c:3963
DetectEngineThreadCtx_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1358
DetectEngineFrameInspectionEngine
Definition: detect.h:517
ENGINE_PROFILE_MEDIUM
@ ENGINE_PROFILE_MEDIUM
Definition: detect.h:1246
DetectFileDataCfg::content_limit
uint32_t content_limit
Definition: detect.h:978
SigFileLoaderStat
struct SigFileLoaderStat_ SigFileLoaderStat
Signature loader statistics.
DetectEngineCtx_::max_uniq_toserver_groups
uint16_t max_uniq_toserver_groups
Definition: detect.h:1058
DETECT_BUFFER_MPM_TYPE_PKT
@ DETECT_BUFFER_MPM_TYPE_PKT
Definition: detect.h:782
InspectionMultiBufferGetDataPtr
bool(* InspectionMultiBufferGetDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const void *txv, const uint8_t flow_flags, uint32_t local_id, const uint8_t **buf, uint32_t *buf_len)
Definition: detect.h:410
DETECT_TABLE_PACKET_TD
@ DETECT_TABLE_PACKET_TD
Definition: detect.h:569
TmEcode
TmEcode
Definition: tm-threads-common.h:80
DetectEnginePktInspectionEngine::Callback
InspectionBufferPktInspectFunc Callback
Definition: detect.h:499
PrefilterEngine_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1692
PrefilterEngine_::frame_type
uint8_t frame_type
Definition: detect.h:1674
DetectBufferType_::name
char name[64]
Definition: detect.h:455
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:775
DetectEngineCtx_::profile_keyword_ctx
struct SCProfileKeywordDetectCtx_ * profile_keyword_ctx
Definition: detect.h:1115
DetectEngineAppInspectionEngine_::GetDataSingle
InspectionSingleBufferGetDataPtr GetDataSingle
Definition: detect.h:436
SigGroupHeadInitData_::max_sig_id
uint32_t max_sig_id
Definition: detect.h:1710
DetectEngineCtx_::sgh_array_cnt
uint32_t sgh_array_cnt
Definition: detect.h:1068
SignatureInitData_::rule_state_dependant_sids_array
uint32_t * rule_state_dependant_sids_array
Definition: detect.h:681
DetectEngineThreadCtx_::alert_queue_capacity
uint16_t alert_queue_capacity
Definition: detect.h:1402
SignatureInitData_::negated
bool negated
Definition: detect.h:611
DetectEngineCtx_::sgh_array
struct SigGroupHead_ ** sgh_array
Definition: detect.h:1067
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1504
reputation.h
MpmStore
struct MpmStore_ MpmStore
SignatureInitData_
Definition: detect.h:603
SCFPSupportSMList_::priority
int priority
Definition: detect.h:871
HashListTable_
Definition: util-hashlist.h:37
PrefilterTxFn
void(* PrefilterTxFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f, void *tx, const uint64_t tx_id, const AppLayerTxData *tx_data, const uint8_t flags)
Definition: detect.h:1612
SignatureInitData_::rule_state_dependant_sids_size
uint32_t rule_state_dependant_sids_size
Definition: detect.h:682
DetectEngineCtx_::byte_extract_max_local_id
int32_t byte_extract_max_local_id
Definition: detect.h:1077
SignatureInitData_::dst_contains_negation
bool dst_contains_negation
Definition: detect.h:616
DetectEnginePktInspectionEngine::sm_list_base
uint16_t sm_list_base
Definition: detect.h:496
DetectEngineTransforms::transforms
TransformData transforms[DETECT_TRANSFORMS_MAX]
Definition: detect.h:396
PORT_ER
@ PORT_ER
Definition: detect.h:209
Signature_::addr_dst_match6_cnt
uint16_t addr_dst_match6_cnt
Definition: detect.h:719
SignatureInitData_::src_contains_range
bool src_contains_range
Definition: detect.h:618
SIG_TYPE_DEONLY
@ SIG_TYPE_DEONLY
Definition: detect.h:72
SIGNATURE_HOOK_PKT_PRE_STREAM
@ SIGNATURE_HOOK_PKT_PRE_STREAM
Definition: detect.h:551
SIG_PROP_FLOW_ACTION_PACKET
@ SIG_PROP_FLOW_ACTION_PACKET
Definition: detect.h:85
DetectEngineThreadCtx
struct DetectEngineThreadCtx_ DetectEngineThreadCtx
SigGroupHead_::frame_engines
PrefilterEngine * frame_engines
Definition: detect.h:1743
SigGroupHeadInitData_::app_mpms
MpmCtx ** app_mpms
Definition: detect.h:1712
DetectEngineCtx_::RateFilterCallback
SCDetectRateFilterFunc RateFilterCallback
Definition: detect.h:1217
FILE_DECODER_EVENT_LZMA_DECODER_ERROR
@ FILE_DECODER_EVENT_LZMA_DECODER_ERROR
Definition: detect.h:1565
FILE_DECODER_EVENT_LZMA_XZ_ERROR
@ FILE_DECODER_EVENT_LZMA_XZ_ERROR
Definition: detect.h:1567
SIG_ALPROTO_MAX
#define SIG_ALPROTO_MAX
Definition: detect.h:601
DetectEngineFrameInspectionEngine::dir
uint8_t dir
Definition: detect.h:519
DetectEngineTransforms
struct DetectEngineTransforms DetectEngineTransforms
Signature_::sp
DetectPort * sp
Definition: detect.h:747
SIG_TYPE_NOT_SET
@ SIG_TYPE_NOT_SET
Definition: detect.h:66
PORT_LE
@ PORT_LE
Definition: detect.h:211
DETECT_FIREWALL_POLICY_PRE_STREAM
@ DETECT_FIREWALL_POLICY_PRE_STREAM
Definition: detect.h:941
DetectEngineThreadCtx_::mtc
MpmThreadCtx mtc
Definition: detect.h:1425
SigString_::filename
char * filename
Definition: detect.h:898
DetectBufferType_::multi_instance
bool multi_instance
Definition: detect.h:466
DETECT_ENGINE_TYPE_TENANT
@ DETECT_ENGINE_TYPE_TENANT
Definition: detect.h:935
RuleMatchCandidateTx::flags
uint32_t * flags
Definition: detect.h:1272
PostRuleMatchWorkQueue
Definition: detect.h:1297
DetectEngineCtx_::dup_sig_hash_table
HashListTable * dup_sig_hash_table
Definition: detect.h:1035
DetectEngineCtx_::config_prefix
char config_prefix[64]
Definition: detect.h:1121
PrefilterEngineList_::tx_min_progress
int8_t tx_min_progress
Definition: detect.h:1622
DetectEngineAppInspectionEngine_::alproto
AppProto alproto
Definition: detect.h:421
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:355
Signature_::class_msg
char * class_msg
Definition: detect.h:767
DetectPatternTracker::sm_list
int sm_list
Definition: detect.h:840
DetectEngineAppInspectionEngine_::smd
SigMatchData * smd
Definition: detect.h:444
SigGroupHeadInitData_::pkt_engines
PrefilterEngineList * pkt_engines
Definition: detect.h:1716
DetectBufferMpmRegistry_::GetMultiData
InspectionMultiBufferGetDataPtr GetMultiData
Definition: detect.h:812
DetectBufferType_::id
int id
Definition: detect.h:457
DetectEngineCtx_::spm_matcher
uint8_t spm_matcher
Definition: detect.h:1003
SigGroupHead_::post_rule_match_engines
PrefilterEngine * post_rule_match_engines
Definition: detect.h:1744
DetectEnginePktInspectionEngine::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect.h:498
ENGINE_PROFILE_UNKNOWN
@ ENGINE_PROFILE_UNKNOWN
Definition: detect.h:1244
DETECT_ENGINE_TYPE_NORMAL
@ DETECT_ENGINE_TYPE_NORMAL
Definition: detect.h:932
SignatureInitDataBuffer_::tail
SigMatch * tail
Definition: detect.h:544
DetectEngineIPOnlyCtx_::ip_dst
IPOnlyCIDRItem * ip_dst
Definition: detect.h:882
MpmStore_::mpm_ctx
MpmCtx * mpm_ctx
Definition: detect.h:1603
util-file.h
DetectAddressHead_::ipv6_head
DetectAddress * ipv6_head
Definition: detect.h:187
DetectMetadataHashFree
void DetectMetadataHashFree(DetectEngineCtx *de_ctx)
Definition: detect-metadata.c:79
util-prefilter.h
DetectEngineCtx_::eth_non_ip_sgh
struct SigGroupHead_ * eth_non_ip_sgh
Definition: detect.h:1087
SignatureInitData_::dsize_sm
SigMatch * dsize_sm
Definition: detect.h:632
APP_LAYER_MAX_PROGRESS
#define APP_LAYER_MAX_PROGRESS
Definition: app-layer-parser.h:81
DetectBufferType_::frame
bool frame
Definition: detect.h:461
File_
Definition: util-file.h:146
th_v
ThreadVars * th_v
Definition: fuzz_dataset.c:29
DetectEngineIPOnlyCtx
struct DetectEngineIPOnlyCtx_ DetectEngineIPOnlyCtx
IP only rules matching ctx.
MPMB_TCP_PKT_TC
@ MPMB_TCP_PKT_TC
Definition: detect.h:1585
DetectEngineCtx_::sig_stat
SigFileLoaderStat sig_stat
Definition: detect.h:1172
DetectEngineCtx_::address_table
HashListTable * address_table
Definition: detect.h:1142
DetectEngineThreadCtx_::to_clear_queue
uint32_t * to_clear_queue
Definition: detect.h:1377
DetectEngineCtx_::profile_prefilter_ctx
struct SCProfilePrefilterDetectCtx_ * profile_prefilter_ctx
Definition: detect.h:1116
TENANT_SELECTOR_DIRECT
@ TENANT_SELECTOR_DIRECT
Definition: detect.h:1754
DetectEngineCtx_::rule_file
const char * rule_file
Definition: detect.h:1094
InspectionBufferMultipleForList
struct InspectionBufferMultipleForList InspectionBufferMultipleForList
util-mpm.h
InspectEngineFuncPtr
uint8_t(* InspectEngineFuncPtr)(struct DetectEngineCtx_ *de_ctx, struct DetectEngineThreadCtx_ *det_ctx, const struct DetectEngineAppInspectionEngine_ *engine, const struct Signature_ *s, Flow *f, uint8_t flags, void *alstate, void *txv, uint64_t tx_id)
Definition: detect.h:415
flags
uint8_t flags
Definition: decode-gre.h:0
SigTableElmt_::alias
const char * alias
Definition: detect.h:1543
DetectBufferMpmRegistry_::type
enum DetectBufferMpmType type
Definition: detect.h:799
SigMatchCtx
struct SigMatchCtx_ SigMatchCtx
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
DetectEngineMasterCtx_::keyword_id
int keyword_id
Definition: detect.h:1796
FILE_DECODER_EVENT_LZMA_HEADER_TOO_SHORT_ERROR
@ FILE_DECODER_EVENT_LZMA_HEADER_TOO_SHORT_ERROR
Definition: detect.h:1564
DetectEngineCtx_::app_mpms_list
DetectBufferMpmRegistry * app_mpms_list
Definition: detect.h:1154
suricata-common.h
SigMatch_::idx
uint16_t idx
Definition: detect.h:362
DetectEnginePktInspectionEngine::v1
struct DetectEnginePktInspectionEngine::@85 v1
SIG_PROP_FLOW_ACTION_FLOW_IF_STATEFUL
@ SIG_PROP_FLOW_ACTION_FLOW_IF_STATEFUL
Definition: detect.h:87
DetectEngineThreadCtx_::prefilter_bytes_called
uint64_t prefilter_bytes_called
Definition: detect.h:1493
SigString_::line
int line
Definition: detect.h:901
SigGroupHeadInitData_::frame_engines
PrefilterEngineList * frame_engines
Definition: detect.h:1719
SigMatch_::type
uint16_t type
Definition: detect.h:361
DETECT_BUFFER_MPM_TYPE_APP
@ DETECT_BUFFER_MPM_TYPE_APP
Definition: detect.h:783
DETECT_FIREWALL_POLICY_PACKET_FILTER
@ DETECT_FIREWALL_POLICY_PACKET_FILTER
Definition: detect.h:939
SigGroupHeadInitData_::payload_engines
PrefilterEngineList * payload_engines
Definition: detect.h:1717
DetectEngineThreadCtx_::tenant_id
uint32_t tenant_id
Definition: detect.h:1319
SigGroupHeadInitData_::match_array
Signature ** match_array
Definition: detect.h:1726
FILE_DECODER_EVENT_Z_DATA_ERROR
@ FILE_DECODER_EVENT_Z_DATA_ERROR
Definition: detect.h:1559
DETECT_FIREWALL_POLICY_SIZE
#define DETECT_FIREWALL_POLICY_SIZE
Definition: detect.h:942
PORT_GE
@ PORT_GE
Definition: detect.h:215
SignatureHook_::ph
enum SignatureHookPkt ph
Definition: detect.h:596
DetectEngineCtx_::buffer_type_hash_name
HashListTable * buffer_type_hash_name
Definition: detect.h:1149
DetectEngineCtx_::next
struct DetectEngineCtx_ * next
Definition: detect.h:1128
Signature_::dsize_high
uint16_t dsize_high
Definition: detect.h:700
DETECT_TABLE_NOT_SET
@ DETECT_TABLE_NOT_SET
Definition: detect.h:565
Signature_::file_flags
uint8_t file_flags
Definition: detect.h:708
DetectBufferMpmRegistry_::name
const char * name
Definition: detect.h:792
detect-metadata.h
Signature_::action_scope
uint8_t action_scope
Definition: detect.h:714
DETECT_ENGINE_TYPE_DD_STUB
@ DETECT_ENGINE_TYPE_DD_STUB
Definition: detect.h:933
TENANT_SELECTOR_VLAN
@ TENANT_SELECTOR_VLAN
Definition: detect.h:1755
DetectEngineFrameInspectionEngine::next
struct DetectEngineFrameInspectionEngine * next
Definition: detect.h:530
SignatureInitData_::curbuf
SignatureInitDataBuffer * curbuf
Definition: detect.h:674
DetectEngineThreadCtx_::prefilter_perf_data
struct SCProfilePrefilterData_ * prefilter_perf_data
Definition: detect.h:1489
DetectEnginePrefilterSetting
DetectEnginePrefilterSetting
Definition: detect.h:925
SignatureHook_::type
enum SignatureHookType type
Definition: detect.h:584
DetectPort_::prev
struct DetectPort_ * prev
Definition: detect.h:236
util-spm.h
DetectEnginePktInspectionEngine::next
struct DetectEnginePktInspectionEngine * next
Definition: detect.h:503
SignatureType
SignatureType
Definition: detect.h:65
DetectEngineCtx_::rate_filter_callback_arg
void * rate_filter_callback_arg
Definition: detect.h:1220
PrefilterEngineList_::PrefilterPostRule
void(* PrefilterPostRule)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f)
Definition: detect.h:1639
SigGroupHeadInitData_::sig_size
uint32_t sig_size
Definition: detect.h:1705
PrefilterEngineList_
Definition: detect.h:1615
SigFileLoaderStat_::total_files
int total_files
Definition: detect.h:909
util-radix4-tree.h
SIGNATURE_HOOK_PKT_PRE_FLOW
@ SIGNATURE_HOOK_PKT_PRE_FLOW
Definition: detect.h:550
DetectEngineThreadCtx_::frame_inspect_progress
uint64_t frame_inspect_progress
Definition: detect.h:1394
DetectMatchAddressIPv4_::ip2
uint32_t ip2
Definition: detect.h:195
DetectEngineCtx_::profile_match_logging_threshold
uint32_t profile_match_logging_threshold
Definition: detect.h:1119
PostRuleMatchWorkQueue::q
PostRuleMatchWorkQueueItem * q
Definition: detect.h:1298
IPOnlyCIDRItem_::ip
uint32_t ip[4]
Definition: detect.h:344
TransformIdData_::id_data_len
uint32_t id_data_len
Definition: detect.h:451
PrefilterEngine_::gid
uint32_t gid
Definition: detect.h:1698
Signature_::rev
uint32_t rev
Definition: detect.h:743
SignatureInitData_::sm_cnt
uint16_t sm_cnt
Definition: detect.h:607
Signature_::proto
DetectProto * proto
Definition: detect.h:711
util-radix6-tree.h
DetectBufferMpmRegistry_::sub_state
uint8_t sub_state
Definition: detect.h:816
SIGNATURE_HOOK_TYPE_PKT
@ SIGNATURE_HOOK_TYPE_PKT
Definition: detect.h:557
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:1005
FILE_DECODER_EVENT_NO_MEM
@ FILE_DECODER_EVENT_NO_MEM
Definition: detect.h:1556
DETECT_SM_LIST_TMATCH
@ DETECT_SM_LIST_TMATCH
Definition: detect.h:130
DetectEngineCtx_::profile_keyword_ctx_per_list
struct SCProfileKeywordDetectCtx_ ** profile_keyword_ctx_per_list
Definition: detect.h:1117
RuleMatchCandidateTx
struct RuleMatchCandidateTx RuleMatchCandidateTx
PrefilterPktFn
void(* PrefilterPktFn)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
Definition: detect.h:1607
DetectEngineCtx_::loader_id
int loader_id
Definition: detect.h:1131
TransformData_::transform
int transform
Definition: detect.h:391
DetectEngineCtx_::pkt_inspect_engines
DetectEnginePktInspectionEngine * pkt_inspect_engines
Definition: detect.h:1158
SIG_TYPE_MAX
@ SIG_TYPE_MAX
Definition: detect.h:80
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:34
Signature_::prio
int prio
Definition: detect.h:744
DetectEngineCtx_::ea
struct EngineAnalysisCtx_ * ea
Definition: detect.h:1199
DetectEngineIPOnlyCtx_::sig_mapping_size
uint32_t sig_mapping_size
Definition: detect.h:888
DetectEngineCtx_::sm_types_silent_error
bool * sm_types_silent_error
Definition: detect.h:1182
DetectEngineThreadKeywordCtxItem_::FreeFunc
void(* FreeFunc)(void *)
Definition: detect.h:917
DetectMatchAddressIPv6_::ip
uint32_t ip[4]
Definition: detect.h:199
SignatureInitDataBuffer_::only_ts
bool only_ts
Definition: detect.h:541
SigGroupHeadInitData
struct SigGroupHeadInitData_ SigGroupHeadInitData
DetectAddress
struct DetectAddress_ DetectAddress
address structure for use in the detection engine.
SpmGlobalThreadCtx_
Definition: util-spm.h:48
DetectEngineCtx_::app_mpms_list_cnt
uint32_t app_mpms_list_cnt
Definition: detect.h:1153
Signature_::addr_src_match6_cnt
uint16_t addr_src_match6_cnt
Definition: detect.h:720
DetectProto_
Definition: detect-engine-proto.h:38
DetectFilestoreData_
Definition: detect-filestore.h:36
SigGroupHeadInitData_
Definition: detect.h:1701
SignatureInitData_::buffers
SignatureInitDataBuffer * buffers
Definition: detect.h:671
DetectEngineCtx_::app_inspect_engines
DetectEngineAppInspectionEngine * app_inspect_engines
Definition: detect.h:1157
SignatureInitData_::dst
const DetectAddressHead * dst
Definition: detect.h:663
DetectEngineCtx_::filemagic_thread_ctx_id
int filemagic_thread_ctx_id
Definition: detect.h:1049
SigJsonContent
Definition: detect.h:1308
PrefilterEngine_::pectx
void * pectx
Definition: detect.h:1687
SignatureInitData_::firewall_rule
bool firewall_rule
Definition: detect.h:688
DetectEngineThreadCtx_::alert_queue
PacketAlert * alert_queue
Definition: detect.h:1403
SIGNATURE_HOOK_PKT_ALL
@ SIGNATURE_HOOK_PKT_ALL
Definition: detect.h:552
DetectEngineThreadCtx_::pcre_match_start_offset
uint32_t pcre_match_start_offset
Definition: detect.h:1344
DetectEngineThreadCtx_::global_keyword_ctxs_size
int global_keyword_ctxs_size
Definition: detect.h:1449
Signature_::dp
DetectPort * dp
Definition: detect.h:747
DetectEngineThreadCtx_::json_content
SigJsonContent * json_content
Definition: detect.h:1353
DetectEngineCtx_::mpm_hash_table
HashListTable * mpm_hash_table
Definition: detect.h:1031
DumpPatterns
void DumpPatterns(DetectEngineCtx *de_ctx)
Definition: detect-engine-analyzer.c:1598
DetectEngineThreadCtx_::replace
const Signature ** replace
Definition: detect.h:1410
Signature_::metadata
DetectMetadataHead * metadata
Definition: detect.h:771
DetectFirewallPolicy
Definition: detect.h:946
DetectEngineThreadCtx_::tv
ThreadVars * tv
Definition: detect.h:1324
MPMB_UDP_TC
@ MPMB_UDP_TC
Definition: detect.h:1589
Signature_::iid
SigIntId iid
Definition: detect.h:704
DetectBufferMpmRegistry_::id
int id
Definition: detect.h:798
SCRadix6Tree_
Structure for the radix tree.
Definition: util-radix6-tree.h:64
StatsCounterAvgId
Definition: counters.h:34
DetectVarList_::key
uint8_t * key
Definition: detect.h:863
DetectEngineThreadCtx_::keyword_ctxs_array
void ** keyword_ctxs_array
Definition: detect.h:1446
SigGroupHeadInitData_::post_rule_match_engines
PrefilterEngineList * post_rule_match_engines
Definition: detect.h:1720
SigFileLoaderStat_::good_sigs_total
int good_sigs_total
Definition: detect.h:910
DetectEngineAppInspectionEngine_::sub_state
uint8_t sub_state
Definition: detect.h:431
MpmConfig_
Definition: util-mpm.h:105
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1526
Signature_::addr_dst_match6
DetectMatchAddressIPv6 * addr_dst_match6
Definition: detect.h:738
DetectEngineMasterCtx_
Definition: detect.h:1768
Signature_::id
uint32_t id
Definition: detect.h:741
ENGINE_PROFILE_CUSTOM
@ ENGINE_PROFILE_CUSTOM
Definition: detect.h:1248
SignatureHook
struct SignatureHook_ SignatureHook
DetectBufferMpmRegistry_::PrefilterRegisterWithListId
int(* PrefilterRegisterWithListId)(struct DetectEngineCtx_ *de_ctx, struct SigGroupHead_ *sgh, MpmCtx *mpm_ctx, const struct DetectBufferMpmRegistry_ *mpm_reg, int list_id)
Definition: detect.h:802
DetectEngineThreadKeywordCtxItem_::name
const char * name
Definition: detect.h:921
DetectEngineCtx_::guess_applayer_log_limit
uint8_t guess_applayer_log_limit
Definition: detect.h:1043
DetectEngineLookupFlow
struct DetectEngineLookupFlow_ DetectEngineLookupFlow
RuleMatchCandidateTx::stream_reset
uint32_t stream_reset
Definition: detect.h:1278
ENGINE_PROFILE_LOW
@ ENGINE_PROFILE_LOW
Definition: detect.h:1245
DisableDetectFlowFileFlags
void DisableDetectFlowFileFlags(Flow *f)
disable file features we don't need Called if we have no detection engine.
Definition: detect.c:3295
DetectBufferType_::transforms
DetectEngineTransforms transforms
Definition: detect.h:471
DetectEngineType
DetectEngineType
Definition: detect.h:931
DetectEngineThreadCtx_::fw_lte_cover
uint32_t fw_lte_cover[APP_LAYER_MAX_PROGRESS]
Definition: detect.h:1423
SignatureInitData_::score
int score
Definition: detect.h:660
SignatureInitDataBuffer_::id
uint32_t id
Definition: detect.h:534
Signature_
Signature container.
Definition: detect.h:692
SigMatch_
a single match condition for a signature
Definition: detect.h:360
DetectEngineCtx_::tenant_path
char * tenant_path
Definition: detect.h:1202
PrefilterEngineList_::pkt_mask
SignatureMask pkt_mask
Definition: detect.h:1626
DetectVarList_::pad
uint8_t pad[2]
Definition: detect.h:859
SCProfilePrefilterData_
Definition: util-profiling-prefilter.c:35
DetectEngineAppInspectionEngine_::transforms
const DetectEngineTransforms * transforms
Definition: detect.h:441
DETECT_SM_LIST_MAX
@ DETECT_SM_LIST_MAX
Definition: detect.h:136
FILE_DECODER_EVENT_LZMA_MEMLIMIT_ERROR
@ FILE_DECODER_EVENT_LZMA_MEMLIMIT_ERROR
Definition: detect.h:1566
SigMatchCtx_::foo
int foo
Definition: detect.h:356
DetectBufferType_::parent_id
int parent_id
Definition: detect.h:458
DETECT_PREFILTER_MPM
@ DETECT_PREFILTER_MPM
Definition: detect.h:926
DetectBufferType_::run_always
bool run_always
Definition: detect.h:464
DetectBufferMpmRegistry_::alproto
AppProto alproto
Definition: detect.h:814
DetectAddress_::next
struct DetectAddress_ * next
Definition: detect.h:181
TransformIdData_::id_data
const uint8_t * id_data
Definition: detect.h:450
DetectEngineTenantMapping_::traffic_id
uint32_t traffic_id
Definition: detect.h:1763
SigGroupHeadInitData_::protos
uint8_t protos[256]
Definition: detect.h:1707
DetectMatchAddressIPv6_
Definition: detect.h:198
PostRuleMatchWorkQueueItem::value
uint32_t value
Definition: detect.h:1289
MPMB_TCP_PKT_TS
@ MPMB_TCP_PKT_TS
Definition: detect.h:1584
DetectMatchAddressIPv4_
Definition: detect.h:193
FILE_DECODER_EVENT_Z_STREAM_ERROR
@ FILE_DECODER_EVENT_Z_STREAM_ERROR
Definition: detect.h:1560
DetectEngineThreadCtx_::tx_id_set
bool tx_id_set
Definition: detect.h:1390
DetectEnginePktInspectionEngine
struct DetectEnginePktInspectionEngine DetectEnginePktInspectionEngine
DetectEngineThreadCtx_::base64_decoded
uint8_t * base64_decoded
Definition: detect.h:1398
Signature_::dsize_mode
uint8_t dsize_mode
Definition: detect.h:701
DetectEngineLookupFlow_
Definition: detect.h:891
SignatureInitData_::has_possible_prefilter
bool has_possible_prefilter
Definition: detect.h:622
SIGNATURE_HOOK_PKT_FLOW_START
@ SIGNATURE_HOOK_PKT_FLOW_START
Definition: detect.h:549
PrefilterEngine_::is_last
bool is_last
Definition: detect.h:1677
DetectEngineThreadCtx_::de_ctx
DetectEngineCtx * de_ctx
Definition: detect.h:1444
PrefilterEngine_::hook
uint8_t hook
Definition: detect.h:1666
DetectEngineCtx_::sig_array
Signature ** sig_array
Definition: detect.h:1014
DETECT_FIREWALL_POLICY_PRE_FLOW
@ DETECT_FIREWALL_POLICY_PRE_FLOW
Definition: detect.h:940
PacketAlert_
Definition: decode.h:249
DetectEngineAppInspectionEngine_::dir
uint8_t dir
Definition: detect.h:422
DETECT_BUFFER_MPM_TYPE_SIZE
@ DETECT_BUFFER_MPM_TYPE_SIZE
Definition: detect.h:786
ADDRESS_ES
@ ADDRESS_ES
Definition: detect.h:157
DETECT_ENGINE_TYPE_MT_STUB
@ DETECT_ENGINE_TYPE_MT_STUB
Definition: detect.h:934
Signature_::detect_table
uint8_t detect_table
Definition: detect.h:726
PrefilterEngine_::run_always
bool run_always
Definition: detect.h:1683
SignatureInitDataBuffer_::only_tc
bool only_tc
Definition: detect.h:540
SignatureNonPrefilterStore_::mask
SignatureMask mask
Definition: detect.h:1263
DetectEngineCtx_::buffer_type_id
uint32_t buffer_type_id
Definition: detect.h:1151
Signature
struct Signature_ Signature
Signature container.
DetectEngineIPOnlyCtx_
IP only rules matching ctx.
Definition: detect.h:876
ENGINE_PROFILE_HIGH
@ ENGINE_PROFILE_HIGH
Definition: detect.h:1247
DetectEngineCtx_::sigerror
const char * sigerror
Definition: detect.h:1095
DetectEngineThreadCtx_::json_content_len
uint8_t json_content_len
Definition: detect.h:1355
DetectEngineThreadCtx_::mt_det_ctxs_cnt
uint32_t mt_det_ctxs_cnt
Definition: detect.h:1326
DetectMetadataHashInit
int DetectMetadataHashInit(DetectEngineCtx *de_ctx)
Definition: detect-metadata.c:68
DetectEngineMasterCtx_::lock
SCMutex lock
Definition: detect.h:1769
PrefilterEngine_::app
struct PrefilterEngine_::@104::@107 app
DetectEnginePktInspectionEngine::mpm
bool mpm
Definition: detect.h:494
DetectEngineCtx_::spm_global_thread_ctx
SpmGlobalThreadCtx * spm_global_thread_ctx
Definition: detect.h:1053
DetectFlowbitsAnalyze
int DetectFlowbitsAnalyze(DetectEngineCtx *de_ctx)
Definition: detect-flowbits.c:620
DetectEngineThreadCtx_::counter_match_list
StatsCounterAvgId counter_match_list
Definition: detect.h:1370
SigGroupHead_::pkt_engines
PrefilterEngine * pkt_engines
Definition: detect.h:1740
SignatureInitData_::rule_state_flowbits_ids_array
uint32_t * rule_state_flowbits_ids_array
Definition: detect.h:684
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:997
SIG_PROP_FLOW_ACTION_FLOW
@ SIG_PROP_FLOW_ACTION_FLOW
Definition: detect.h:86
DetectEngineThreadCtx_::replist
DetectReplaceList * replist
Definition: detect.h:1432
DetectFirewallAppPolicy::alproto
AppProto alproto
Definition: detect.h:952
SignatureInitData_::transforms
DetectEngineTransforms transforms
Definition: detect.h:652
PrefilterEngine_::Prefilter
PrefilterPktFn Prefilter
Definition: detect.h:1690
DetectFirewallPolicies::app_policies
HashTable * app_policies
Definition: detect.h:968
SigString_::sig_str
char * sig_str
Definition: detect.h:899
DetectEngineCtx_::io_ctx
DetectEngineIPOnlyCtx io_ctx
Definition: detect.h:1037
PrefilterEngine_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1691
DetectMatchAddressIPv4
struct DetectMatchAddressIPv4_ DetectMatchAddressIPv4
DetectEngineCtx_::rule_line
int rule_line
Definition: detect.h:1093
MpmCtx_
Definition: util-mpm.h:111
Signature_::addr_dst_match4
DetectMatchAddressIPv4 * addr_dst_match4
Definition: detect.h:735
Signature_::msg
char * msg
Definition: detect.h:764
flow.h
SignatureInitDataBuffer_
Definition: detect.h:533
Signature_::addr_src_match4_cnt
uint16_t addr_src_match4_cnt
Definition: detect.h:718
DetectGetInnerTx
void * DetectGetInnerTx(void *tx_ptr, AppProto alproto, AppProto engine_alproto, uint8_t flow_flags)
Definition: detect.c:1270
DetectFirewallPolicy::action_scope
uint8_t action_scope
Definition: detect.h:948
DetectEngineAppInspectionEngine
struct DetectEngineAppInspectionEngine_ DetectEngineAppInspectionEngine
TENANT_SELECTOR_LIVEDEV
@ TENANT_SELECTOR_LIVEDEV
Definition: detect.h:1756
SCDetectEngineRegisterRateFilterCallback
bool SCDetectEngineRegisterRateFilterCallback(SCDetectRateFilterFunc cb, void *arg)
Register a callback when a rate_filter has been applied to an alert.
Definition: detect-engine.c:5405
Signature_::addr_dst_match4_cnt
uint16_t addr_dst_match4_cnt
Definition: detect.h:717
DetectEngineFrameInspectionEngine::type
uint8_t type
Definition: detect.h:520
DetectSigmatchListEnum
DetectSigmatchListEnum
Definition: detect.h:116
DetectEngineMasterCtx_::version
uint32_t version
Definition: detect.h:1775
DetectEngineCtx_::sig_array_len
uint32_t sig_array_len
Definition: detect.h:1015
DetectEngineCtx_::metadata_table
HashTable * metadata_table
Definition: detect.h:1145
SigTableElmt_::Transform
void(* Transform)(DetectEngineThreadCtx *, InspectionBuffer *, const void *context)
Definition: detect.h:1517
Signature_::type
enum SignatureType type
Definition: detect.h:695
DetectEngineCtx_::signum
uint32_t signum
Definition: detect.h:1017
FILE_DECODER_EVENT_LZMA_IO_ERROR
@ FILE_DECODER_EVENT_LZMA_IO_ERROR
Definition: detect.h:1563
DetectEngineCtx_::tenant_id
uint32_t tenant_id
Definition: detect.h:1000
SigGroupHead_::filestore_cnt
uint16_t filestore_cnt
Definition: detect.h:1736
SignatureInitData_::buffer_index
uint32_t buffer_index
Definition: detect.h:672
IPOnlyCIDRItem_::signum
SigIntId signum
Definition: detect.h:345
SigFileLoaderStat_
Signature loader statistics.
Definition: detect.h:906
DetectFirewallAppPolicy::direction
uint8_t direction
Definition: detect.h:955
DetectAddress_::flags
uint8_t flags
Definition: detect.h:176
DetectEngineCtx_::buffer_type_hash_id
HashListTable * buffer_type_hash_id
Definition: detect.h:1150
DetectEngineLookupFlow_::tcp
DetectPort * tcp
Definition: detect.h:892
FILE_DECODER_EVENT_LZMA_UNKNOWN_ERROR
@ FILE_DECODER_EVENT_LZMA_UNKNOWN_ERROR
Definition: detect.h:1568
DETECT_SM_LIST_SUPPRESS
@ DETECT_SM_LIST_SUPPRESS
Definition: detect.h:133
SCMutex
#define SCMutex
Definition: threads-debug.h:114
DetectEngineCtx_::fp_support_smlist_list
SCFPSupportSMList * fp_support_smlist_list
Definition: detect.h:1176
SIG_TYPE_PDONLY
@ SIG_TYPE_PDONLY
Definition: detect.h:71
DetectEngineTransforms::cnt
uint8_t cnt
Definition: detect.h:397
InspectionBufferMultipleForList::inspection_buffers
InspectionBuffer * inspection_buffers
Definition: detect.h:384
MpmStore_::sgh_mpm_context
int32_t sgh_mpm_context
Definition: detect.h:1601
InspectionBufferMultipleForList::max
uint32_t max
Definition: detect.h:386
DetectAddressHead_::ipv4_head
DetectAddress * ipv4_head
Definition: detect.h:186
DetectEngineThreadCtx_::lua_blocked_function_errors
StatsCounterId lua_blocked_function_errors
Definition: detect.h:1459
SignatureProperties::flow_action
enum SignaturePropertyFlowAction flow_action
Definition: detect.h:91
SigGroupHead_::id
uint32_t id
Definition: detect.h:1738
IPOnlyCIDRItem_::family
uint8_t family
Definition: detect.h:338
DetectEngineThreadCtx_::prefilter_bytes
uint64_t prefilter_bytes
Definition: detect.h:1491
FILE_DECODER_EVENT_INVALID_SWF_LENGTH
@ FILE_DECODER_EVENT_INVALID_SWF_LENGTH
Definition: detect.h:1557
DetectEngineFrameInspectionEngine
struct DetectEngineFrameInspectionEngine DetectEngineFrameInspectionEngine
SigJsonContent::json_content
char json_content[SIG_JSON_CONTENT_ITEM_LEN]
Definition: detect.h:1310
SigJsonContent::id
void * id
Definition: detect.h:1309
SigMatchData
struct SigMatchData_ SigMatchData
Data needed for Match()
MpmStore_::buffer
enum MpmBuiltinBuffers buffer
Definition: detect.h:1599
DetectEngineThreadCtx_::post_rule_work_queue
PostRuleMatchWorkQueue post_rule_work_queue
Definition: detect.h:1427
DetectEngineThreadCtx_::tenant_array_size
uint32_t tenant_array_size
Definition: detect.h:1331
DetectEngineThreadCtx_::tenant_array
struct DetectEngineTenantMapping_ * tenant_array
Definition: detect.h:1330
DetectEngineCtx_::sc_sig_order_funcs
struct SCSigOrderFunc_ * sc_sig_order_funcs
Definition: detect.h:1020
MpmCtxFactoryContainer_
Definition: util-mpm.h:148
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1531
DetectEngineThreadCtx_::file_id
uint32_t file_id
Definition: detect.h:1440
DetectPacketHookFunc
uint8_t(* DetectPacketHookFunc)(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p)
Definition: detect.h:982
SignatureMask
#define SignatureMask
Definition: decode.h:100
DetectEngineThreadCtx_::mt_det_ctxs
struct DetectEngineThreadCtx_ ** mt_det_ctxs
Definition: detect.h:1327
Signature_::mask
SignatureMask mask
Definition: detect.h:703
SignatureInitData_::alprotos
AppProto alprotos[SIG_ALPROTO_MAX]
Definition: detect.h:629
RuleMatchCandidateTx
Definition: detect.h:1268
DETECT_EVENT_POST_MATCH_QUEUE_FAILED
@ DETECT_EVENT_POST_MATCH_QUEUE_FAILED
Definition: detect.h:1571
SIG_TYPE_LIKE_IPONLY
@ SIG_TYPE_LIKE_IPONLY
Definition: detect.h:68
DetectEngineThreadCtx_::TenantGetId
uint32_t(* TenantGetId)(const void *, const Packet *p)
Definition: detect.h:1333
DetectEngineAppInspectionEngine_::progress
uint8_t progress
Definition: detect.h:430
f
Flow f
Definition: fuzz_dataset.c:32
DetectBufferType_::description
char description[128]
Definition: detect.h:456
PORT_GT
@ PORT_GT
Definition: detect.h:216
SigJsonContent
struct SigJsonContent SigJsonContent
ADDRESS_ER
@ ADDRESS_ER
Definition: detect.h:153
DetectEngineIPOnlyCtx_::max_idx
uint32_t max_idx
Definition: detect.h:883
SigGroupHeadInitData_::frame_mpms
MpmCtx ** frame_mpms
Definition: detect.h:1714
SpmThreadCtx_
Definition: util-spm.h:55
DetectEngineFrameInspectionEngine::smd
SigMatchData * smd
Definition: detect.h:529
ADDRESS_GT
@ ADDRESS_GT
Definition: detect.h:160
DetectEngineThreadCtx_::match_array
Signature ** match_array
Definition: detect.h:1407