suricata
detect-engine-prefilter.c
Go to the documentation of this file.
1 /* Copyright (C) 2016-2021 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  * Prefilter engine
24  *
25  * Prefilter engines have as purpose to check for a critical common part of
26  * a set of rules. If the condition is present in the traffic, the rules
27  * will have to be inspected individually. Otherwise, the rules can be
28  * skipped.
29  *
30  * The best example of this is the MPM. From each rule take a pattern and
31  * add it to the MPM state machine. Inspect that in one step and only
32  * individually inspect the rules that had a match in MPM.
33  *
34  * This prefilter API is designed to abstract this logic so that it becomes
35  * easier to add other types of prefilters.
36  *
37  * The prefilter engines are structured as a simple list of engines. Each
38  * engine checks for a condition using it's callback function and private
39  * data. It then adds the rule match candidates to the PrefilterRuleStore
40  * structure.
41  *
42  * After the engines have run the resulting list of match candidates is
43  * sorted by the rule id's so that the individual inspection happens in
44  * the correct order.
45  */
46 
47 #include "suricata-common.h"
48 #include "suricata.h"
49 
50 #include "detect-engine.h"
52 #include "detect-engine-mpm.h"
53 #include "detect-engine-frame.h"
54 
55 #include "app-layer-parser.h"
56 #include "app-layer-htp.h"
57 
58 #include "util-profiling.h"
59 #include "util-validate.h"
60 
61 static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
62  const char *name, void (*FreeFunc)(void *));
63 static const PrefilterStore *PrefilterStoreGetStore(const DetectEngineCtx *de_ctx,
64  const uint32_t id);
65 
66 static inline void QuickSortSigIntId(SigIntId *sids, uint32_t n)
67 {
68  if (n < 2)
69  return;
70  SigIntId p = sids[n / 2];
71  SigIntId *l = sids;
72  SigIntId *r = sids + n - 1;
73  while (l <= r) {
74  if (*l < p)
75  l++;
76  else if (*r > p)
77  r--;
78  else {
79  SigIntId t = *l;
80  *l = *r;
81  *r = t;
82  l++;
83  r--;
84  }
85  }
86  QuickSortSigIntId(sids, r - sids + 1);
87  QuickSortSigIntId(l, sids + n - l);
88 }
89 
90 /**
91  * \brief run prefilter engines on a transaction
92  */
94  const SigGroupHead *sgh,
95  Packet *p,
96  const uint8_t ipproto,
97  const uint8_t flow_flags,
98  const AppProto alproto,
99  void *alstate,
100  DetectTransaction *tx)
101 {
102  /* reset rule store */
103  det_ctx->pmq.rule_id_array_cnt = 0;
104 
105  SCLogDebug("packet %" PRIu64 " tx %p progress %d tx->prefilter_flags %" PRIx64, p->pcap_cnt,
106  tx->tx_ptr, tx->tx_progress, tx->prefilter_flags);
107 
108  PrefilterEngine *engine = sgh->tx_engines;
109  do {
110  // based on flow alproto, and engine, we get right tx_ptr
111  void *tx_ptr = DetectGetInnerTx(tx->tx_ptr, alproto, engine->alproto, flow_flags);
112  if (tx_ptr == NULL) {
113  // incompatible engine->alproto with flow alproto
114  goto next;
115  }
116  if (engine->ctx.tx_min_progress > tx->tx_progress)
117  break;
118  if (tx->tx_progress > engine->ctx.tx_min_progress) {
119  if (tx->prefilter_flags & BIT_U64(engine->ctx.tx_min_progress)) {
120  goto next;
121  }
122  }
123 
124  PREFILTER_PROFILING_START(det_ctx);
125  engine->cb.PrefilterTx(
126  det_ctx, engine->pectx, p, p->flow, tx_ptr, tx->tx_id, tx->tx_data_ptr, flow_flags);
127  PREFILTER_PROFILING_END(det_ctx, engine->gid);
128 
129  if (tx->tx_progress > engine->ctx.tx_min_progress && engine->is_last_for_progress) {
130  tx->prefilter_flags |= BIT_U64(engine->ctx.tx_min_progress);
131  }
132  next:
133  if (engine->is_last)
134  break;
135  engine++;
136  } while (1);
137 
138  /* Sort the rule list to lets look at pmq.
139  * NOTE due to merging of 'stream' pmqs we *MAY* have duplicate entries */
140  if (likely(det_ctx->pmq.rule_id_array_cnt > 1)) {
142  QuickSortSigIntId(det_ctx->pmq.rule_id_array, det_ctx->pmq.rule_id_array_cnt);
144  }
145 }
146 
147 void Prefilter(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh, Packet *p,
148  const uint8_t flags, const SignatureMask mask)
149 {
150  SCEnter();
151 #if 0
152  /* TODO review this check */
153  SCLogDebug("sgh %p frame_engines %p", sgh, sgh->frame_engines);
154  if (p->proto == IPPROTO_TCP && sgh->frame_engines && p->flow &&
155  p->flow->alproto != ALPROTO_UNKNOWN && p->flow->alparser != NULL) {
157  PrefilterFrames(det_ctx, sgh, p, flags, p->flow->alproto);
159  }
160 #endif
161  if (sgh->pkt_engines) {
163  /* run packet engines */
164  PrefilterEngine *engine = sgh->pkt_engines;
165  do {
166  if ((engine->ctx.pkt_mask & mask) == engine->ctx.pkt_mask) {
167  PREFILTER_PROFILING_START(det_ctx);
168  engine->cb.Prefilter(det_ctx, p, engine->pectx);
169  PREFILTER_PROFILING_END(det_ctx, engine->gid);
170  }
171 
172  if (engine->is_last)
173  break;
174  engine++;
175  } while (1);
177  }
178 
179  /* run payload inspecting engines */
180  if (sgh->payload_engines &&
183  {
185  PrefilterEngine *engine = sgh->payload_engines;
186  while (1) {
187  PREFILTER_PROFILING_START(det_ctx);
188  engine->cb.Prefilter(det_ctx, p, engine->pectx);
189  PREFILTER_PROFILING_END(det_ctx, engine->gid);
190 
191  if (engine->is_last)
192  break;
193  engine++;
194  }
196  }
197 
198  /* Sort the rule list to lets look at pmq.
199  * NOTE due to merging of 'stream' pmqs we *MAY* have duplicate entries */
200  if (likely(det_ctx->pmq.rule_id_array_cnt > 1)) {
202  QuickSortSigIntId(det_ctx->pmq.rule_id_array, det_ctx->pmq.rule_id_array_cnt);
204  }
205  SCReturn;
206 }
207 
209  SignatureMask mask, void *pectx, void (*FreeFunc)(void *pectx), const char *name)
210 {
211  if (sgh == NULL || PrefilterFunc == NULL || pectx == NULL)
212  return -1;
213 
214  PrefilterEngineList *e = SCMallocAligned(sizeof(*e), CLS);
215  if (e == NULL)
216  return -1;
217  memset(e, 0x00, sizeof(*e));
218 
219  e->Prefilter = PrefilterFunc;
220  e->pectx = pectx;
221  e->Free = FreeFunc;
222  e->pkt_mask = mask;
223 
224  if (sgh->init->pkt_engines == NULL) {
225  sgh->init->pkt_engines = e;
226  } else {
228  while (t->next != NULL) {
229  t = t->next;
230  }
231 
232  t->next = e;
233  e->id = t->id + 1;
234  }
235 
236  e->name = name;
237  e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
238  return 0;
239 }
240 
242  PrefilterPktFn PrefilterFunc, void *pectx, void (*FreeFunc)(void *pectx), const char *name)
243 {
244  if (sgh == NULL || PrefilterFunc == NULL || pectx == NULL)
245  return -1;
246 
247  PrefilterEngineList *e = SCMallocAligned(sizeof(*e), CLS);
248  if (e == NULL)
249  return -1;
250  memset(e, 0x00, sizeof(*e));
251 
252  e->Prefilter = PrefilterFunc;
253  e->pectx = pectx;
254  e->Free = FreeFunc;
255 
256  if (sgh->init->payload_engines == NULL) {
257  sgh->init->payload_engines = e;
258  } else {
260  while (t->next != NULL) {
261  t = t->next;
262  }
263 
264  t->next = e;
265  e->id = t->id + 1;
266  }
267 
268  e->name = name;
269  e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
270  return 0;
271 }
272 
274  PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx,
275  void (*FreeFunc)(void *pectx), const char *name)
276 {
277  if (sgh == NULL || PrefilterTxFunc == NULL || pectx == NULL)
278  return -1;
279 
280  PrefilterEngineList *e = SCMallocAligned(sizeof(*e), CLS);
281  if (e == NULL)
282  return -1;
283  memset(e, 0x00, sizeof(*e));
284 
285  e->PrefilterTx = PrefilterTxFunc;
286  e->pectx = pectx;
287  e->alproto = alproto;
288  // TODO change function prototype ?
289  DEBUG_VALIDATE_BUG_ON(tx_min_progress > UINT8_MAX);
290  e->tx_min_progress = (uint8_t)tx_min_progress;
291  e->Free = FreeFunc;
292 
293  if (sgh->init->tx_engines == NULL) {
294  sgh->init->tx_engines = e;
295  } else {
297  while (t->next != NULL) {
298  t = t->next;
299  }
300 
301  t->next = e;
302  e->id = t->id + 1;
303  }
304 
305  e->name = name;
306  e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
307  return 0;
308 }
309 
311  PrefilterFrameFn PrefilterFrameFunc, AppProto alproto, uint8_t frame_type, void *pectx,
312  void (*FreeFunc)(void *pectx), const char *name)
313 {
314  if (sgh == NULL || PrefilterFrameFunc == NULL || pectx == NULL)
315  return -1;
316 
317  PrefilterEngineList *e = SCMallocAligned(sizeof(*e), CLS);
318  if (e == NULL)
319  return -1;
320  memset(e, 0x00, sizeof(*e));
321 
322  e->frame_type = frame_type;
323  e->alproto = alproto;
324  e->PrefilterFrame = PrefilterFrameFunc;
325  e->pectx = pectx;
326  e->Free = FreeFunc;
327 
328  if (sgh->init->frame_engines == NULL) {
329  sgh->init->frame_engines = e;
330  } else {
332  while (t->next != NULL) {
333  t = t->next;
334  }
335 
336  t->next = e;
337  e->id = t->id + 1;
338  }
339 
340  e->name = name;
341  e->gid = PrefilterStoreGetId(de_ctx, e->name, e->Free);
342  return 0;
343 }
344 
345 static void PrefilterFreeEngineList(PrefilterEngineList *e)
346 {
347  if (e->Free && e->pectx) {
348  e->Free(e->pectx);
349  }
350  SCFreeAligned(e);
351 }
352 
354 {
355  PrefilterEngineList *t = list;
356 
357  while (t != NULL) {
359  PrefilterFreeEngineList(t);
360  t = next;
361  }
362 }
363 
364 static void PrefilterFreeEngines(const DetectEngineCtx *de_ctx, PrefilterEngine *list)
365 {
366  PrefilterEngine *t = list;
367 
368  while (1) {
369  const PrefilterStore *s = PrefilterStoreGetStore(de_ctx, t->gid);
370  if (s && s->FreeFunc && t->pectx) {
371  s->FreeFunc(t->pectx);
372  }
373 
374  if (t->is_last)
375  break;
376  t++;
377  }
378  SCFreeAligned(list);
379 }
380 
382 {
383  if (sgh->pkt_engines) {
384  PrefilterFreeEngines(de_ctx, sgh->pkt_engines);
385  sgh->pkt_engines = NULL;
386  }
387  if (sgh->payload_engines) {
388  PrefilterFreeEngines(de_ctx, sgh->payload_engines);
389  sgh->payload_engines = NULL;
390  }
391  if (sgh->tx_engines) {
392  PrefilterFreeEngines(de_ctx, sgh->tx_engines);
393  sgh->tx_engines = NULL;
394  }
395  if (sgh->frame_engines) {
396  PrefilterFreeEngines(de_ctx, sgh->frame_engines);
397  sgh->frame_engines = NULL;
398  }
399 }
400 
401 static int PrefilterSetupRuleGroupSortHelper(const void *a, const void *b)
402 {
403  const PrefilterEngine *s0 = a;
404  const PrefilterEngine *s1 = b;
405  if (s1->ctx.tx_min_progress == s0->ctx.tx_min_progress) {
406  if (s1->alproto == s0->alproto) {
407  return s0->local_id > s1->local_id ? 1 : -1;
408  } else {
409  return s0->alproto > s1->alproto ? 1 : -1;
410  }
411  } else {
412  return s0->ctx.tx_min_progress > s1->ctx.tx_min_progress ? 1 : -1;
413  }
414 }
415 
417 {
418  int r = PatternMatchPrepareGroup(de_ctx, sgh);
419  if (r != 0) {
420  FatalError("failed to set up pattern matching");
421  }
422 
423  /* set up engines if needed - when prefilter is set to auto we run
424  * all engines, otherwise only those that have been forced by the
425  * prefilter keyword. */
427  for (int i = 0; i < DETECT_TBLSIZE; i++)
428  {
429  if (sigmatch_table[i].SetupPrefilter != NULL &&
430  (setting == DETECT_PREFILTER_AUTO ||
432  {
434  }
435  }
436 
437  /* we have lists of engines in sgh->init now. Lets setup the
438  * match arrays */
440  if (sgh->init->pkt_engines != NULL) {
441  uint32_t cnt = 0;
442  for (el = sgh->init->pkt_engines ; el != NULL; el = el->next) {
443  cnt++;
444  }
446  if (sgh->pkt_engines == NULL) {
447  return;
448  }
449  memset(sgh->pkt_engines, 0x00, (cnt * sizeof(PrefilterEngine)));
450 
451  PrefilterEngine *e = sgh->pkt_engines;
452  for (el = sgh->init->pkt_engines ; el != NULL; el = el->next) {
453  e->local_id = el->id;
454  e->cb.Prefilter = el->Prefilter;
455  e->ctx.pkt_mask = el->pkt_mask;
456  e->pectx = el->pectx;
457  el->pectx = NULL; // e now owns the ctx
458  e->gid = el->gid;
459  if (el->next == NULL) {
460  e->is_last = true;
461  }
462  e++;
463  }
464  }
465  if (sgh->init->payload_engines != NULL) {
466  uint32_t cnt = 0;
467  for (el = sgh->init->payload_engines ; el != NULL; el = el->next) {
468  cnt++;
469  }
471  if (sgh->payload_engines == NULL) {
472  return;
473  }
474  memset(sgh->payload_engines, 0x00, (cnt * sizeof(PrefilterEngine)));
475 
477  for (el = sgh->init->payload_engines ; el != NULL; el = el->next) {
478  e->local_id = el->id;
479  e->cb.Prefilter = el->Prefilter;
480  e->ctx.pkt_mask = el->pkt_mask;
481  e->pectx = el->pectx;
482  el->pectx = NULL; // e now owns the ctx
483  e->gid = el->gid;
484  if (el->next == NULL) {
485  e->is_last = true;
486  }
487  e++;
488  }
489  }
490  if (sgh->init->tx_engines != NULL) {
491  uint32_t cnt = 0;
492  for (el = sgh->init->tx_engines ; el != NULL; el = el->next) {
493  cnt++;
494  }
495  sgh->tx_engines = SCMallocAligned(cnt * sizeof(PrefilterEngine), CLS);
496  if (sgh->tx_engines == NULL) {
497  return;
498  }
499  memset(sgh->tx_engines, 0x00, (cnt * sizeof(PrefilterEngine)));
500 
501  uint16_t local_id = 0;
502  PrefilterEngine *e = sgh->tx_engines;
503  for (el = sgh->init->tx_engines ; el != NULL; el = el->next) {
504  e->local_id = local_id++;
505  e->alproto = el->alproto;
507  e->cb.PrefilterTx = el->PrefilterTx;
508  e->pectx = el->pectx;
509  el->pectx = NULL; // e now owns the ctx
510  e->gid = el->gid;
511  e++;
512  }
513 
514  /* sort by tx_min_progress, then alproto, then local_id */
515  qsort(sgh->tx_engines, local_id, sizeof(PrefilterEngine),
516  PrefilterSetupRuleGroupSortHelper);
517  sgh->tx_engines[local_id - 1].is_last = true;
518  sgh->tx_engines[local_id - 1].is_last_for_progress = true;
519 
520  PrefilterEngine *engine;
521 
522  /* per alproto to set is_last_for_progress per alproto because the inspect
523  * loop skips over engines that are not the correct alproto */
524  for (AppProto a = 1; a < ALPROTO_FAILED; a++) {
525  int last_tx_progress = 0;
526  bool last_tx_progress_set = false;
527  PrefilterEngine *prev_engine = NULL;
528  engine = sgh->tx_engines;
529  do {
530  BUG_ON(engine->ctx.tx_min_progress < last_tx_progress);
531  if (engine->alproto == a) {
532  if (last_tx_progress_set && engine->ctx.tx_min_progress > last_tx_progress) {
533  if (prev_engine) {
534  prev_engine->is_last_for_progress = true;
535  }
536  }
537 
538  last_tx_progress_set = true;
539  prev_engine = engine;
540  } else {
541  if (prev_engine) {
542  prev_engine->is_last_for_progress = true;
543  }
544  }
545  last_tx_progress = engine->ctx.tx_min_progress;
546  if (engine->is_last)
547  break;
548  engine++;
549  } while (1);
550  }
551 #ifdef DEBUG
552  SCLogDebug("sgh %p", sgh);
553  engine = sgh->tx_engines;
554  do {
555  SCLogDebug("engine: gid %u alproto %s tx_min_progress %d is_last %s "
556  "is_last_for_progress %s",
557  engine->gid, AppProtoToString(engine->alproto), engine->ctx.tx_min_progress,
558  engine->is_last ? "true" : "false",
559  engine->is_last_for_progress ? "true" : "false");
560  if (engine->is_last)
561  break;
562  engine++;
563  } while (1);
564 #endif
565  }
566  if (sgh->init->frame_engines != NULL) {
567  uint32_t cnt = 0;
568  for (el = sgh->init->frame_engines; el != NULL; el = el->next) {
569  cnt++;
570  }
572  if (sgh->frame_engines == NULL) {
573  return;
574  }
575  memset(sgh->frame_engines, 0x00, (cnt * sizeof(PrefilterEngine)));
576 
577  PrefilterEngine *e = sgh->frame_engines;
578  for (el = sgh->init->frame_engines; el != NULL; el = el->next) {
579  e->local_id = el->id;
580  e->ctx.frame_type = el->frame_type;
582  e->alproto = el->alproto;
583  e->pectx = el->pectx;
584  el->pectx = NULL; // e now owns the ctx
585  e->gid = el->gid;
586  if (el->next == NULL) {
587  e->is_last = true;
588  }
589  e++;
590  }
591  }
592 }
593 
594 /* hash table for assigning a unique id to each engine type. */
595 
596 static uint32_t PrefilterStoreHashFunc(HashListTable *ht, void *data, uint16_t datalen)
597 {
598  PrefilterStore *ctx = data;
599 
600  uint32_t hash = strlen(ctx->name);
601 
602  for (size_t u = 0; u < strlen(ctx->name); u++) {
603  hash += ctx->name[u];
604  }
605 
606  hash %= ht->array_size;
607  return hash;
608 }
609 
610 static char PrefilterStoreCompareFunc(void *data1, uint16_t len1,
611  void *data2, uint16_t len2)
612 {
613  PrefilterStore *ctx1 = data1;
614  PrefilterStore *ctx2 = data2;
615  return (strcmp(ctx1->name, ctx2->name) == 0);
616 }
617 
618 static void PrefilterStoreFreeFunc(void *ptr)
619 {
620  SCFree(ptr);
621 }
622 
624 {
625  if (de_ctx->prefilter_hash_table != NULL) {
627  }
628 }
629 
631 {
633 
635  PrefilterStoreHashFunc,
636  PrefilterStoreCompareFunc,
637  PrefilterStoreFreeFunc);
639 }
640 
641 static int PrefilterStoreGetId(DetectEngineCtx *de_ctx,
642  const char *name, void (*FreeFunc)(void *))
643 {
644  PrefilterStore ctx = { name, FreeFunc, 0 };
645 
647 
648  SCLogDebug("looking up %s", name);
649 
651  if (rctx != NULL) {
652  return rctx->id;
653  }
654 
655  PrefilterStore *actx = SCCalloc(1, sizeof(*actx));
656  if (actx == NULL) {
657  return -1;
658  }
659 
660  actx->name = name;
661  actx->FreeFunc = FreeFunc;
662  actx->id = de_ctx->prefilter_id++;
663  SCLogDebug("prefilter engine %s has profile id %u", actx->name, actx->id);
664 
665  int ret = HashListTableAdd(de_ctx->prefilter_hash_table, actx, 0);
666  if (ret != 0) {
667  SCFree(actx);
668  return -1;
669  }
670 
671  int r = actx->id;
672  return r;
673 }
674 
675 /** \warning slow */
676 static const PrefilterStore *PrefilterStoreGetStore(const DetectEngineCtx *de_ctx,
677  const uint32_t id)
678 {
679 
680  const PrefilterStore *store = NULL;
681  if (de_ctx->prefilter_hash_table != NULL) {
683  for ( ; hb != NULL; hb = HashListTableGetListNext(hb)) {
685  if (ctx->id == id) {
686  store = ctx;
687  break;
688  }
689  }
690  }
691  return store;
692 }
693 
694 #ifdef PROFILING
695 const char *PrefilterStoreGetName(const uint32_t id)
696 {
697  return NULL;
698 }
699 #endif
700 
701 #include "util-print.h"
702 
703 typedef struct PrefilterMpmCtx {
704  int list_id;
706  const MpmCtx *mpm_ctx;
709 
710 /** \brief Generic Mpm prefilter callback
711  *
712  * \param det_ctx detection engine thread ctx
713  * \param p packet to inspect
714  * \param f flow to inspect
715  * \param txv tx to inspect
716  * \param pectx inspection context
717  */
718 static void PrefilterMpm(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f,
719  void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags)
720 {
721  SCEnter();
722 
723  const PrefilterMpmCtx *ctx = (const PrefilterMpmCtx *)pectx;
724  const MpmCtx *mpm_ctx = ctx->mpm_ctx;
725  SCLogDebug("running on list %d", ctx->list_id);
726 
727  InspectionBuffer *buffer = ctx->GetData(det_ctx, ctx->transforms,
728  f, flags, txv, ctx->list_id);
729  if (buffer == NULL)
730  return;
731 
732  const uint32_t data_len = buffer->inspect_len;
733  const uint8_t *data = buffer->inspect;
734 
735  SCLogDebug("mpm'ing buffer:");
736  //PrintRawDataFp(stdout, data, data_len);
737 
738  if (data != NULL && data_len >= mpm_ctx->minlen) {
739  (void)mpm_table[mpm_ctx->mpm_type].Search(
740  mpm_ctx, &det_ctx->mtc, &det_ctx->pmq, data, data_len);
741  PREFILTER_PROFILING_ADD_BYTES(det_ctx, data_len);
742  }
743 }
744 
745 static void PrefilterGenericMpmFree(void *ptr)
746 {
747  SCFree(ptr);
748 }
749 
751  const DetectBufferMpmRegistry *mpm_reg, int list_id)
752 {
753  SCEnter();
754  PrefilterMpmCtx *pectx = SCCalloc(1, sizeof(*pectx));
755  if (pectx == NULL)
756  return -1;
757  pectx->list_id = list_id;
758  pectx->GetData = mpm_reg->app_v2.GetData;
759  pectx->mpm_ctx = mpm_ctx;
760  pectx->transforms = &mpm_reg->transforms;
761 
762  int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterMpm,
763  mpm_reg->app_v2.alproto, mpm_reg->app_v2.tx_min_progress,
764  pectx, PrefilterGenericMpmFree, mpm_reg->pname);
765  if (r != 0) {
766  SCFree(pectx);
767  }
768  return r;
769 }
770 
771 static void PrefilterMultiGenericMpmFree(void *ptr)
772 {
773  // PrefilterMpmListId
774  SCFree(ptr);
775 }
776 
777 static void PrefilterMultiMpm(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, Flow *f,
778  void *txv, const uint64_t idx, const AppLayerTxData *_txd, const uint8_t flags)
779 {
780  SCEnter();
781 
782  const PrefilterMpmListId *ctx = (const PrefilterMpmListId *)pectx;
783  const MpmCtx *mpm_ctx = ctx->mpm_ctx;
784  SCLogDebug("running on list %d", ctx->list_id);
785  uint32_t local_id = 0;
786 
787  do {
788  // loop until we get a NULL
789  InspectionBuffer *buffer =
790  ctx->GetData(det_ctx, ctx->transforms, f, flags, txv, ctx->list_id, local_id);
791  if (buffer == NULL)
792  break;
793 
794  if (buffer->inspect_len >= mpm_ctx->minlen) {
795  (void)mpm_table[mpm_ctx->mpm_type].Search(
796  mpm_ctx, &det_ctx->mtc, &det_ctx->pmq, buffer->inspect, buffer->inspect_len);
797  PREFILTER_PROFILING_ADD_BYTES(det_ctx, buffer->inspect_len);
798  }
799 
800  local_id++;
801  } while (1);
802 }
803 
805  const DetectBufferMpmRegistry *mpm_reg, int list_id)
806 {
807  SCEnter();
808  PrefilterMpmListId *pectx = SCCalloc(1, sizeof(*pectx));
809  if (pectx == NULL)
810  return -1;
811  pectx->list_id = list_id;
812  pectx->GetData = mpm_reg->app_v2.GetMultiData;
813  pectx->mpm_ctx = mpm_ctx;
814  pectx->transforms = &mpm_reg->transforms;
815 
816  int r = PrefilterAppendTxEngine(de_ctx, sgh, PrefilterMultiMpm, mpm_reg->app_v2.alproto,
817  mpm_reg->app_v2.tx_min_progress, pectx, PrefilterMultiGenericMpmFree, mpm_reg->pname);
818  if (r != 0) {
819  SCFree(pectx);
820  }
821  return r;
822 }
823 
824 /* generic mpm for pkt engines */
825 
826 typedef struct PrefilterMpmPktCtx {
827  int list_id;
829  const MpmCtx *mpm_ctx;
832 
833 /** \brief Generic Mpm prefilter callback
834  *
835  * \param det_ctx detection engine thread ctx
836  * \param p packet to inspect
837  * \param f flow to inspect
838  * \param txv tx to inspect
839  * \param pectx inspection context
840  */
841 static void PrefilterMpmPkt(DetectEngineThreadCtx *det_ctx,
842  Packet *p, const void *pectx)
843 {
844  SCEnter();
845 
846  const PrefilterMpmPktCtx *ctx = (const PrefilterMpmPktCtx *)pectx;
847  const MpmCtx *mpm_ctx = ctx->mpm_ctx;
848  SCLogDebug("running on list %d", ctx->list_id);
849 
850  InspectionBuffer *buffer = ctx->GetData(det_ctx, ctx->transforms,
851  p, ctx->list_id);
852  if (buffer == NULL)
853  return;
854 
855  const uint32_t data_len = buffer->inspect_len;
856  const uint8_t *data = buffer->inspect;
857 
858  SCLogDebug("mpm'ing buffer:");
859  //PrintRawDataFp(stdout, data, data_len);
860 
861  if (data != NULL && data_len >= mpm_ctx->minlen) {
862  (void)mpm_table[mpm_ctx->mpm_type].Search(
863  mpm_ctx, &det_ctx->mtc, &det_ctx->pmq, data, data_len);
864  PREFILTER_PROFILING_ADD_BYTES(det_ctx, data_len);
865  }
866 }
867 
868 static void PrefilterMpmPktFree(void *ptr)
869 {
870  SCFree(ptr);
871 }
872 
874  const DetectBufferMpmRegistry *mpm_reg, int list_id)
875 {
876  SCEnter();
877  PrefilterMpmPktCtx *pectx = SCCalloc(1, sizeof(*pectx));
878  if (pectx == NULL)
879  return -1;
880  pectx->list_id = list_id;
881  pectx->GetData = mpm_reg->pkt_v1.GetData;
882  pectx->mpm_ctx = mpm_ctx;
883  pectx->transforms = &mpm_reg->transforms;
884 
885  int r = PrefilterAppendEngine(
886  de_ctx, sgh, PrefilterMpmPkt, 0, pectx, PrefilterMpmPktFree, mpm_reg->pname);
887  if (r != 0) {
888  SCFree(pectx);
889  }
890  return r;
891 }
HashListTableGetListData
#define HashListTableGetListData(hb)
Definition: util-hashlist.h:56
PrefilterGenericMpmPktRegister
int PrefilterGenericMpmPktRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
Definition: detect-engine-prefilter.c:873
PrefilterEngineList_::frame_type
uint8_t frame_type
Definition: detect.h:1385
SigGroupHead_::tx_engines
PrefilterEngine * tx_engines
Definition: detect.h:1484
Packet_::proto
uint8_t proto
Definition: decode.h:498
DetectTransaction_::tx_data_ptr
struct AppLayerTxData * tx_data_ptr
Definition: detect-engine-prefilter.h:34
PrefilterEngineList_::Prefilter
PrefilterPktFn Prefilter
Definition: detect.h:1393
MpmCtx_::mpm_type
uint8_t mpm_type
Definition: util-mpm.h:90
detect-engine.h
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:128
PatternMatchPrepareGroup
int PatternMatchPrepareGroup(DetectEngineCtx *de_ctx, SigGroupHead *sh)
Prepare the pattern matcher ctx in a sig group head.
Definition: detect-engine-mpm.c:2226
PrefilterMpmPktCtx
struct PrefilterMpmPktCtx PrefilterMpmPktCtx
PrefilterStore_::FreeFunc
void(* FreeFunc)(void *)
Definition: detect-engine-prefilter.h:46
PREFILTER_PROFILING_END
#define PREFILTER_PROFILING_END(ctx, profile_id)
Definition: util-profiling.h:276
PrefilterStore_
Definition: detect-engine-prefilter.h:44
CLS
#define CLS
Definition: suricata-common.h:56
PrefilterRuleStore_::rule_id_array_cnt
uint32_t rule_id_array_cnt
Definition: util-prefilter.h:40
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1465
DetectEngineTransforms
Definition: detect.h:408
PrefilterEngineList_::id
uint16_t id
Definition: detect.h:1377
PROF_DETECT_PF_PAYLOAD
@ PROF_DETECT_PF_PAYLOAD
Definition: suricata-common.h:446
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
Packet_::pcap_cnt
uint64_t pcap_cnt
Definition: decode.h:595
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:81
PrefilterMpmCtx::GetData
InspectionBufferGetDataPtr GetData
Definition: detect-engine-prefilter.c:705
InspectionBuffer
Definition: detect.h:373
Packet_::flags
uint32_t flags
Definition: decode.h:513
Flow_
Flow data structure.
Definition: flow.h:356
PREFILTER_PROFILING_START
#define PREFILTER_PROFILING_START(det_ctx)
Definition: util-profiling.h:260
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1205
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:414
DetectBufferMpmRegistry_::app_v2
struct DetectBufferMpmRegistry_::@84::@86 app_v2
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:75
ctx
struct Thresholds ctx
PrefilterEngineList_::name
const char * name
Definition: detect.h:1402
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:843
HashListTableGetListHead
HashListTableBucket * HashListTableGetListHead(HashListTable *ht)
Definition: util-hashlist.c:287
PrefilterEngine_::tx_min_progress
uint8_t tx_min_progress
Definition: detect.h:1417
InspectionBufferGetPktDataPtr
InspectionBuffer *(* InspectionBufferGetPktDataPtr)(struct DetectEngineThreadCtx_ *det_ctx, const DetectEngineTransforms *transforms, Packet *p, const int list_id)
Definition: detect.h:483
PrefilterDeinit
void PrefilterDeinit(DetectEngineCtx *de_ctx)
Definition: detect-engine-prefilter.c:623
DetectBufferMpmRegistry_
one time registration of keywords at start up
Definition: detect.h:687
PrefilterMpmPktCtx
Definition: detect-engine-prefilter.c:826
detect-engine-frame.h
SigGroupHead_::payload_engines
PrefilterEngine * payload_engines
Definition: detect.h:1483
DetectEngineCtx_::prefilter_setting
enum DetectEnginePrefilterSetting prefilter_setting
Definition: detect.h:978
PKT_NOPAYLOAD_INSPECTION
#define PKT_NOPAYLOAD_INSPECTION
Definition: decode.h:1257
PACKET_PROFILING_DETECT_END
#define PACKET_PROFILING_DETECT_END(p, id)
Definition: util-profiling.h:221
HashListTableLookup
void * HashListTableLookup(HashListTable *ht, void *data, uint16_t datalen)
Definition: util-hashlist.c:245
PrefilterEngine_::local_id
uint16_t local_id
Definition: detect.h:1408
PrefilterEngineList_::Free
void(* Free)(void *pectx)
Definition: detect.h:1400
PrefilterAppendFrameEngine
int PrefilterAppendFrameEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterFrameFn PrefilterFrameFunc, AppProto alproto, uint8_t frame_type, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:310
DetectBufferMpmRegistry_::transforms
DetectEngineTransforms transforms
Definition: detect.h:700
Packet_::payload_len
uint16_t payload_len
Definition: decode.h:575
DetectTransaction_::tx_progress
const int tx_progress
Definition: detect-engine-prefilter.h:40
detect-engine-prefilter.h
PrefilterMultiGenericMpmRegister
int PrefilterMultiGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
Definition: detect-engine-prefilter.c:804
PrefilterStore_::id
uint32_t id
Definition: detect-engine-prefilter.h:47
HashListTableAdd
int HashListTableAdd(HashListTable *ht, void *data, uint16_t datalen)
Definition: util-hashlist.c:114
PrefilterEngine_::cb
union PrefilterEngine_::@99 cb
DETECT_PREFILTER_AUTO
@ DETECT_PREFILTER_AUTO
Definition: detect.h:820
HashListTable_::array_size
uint32_t array_size
Definition: util-hashlist.h:41
PrefilterEngine_::is_last_for_progress
bool is_last_for_progress
Definition: detect.h:1434
PROF_DETECT_PF_SORT1
@ PROF_DETECT_PF_SORT1
Definition: suricata-common.h:449
DetectEngineCtx_::prefilter_id
uint32_t prefilter_id
Definition: detect.h:1009
PrefilterEngineList_::next
struct PrefilterEngineList_ * next
Definition: detect.h:1397
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1297
Flow_::alparser
AppLayerParserState * alparser
Definition: flow.h:480
HashListTableGetListNext
#define HashListTableGetListNext(hb)
Definition: util-hashlist.h:55
PrefilterMpmListId
Definition: detect-engine-mpm.h:120
DetectEngineCtx_::prefilter_hash_table
HashListTable * prefilter_hash_table
Definition: detect.h:1010
app-layer-htp.h
HashListTableInit
HashListTable * HashListTableInit(uint32_t size, uint32_t(*Hash)(struct HashListTable_ *, void *, uint16_t), char(*Compare)(void *, uint16_t, void *, uint16_t), void(*Free)(void *))
Definition: util-hashlist.c:35
PrefilterEngineList_::alproto
AppProto alproto
Definition: detect.h:1380
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
Prefilter
void Prefilter(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh, Packet *p, const uint8_t flags, const SignatureMask mask)
Definition: detect-engine-prefilter.c:147
PrefilterStoreGetName
const char * PrefilterStoreGetName(const uint32_t id)
Definition: detect-engine-prefilter.c:695
DetectEngineThreadCtx_
Definition: detect.h:1098
PrefilterEngine_
Definition: detect.h:1407
SigGroupHeadInitData_::tx_engines
PrefilterEngineList * tx_engines
Definition: detect.h:1454
PROF_DETECT_PF_PKT
@ PROF_DETECT_PF_PKT
Definition: suricata-common.h:445
PrefilterEngineList_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1395
PrefilterEngineList_::pectx
void * pectx
Definition: detect.h:1391
util-print.h
SCEnter
#define SCEnter(...)
Definition: util-debug.h:271
detect-engine-mpm.h
PrefilterEngineList_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1394
DetectEngineCtx_::sm_types_prefilter
bool * sm_types_prefilter
Definition: detect.h:1025
PrefilterEngine_::ctx
union PrefilterEngine_::@98 ctx
PrefilterEngineList_::gid
uint32_t gid
Definition: detect.h:1404
PrefilterMpmPktCtx::GetData
InspectionBufferGetPktDataPtr GetData
Definition: detect-engine-prefilter.c:828
PKT_DETECT_HAS_STREAMDATA
#define PKT_DETECT_HAS_STREAMDATA
Definition: decode.h:1307
DetectBufferMpmRegistry_::pkt_v1
struct DetectBufferMpmRegistry_::@84::@87 pkt_v1
PrefilterMpmCtx
struct PrefilterMpmCtx PrefilterMpmCtx
PrefilterGenericMpmRegister
int PrefilterGenericMpmRegister(DetectEngineCtx *de_ctx, SigGroupHead *sgh, MpmCtx *mpm_ctx, const DetectBufferMpmRegistry *mpm_reg, int list_id)
Definition: detect-engine-prefilter.c:750
PrefilterFrameFn
void(* PrefilterFrameFn)(DetectEngineThreadCtx *det_ctx, const void *pectx, Packet *p, const struct Frames *frames, const struct Frame *frame)
Definition: detect.h:1369
SigGroupHead_::init
SigGroupHeadInitData * init
Definition: detect.h:1488
PrefilterMpmListId::transforms
const DetectEngineTransforms * transforms
Definition: detect-engine-mpm.h:124
app-layer-parser.h
MpmCtx_::minlen
uint16_t minlen
Definition: util-mpm.h:99
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:300
util-profiling.h
DetectTransaction_::tx_id
const uint64_t tx_id
Definition: detect-engine-prefilter.h:33
SCReturn
#define SCReturn
Definition: util-debug.h:273
PrefilterEngine_::alproto
AppProto alproto
Definition: detect.h:1411
PrefilterMpmListId::mpm_ctx
const MpmCtx * mpm_ctx
Definition: detect-engine-mpm.h:122
DetectTransaction_::prefilter_flags
uint64_t prefilter_flags
Definition: detect-engine-prefilter.h:37
Packet_
Definition: decode.h:476
SCFreeAligned
#define SCFreeAligned(p)
Definition: util-mem.h:77
PrefilterEngine_::PrefilterFrame
PrefilterFrameFn PrefilterFrame
Definition: detect.h:1428
PrefilterEngine_::frame_type
uint8_t frame_type
Definition: detect.h:1418
PrefilterAppendEngine
int PrefilterAppendEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterPktFn PrefilterFunc, SignatureMask mask, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:208
HashListTable_
Definition: util-hashlist.h:37
BIT_U64
#define BIT_U64(n)
Definition: suricata-common.h:401
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:1373
MpmTableElmt_::Search
uint32_t(* Search)(const struct MpmCtx_ *, struct MpmThreadCtx_ *, PrefilterRuleStore *, const uint8_t *, uint32_t)
Definition: util-mpm.h:168
SigGroupHead_::frame_engines
PrefilterEngine * frame_engines
Definition: detect.h:1485
PrefilterMpmCtx::list_id
int list_id
Definition: detect-engine-prefilter.c:704
DetectEngineThreadCtx_::mtc
MpmThreadCtx mtc
Definition: detect.h:1204
PrefilterMpmPktCtx::list_id
int list_id
Definition: detect-engine-prefilter.c:827
PrefilterAppendPayloadEngine
int PrefilterAppendPayloadEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterPktFn PrefilterFunc, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:241
SigGroupHeadInitData_::pkt_engines
PrefilterEngineList * pkt_engines
Definition: detect.h:1452
AppLayerTxData
struct AppLayerTxData AppLayerTxData
Definition: detect.h:1372
cnt
uint32_t cnt
Definition: tmqh-packetpool.h:7
PREFILTER_PROFILING_ADD_BYTES
#define PREFILTER_PROFILING_ADD_BYTES(det_ctx, bytes)
Definition: util-profiling.h:286
Packet_::flow
struct Flow_ * flow
Definition: decode.h:515
flags
uint8_t flags
Definition: decode-gre.h:0
suricata-common.h
SigGroupHeadInitData_::frame_engines
PrefilterEngineList * frame_engines
Definition: detect.h:1455
SigGroupHeadInitData_::payload_engines
PrefilterEngineList * payload_engines
Definition: detect.h:1453
HashListTableFree
void HashListTableFree(HashListTable *ht)
Definition: util-hashlist.c:88
PROF_DETECT_PF_RECORD
@ PROF_DETECT_PF_RECORD
Definition: suricata-common.h:448
SCMallocAligned
#define SCMallocAligned(size, align)
Definition: util-mem.h:68
DetectEnginePrefilterSetting
DetectEnginePrefilterSetting
Definition: detect.h:818
DetectTransaction_
Definition: detect-engine-prefilter.h:31
PrefilterEngineList_
Definition: detect.h:1376
PrefilterCleanupRuleGroup
void PrefilterCleanupRuleGroup(const DetectEngineCtx *de_ctx, SigGroupHead *sgh)
Definition: detect-engine-prefilter.c:381
PrefilterEngine_::gid
uint32_t gid
Definition: detect.h:1432
FatalError
#define FatalError(...)
Definition: util-debug.h:502
PrefilterMpmPktCtx::transforms
const DetectEngineTransforms * transforms
Definition: detect-engine-prefilter.c:830
PrefilterAppendTxEngine
int PrefilterAppendTxEngine(DetectEngineCtx *de_ctx, SigGroupHead *sgh, PrefilterTxFn PrefilterTxFunc, AppProto alproto, int tx_min_progress, void *pectx, void(*FreeFunc)(void *pectx), const char *name)
Definition: detect-engine-prefilter.c:273
PrefilterPktFn
void(* PrefilterPktFn)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
Definition: detect.h:1368
PrefilterMpmCtx
Definition: detect-engine-prefilter.c:703
PrefilterMpmListId::GetData
InspectionMultiBufferGetDataPtr GetData
Definition: detect-engine-mpm.h:123
util-validate.h
DetectTransaction_::tx_ptr
void * tx_ptr
Definition: detect-engine-prefilter.h:32
InspectionBuffer::inspect_len
uint32_t inspect_len
Definition: detect.h:376
PrefilterEngine_::pectx
void * pectx
Definition: detect.h:1423
PrefilterInit
void PrefilterInit(DetectEngineCtx *de_ctx)
Definition: detect-engine-prefilter.c:630
InspectionBuffer::inspect
const uint8_t * inspect
Definition: detect.h:374
PACKET_PROFILING_DETECT_START
#define PACKET_PROFILING_DETECT_START(p, id)
Definition: util-profiling.h:214
PrefilterMpmCtx::transforms
const DetectEngineTransforms * transforms
Definition: detect-engine-prefilter.c:707
DETECT_TBLSIZE
int DETECT_TBLSIZE
Definition: detect-engine-register.c:281
PrefilterStore_::name
const char * name
Definition: detect-engine-prefilter.h:45
SCFree
#define SCFree(p)
Definition: util-mem.h:61
HashListTableBucket_
Definition: util-hashlist.h:28
PrefilterMpmPktCtx::mpm_ctx
const MpmCtx * mpm_ctx
Definition: detect-engine-prefilter.c:829
PrefilterEngineList_::pkt_mask
SignatureMask pkt_mask
Definition: detect.h:1387
PrefilterMpmListId::list_id
int list_id
Definition: detect-engine-mpm.h:121
SignatureMask
#define SignatureMask
Definition: detect.h:311
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
ALPROTO_FAILED
@ ALPROTO_FAILED
Definition: app-layer-protos.h:74
PrefilterEngine_::pkt_mask
SignatureMask pkt_mask
Definition: detect.h:1414
mpm_table
MpmTableElmt mpm_table[MPM_TABLE_SIZE]
Definition: util-mpm.c:47
PrefilterEngine_::is_last
bool is_last
Definition: detect.h:1433
suricata.h
PrefilterEngineList_::tx_min_progress
uint8_t tx_min_progress
Definition: detect.h:1383
DetectGetInnerTx
void * DetectGetInnerTx(void *tx_ptr, AppProto alproto, AppProto engine_alproto, uint8_t flow_flags)
Definition: detect.c:1074
PrefilterSetupRuleGroup
void PrefilterSetupRuleGroup(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
Definition: detect-engine-prefilter.c:416
likely
#define likely(expr)
Definition: util-optimize.h:32
SigGroupHead_::pkt_engines
PrefilterEngine * pkt_engines
Definition: detect.h:1482
PrefilterEngine_::Prefilter
PrefilterPktFn Prefilter
Definition: detect.h:1426
PrefilterEngine_::PrefilterTx
PrefilterTxFn PrefilterTx
Definition: detect.h:1427
MpmCtx_
Definition: util-mpm.h:88
SigIntId
#define SigIntId
Definition: suricata-common.h:315
Flow_::alproto
AppProto alproto
application level protocol
Definition: flow.h:455
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
PrefilterFreeEnginesList
void PrefilterFreeEnginesList(PrefilterEngineList *list)
Definition: detect-engine-prefilter.c:353
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:102
PrefilterMpmCtx::mpm_ctx
const MpmCtx * mpm_ctx
Definition: detect-engine-prefilter.c:706
DetectRunPrefilterTx
void DetectRunPrefilterTx(DetectEngineThreadCtx *det_ctx, const SigGroupHead *sgh, Packet *p, const uint8_t ipproto, const uint8_t flow_flags, const AppProto alproto, void *alstate, DetectTransaction *tx)
run prefilter engines on a transaction
Definition: detect-engine-prefilter.c:93
PrefilterRuleStore_::rule_id_array
SigIntId * rule_id_array
Definition: util-prefilter.h:38
DetectBufferMpmRegistry_::pname
char pname[32]
Definition: detect.h:689