suricata
detect-fragoffset.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-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 Breno Silva <breno.silva@gmail.com>
22  *
23  * Implements fragoffset keyword
24  */
25 
26 #include "suricata-common.h"
27 #include "decode.h"
28 #include "decode-ipv4.h"
29 #include "decode-ipv6.h"
30 
31 #include "detect.h"
32 #include "detect-parse.h"
34 #include "detect-engine-build.h"
35 
36 #include "detect-fragoffset.h"
37 
38 #include "util-byte.h"
39 #include "util-unittest.h"
40 #include "util-debug.h"
41 
42 #define PARSE_REGEX "^\\s*(?:(<|>))?\\s*([0-9]+)"
43 
44 static DetectParseRegex parse_regex;
45 
46 static int DetectFragOffsetMatch(DetectEngineThreadCtx *,
47  Packet *, const Signature *, const SigMatchCtx *);
48 static int DetectFragOffsetSetup(DetectEngineCtx *, Signature *, const char *);
49 #ifdef UNITTESTS
51 #endif
53 
54 static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
55 static bool PrefilterFragOffsetIsPrefilterable(const Signature *s);
56 
57 /**
58  * \brief Registration function for fragoffset
59  */
61 {
62  sigmatch_table[DETECT_FRAGOFFSET].name = "fragoffset";
63  sigmatch_table[DETECT_FRAGOFFSET].desc = "match on specific decimal values of the IP fragment offset field";
64  sigmatch_table[DETECT_FRAGOFFSET].url = "/rules/header-keywords.html#fragoffset";
65  sigmatch_table[DETECT_FRAGOFFSET].Match = DetectFragOffsetMatch;
66  sigmatch_table[DETECT_FRAGOFFSET].Setup = DetectFragOffsetSetup;
68 #ifdef UNITTESTS
70 #endif
71  sigmatch_table[DETECT_FRAGOFFSET].SupportsPrefilter = PrefilterFragOffsetIsPrefilterable;
72  sigmatch_table[DETECT_FRAGOFFSET].SetupPrefilter = PrefilterSetupFragOffset;
73 
74  DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
75 }
76 
77 static inline int FragOffsetMatch(const uint16_t poffset, const uint8_t mode,
78  const uint16_t doffset)
79 {
80  switch (mode) {
81  case FRAG_LESS:
82  if (poffset < doffset)
83  return 1;
84  break;
85  case FRAG_MORE:
86  if (poffset > doffset)
87  return 1;
88  break;
89  default:
90  if (poffset == doffset)
91  return 1;
92  }
93  return 0;
94 }
95 
96 /**
97  * \brief This function is used to match fragoffset rule option set on a packet
98  *
99  * \param t pointer to thread vars
100  * \param det_ctx pointer to the pattern matcher thread
101  * \param p pointer to the current packet
102  * \param m pointer to the sigmatch that we will cast into DetectFragOffsetData
103  *
104  * \retval 0 no match or frag is not set
105  * \retval 1 match
106  *
107  */
108 static int DetectFragOffsetMatch (DetectEngineThreadCtx *det_ctx,
109  Packet *p, const Signature *s, const SigMatchCtx *ctx)
110 {
111  uint16_t frag = 0;
112  const DetectFragOffsetData *fragoff = (const DetectFragOffsetData *)ctx;
113 
114  if (PKT_IS_PSEUDOPKT(p))
115  return 0;
116 
117  if (PKT_IS_IPV4(p)) {
118  frag = IPV4_GET_IPOFFSET(p);
119  } else if (PKT_IS_IPV6(p)) {
120  if (IPV6_EXTHDR_ISSET_FH(p)) {
121  frag = IPV6_EXTHDR_GET_FH_OFFSET(p);
122  } else {
123  return 0;
124  }
125  } else {
126  SCLogDebug("No IPv4 or IPv6 packet");
127  return 0;
128  }
129 
130  return FragOffsetMatch(frag, fragoff->mode, fragoff->frag_off);
131 }
132 
133 /**
134  * \brief This function is used to parse fragoffset option passed via fragoffset: keyword
135  *
136  * \param de_ctx Pointer to the detection engine context
137  * \param fragoffsetstr Pointer to the user provided fragoffset options
138  *
139  * \retval fragoff pointer to DetectFragOffsetData on success
140  * \retval NULL on failure
141  */
142 static DetectFragOffsetData *DetectFragOffsetParse (DetectEngineCtx *de_ctx, const char *fragoffsetstr)
143 {
144  DetectFragOffsetData *fragoff = NULL;
145  char *substr[3] = {NULL, NULL, NULL};
146  int res = 0;
147  size_t pcre2_len;
148  int i;
149  const char *str_ptr;
150  char *mode = NULL;
151  pcre2_match_data *match = NULL;
152 
153  int ret = DetectParsePcreExec(&parse_regex, &match, fragoffsetstr, 0, 0);
154  if (ret < 1 || ret > 4) {
155  SCLogError("Parse error %s", fragoffsetstr);
156  goto error;
157  }
158 
159  for (i = 1; i < ret; i++) {
160  res = SC_Pcre2SubstringGet(match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
161  if (res < 0) {
162  SCLogError("pcre2_substring_get_bynumber failed");
163  goto error;
164  }
165  substr[i-1] = (char *)str_ptr;
166  }
167 
168  fragoff = SCMalloc(sizeof(DetectFragOffsetData));
169  if (unlikely(fragoff == NULL))
170  goto error;
171 
172  fragoff->frag_off = 0;
173  fragoff->mode = 0;
174 
175  mode = substr[0];
176 
177  if(mode != NULL) {
178 
179  while(*mode != '\0') {
180  switch(*mode) {
181  case '>':
182  fragoff->mode = FRAG_MORE;
183  break;
184  case '<':
185  fragoff->mode = FRAG_LESS;
186  break;
187  }
188  mode++;
189  }
190  }
191 
192  if (StringParseUint16(&fragoff->frag_off, 10, 0, substr[1]) < 0) {
193  SCLogError("specified frag offset %s is not "
194  "valid",
195  substr[1]);
196  goto error;
197  }
198 
199  for (i = 0; i < 3; i++) {
200  if (substr[i] != NULL)
201  pcre2_substring_free((PCRE2_UCHAR8 *)substr[i]);
202  }
203 
204  pcre2_match_data_free(match);
205  return fragoff;
206 
207 error:
208  if (match) {
209  pcre2_match_data_free(match);
210  }
211  for (i = 0; i < 3; i++) {
212  if (substr[i] != NULL)
213  pcre2_substring_free((PCRE2_UCHAR8 *)substr[i]);
214  }
215  if (fragoff != NULL) DetectFragOffsetFree(de_ctx, fragoff);
216  return NULL;
217 
218 }
219 
220 /**
221  * \brief this function is used to add the parsed fragoffset data into the current signature
222  *
223  * \param de_ctx pointer to the Detection Engine Context
224  * \param s pointer to the Current Signature
225  * \param fragoffsetstr pointer to the user provided fragoffset option
226  *
227  * \retval 0 on Success
228  * \retval -1 on Failure
229  */
230 static int DetectFragOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *fragoffsetstr)
231 {
232  DetectFragOffsetData *fragoff = NULL;
233 
234  fragoff = DetectFragOffsetParse(de_ctx, fragoffsetstr);
235  if (fragoff == NULL) goto error;
236 
238  DETECT_SM_LIST_MATCH) == NULL) {
239  goto error;
240  }
242 
243  return 0;
244 
245 error:
246  if (fragoff != NULL)
247  DetectFragOffsetFree(de_ctx, fragoff);
248  return -1;
249 
250 }
251 
252 /**
253  * \brief this function will free memory associated with DetectFragOffsetData
254  *
255  * \param ptr pointer to DetectFragOffsetData
256  */
258 {
259  DetectFragOffsetData *fragoff = (DetectFragOffsetData *)ptr;
260  SCFree(fragoff);
261 }
262 
263 static void
264 PrefilterPacketFragOffsetMatch(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
265 {
266  if (PKT_IS_PSEUDOPKT(p))
267  return;
268 
269  uint16_t frag;
270 
271  if (PKT_IS_IPV4(p)) {
272  frag = IPV4_GET_IPOFFSET(p);
273  } else if (PKT_IS_IPV6(p)) {
274  if (IPV6_EXTHDR_ISSET_FH(p)) {
275  frag = IPV6_EXTHDR_GET_FH_OFFSET(p);
276  } else {
277  return;
278  }
279  } else {
280  SCLogDebug("No IPv4 or IPv6 packet");
281  return;
282  }
283 
284  const PrefilterPacketHeaderCtx *ctx = pectx;
285  if (FragOffsetMatch(frag, ctx->v1.u8[0], ctx->v1.u16[1]))
286  {
287  PrefilterAddSids(&det_ctx->pmq, ctx->sigs_array, ctx->sigs_cnt);
288  }
289 }
290 
291 static void
292 PrefilterPacketFragOffsetSet(PrefilterPacketHeaderValue *v, void *smctx)
293 {
294  const DetectFragOffsetData *fb = smctx;
295  v->u8[0] = fb->mode;
296  v->u16[1] = fb->frag_off;
297 }
298 
299 static bool
300 PrefilterPacketFragOffsetCompare(PrefilterPacketHeaderValue v, void *smctx)
301 {
302  const DetectFragOffsetData *fb = smctx;
303  if (v.u8[0] == fb->mode &&
304  v.u16[1] == fb->frag_off)
305  {
306  return true;
307  }
308  return false;
309 }
310 
311 static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
312 {
314  PrefilterPacketFragOffsetSet,
315  PrefilterPacketFragOffsetCompare,
316  PrefilterPacketFragOffsetMatch);
317 }
318 
319 static bool PrefilterFragOffsetIsPrefilterable(const Signature *s)
320 {
321  const SigMatch *sm;
322  for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) {
323  switch (sm->type) {
324  case DETECT_FRAGOFFSET:
325  return true;
326  }
327  }
328  return false;
329 }
330 
331 #ifdef UNITTESTS
332 #include "util-unittest-helper.h"
333 #include "detect-engine.h"
334 #include "detect-engine-alert.h"
335 
336 /**
337  * \test DetectFragOffsetParseTest01 is a test for setting a valid fragoffset value
338  */
339 static int DetectFragOffsetParseTest01 (void)
340 {
341  DetectFragOffsetData *fragoff = DetectFragOffsetParse(NULL, "300");
342 
343  FAIL_IF_NULL(fragoff);
344  FAIL_IF_NOT(fragoff->frag_off == 300);
345 
346  DetectFragOffsetFree(NULL, fragoff);
347 
348  PASS;
349 }
350 
351 /**
352  * \test DetectFragOffsetParseTest02 is a test for setting a valid fragoffset value
353  * with spaces all around
354  */
355 static int DetectFragOffsetParseTest02 (void)
356 {
357  DetectFragOffsetData *fragoff = DetectFragOffsetParse(NULL, ">300");
358 
359  FAIL_IF_NULL(fragoff);
360  FAIL_IF_NOT(fragoff->frag_off == 300);
361  FAIL_IF_NOT(fragoff->mode == FRAG_MORE);
362 
363  DetectFragOffsetFree(NULL, fragoff);
364 
365  PASS;
366 }
367 
368 /**
369  * \test DetectFragOffsetParseTest03 is a test for setting an invalid fragoffset value
370  */
371 static int DetectFragOffsetParseTest03 (void)
372 {
373  DetectFragOffsetData *fragoff = DetectFragOffsetParse(NULL, "badc");
374 
375  FAIL_IF_NOT_NULL(fragoff);
376 
377  PASS;
378 }
379 
380 /**
381  * \test DetectFragOffsetMatchTest01 is a test for checking the working of
382  * fragoffset keyword by creating 2 rules and matching a crafted packet
383  * against them. Only the first one shall trigger.
384  */
385 static int DetectFragOffsetMatchTest01 (void)
386 {
387  Packet *p = PacketGetFromAlloc();
388 
389  FAIL_IF_NULL(p);
390  Signature *s = NULL;
392  ThreadVars th_v;
393  DetectEngineThreadCtx *det_ctx = NULL;
394  IPV4Hdr ip4h;
395 
396  memset(&ip4h, 0, sizeof(IPV4Hdr));
397  memset(&dtv, 0, sizeof(DecodeThreadVars));
398  memset(&th_v, 0, sizeof(ThreadVars));
399 
401 
402  p->src.family = AF_INET;
403  p->dst.family = AF_INET;
404  p->src.addr_data32[0] = 0x01020304;
405  p->dst.addr_data32[0] = 0x04030201;
406 
407  ip4h.s_ip_src.s_addr = p->src.addr_data32[0];
408  ip4h.s_ip_dst.s_addr = p->dst.addr_data32[0];
409  ip4h.ip_off = 0x2222;
410  p->ip4h = &ip4h;
411 
414 
415  de_ctx->flags |= DE_QUIET;
416 
417  s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any (fragoffset:546; sid:1;)");
418  FAIL_IF_NULL(s);
419 
420  s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any (fragoffset:5000; sid:2;)");
421  FAIL_IF_NULL(s);
422 
424  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
425 
426  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
427 
428  FAIL_IF(PacketAlertCheck(p, 1) == 0);
429  FAIL_IF(PacketAlertCheck(p, 2));
430 
431  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
433 
434  FlowShutdown();
435 
436  SCFree(p);
437  PASS;
438 }
439 
441 {
442  UtRegisterTest("DetectFragOffsetParseTest01", DetectFragOffsetParseTest01);
443  UtRegisterTest("DetectFragOffsetParseTest02", DetectFragOffsetParseTest02);
444  UtRegisterTest("DetectFragOffsetParseTest03", DetectFragOffsetParseTest03);
445  UtRegisterTest("DetectFragOffsetMatchTest01", DetectFragOffsetMatchTest01);
446 }
447 #endif /* UNITTESTS */
util-byte.h
SigTableElmt_::url
const char * url
Definition: detect.h:1299
detect-engine.h
FAIL_IF_NULL
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
Definition: util-unittest.h:89
SignatureInitData_::smlists
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
Definition: detect.h:581
DetectFragOffsetRegisterTests
void DetectFragOffsetRegisterTests(void)
Definition: detect-fragoffset.c:440
SigTableElmt_::desc
const char * desc
Definition: detect.h:1298
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1286
IPV6_EXTHDR_GET_FH_OFFSET
#define IPV6_EXTHDR_GET_FH_OFFSET(p)
Definition: decode-ipv6.h:128
DetectParseRegex
Definition: detect-parse.h:62
SigTableElmt_::name
const char * name
Definition: detect.h:1296
PKT_IS_PSEUDOPKT
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Definition: decode.h:1075
PKT_IS_IPV6
#define PKT_IS_IPV6(p)
Definition: decode.h:247
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1448
IPV4_GET_IPOFFSET
#define IPV4_GET_IPOFFSET(p)
Definition: decode-ipv4.h:135
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
UtRegisterTest
void UtRegisterTest(const char *name, int(*TestFn)(void))
Register unit test.
Definition: util-unittest.c:103
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
IPV6_EXTHDR_ISSET_FH
#define IPV6_EXTHDR_ISSET_FH(p)
Definition: decode-ipv6.h:239
PacketAlertCheck
int PacketAlertCheck(Packet *p, uint32_t sid)
Check if a certain sid alerted, this is used in the test functions.
Definition: detect-engine-alert.c:141
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1204
DetectFragOffsetRegister
void DetectFragOffsetRegister(void)
Registration function for fragoffset.
Definition: detect-fragoffset.c:60
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:839
StringParseUint16
int StringParseUint16(uint16_t *res, int base, size_t len, const char *str)
Definition: util-byte.c:337
PrefilterPacketHeaderCtx_::sigs_array
SigIntId * sigs_array
Definition: detect-engine-prefilter-common.h:43
FRAG_MORE
#define FRAG_MORE
Definition: detect-fragoffset.h:28
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2533
PrefilterPacketHeaderValue::u8
uint8_t u8[16]
Definition: detect-engine-prefilter-common.h:24
DE_QUIET
#define DE_QUIET
Definition: detect.h:324
SigMatchSignatures
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1895
DetectParsePcreExec
int DetectParsePcreExec(DetectParseRegex *parse_regex, pcre2_match_data **match, const char *str, int start_offset, int options)
Definition: detect-parse.c:2674
PrefilterPacketHeaderCtx_::sigs_cnt
uint32_t sigs_cnt
Definition: detect-engine-prefilter-common.h:42
DetectEngineAppendSig
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
Definition: detect-parse.c:2620
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1281
PrefilterPacketHeaderValue::u16
uint16_t u16[8]
Definition: detect-engine-prefilter-common.h:25
FRAG_LESS
#define FRAG_LESS
Definition: detect-fragoffset.h:27
util-unittest.h
util-unittest-helper.h
FAIL_IF_NOT
#define FAIL_IF_NOT(expr)
Fail a test if expression evaluates to false.
Definition: util-unittest.h:82
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1284
FlowInitConfig
void FlowInitConfig(bool quiet)
initialize the configuration
Definition: flow.c:537
DetectFragOffsetFree
void DetectFragOffsetFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectFragOffsetData
Definition: detect-fragoffset.c:257
decode-ipv6.h
PrefilterPacketHeaderCtx_
Definition: detect-engine-prefilter-common.h:35
decode.h
FAIL_IF_NOT_NULL
#define FAIL_IF_NOT_NULL(expr)
Fail a test if expression evaluates to non-NULL.
Definition: util-unittest.h:96
util-debug.h
PASS
#define PASS
Pass the test.
Definition: util-unittest.h:105
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
DetectEngineThreadCtx_
Definition: detect.h:1095
DetectSetupParseRegexes
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
Definition: detect-parse.c:2791
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:354
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:114
SC_Pcre2SubstringGet
int SC_Pcre2SubstringGet(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen)
Definition: detect-parse.c:2779
Signature_::flags
uint32_t flags
Definition: detect.h:597
Packet_
Definition: decode.h:437
detect-engine-build.h
detect-engine-alert.h
Packet_::ip4h
IPV4Hdr * ip4h
Definition: decode.h:545
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:665
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1264
detect-fragoffset.h
DetectFragOffsetData_::mode
uint8_t mode
Definition: detect-fragoffset.h:32
SigGroupBuild
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
Definition: detect-engine-build.c:2149
dtv
DecodeThreadVars * dtv
Definition: fuzz_decodepcapfile.c:33
PrefilterPacketHeaderCtx_::v1
PrefilterPacketHeaderValue v1
Definition: detect-engine-prefilter-common.h:36
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:345
IPV4Hdr_
Definition: decode-ipv4.h:72
decode-ipv4.h
DetectEngineThreadCtxInit
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
Definition: detect-engine.c:3244
FAIL_IF
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
Definition: util-unittest.h:71
suricata-common.h
DetectEngineThreadCtxDeinit
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
Definition: detect-engine.c:3454
SigMatch_::type
uint16_t type
Definition: detect.h:351
FlowShutdown
void FlowShutdown(void)
shutdown the flow engine
Definition: flow.c:685
DETECT_FRAGOFFSET
@ DETECT_FRAGOFFSET
Definition: detect-engine-register.h:44
sigmatch_table
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect-parse.c:127
PrefilterSetupPacketHeader
int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, void(*Set)(PrefilterPacketHeaderValue *v, void *), bool(*Compare)(PrefilterPacketHeaderValue v, void *), void(*Match)(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx))
Definition: detect-engine-prefilter-common.c:417
PacketGetFromAlloc
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Definition: decode.c:229
DetectFragOffsetData_
Definition: detect-fragoffset.h:30
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
PARSE_REGEX
#define PARSE_REGEX
Definition: detect-fragoffset.c:42
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:261
SCFree
#define SCFree(p)
Definition: util-mem.h:61
DecodeThreadVars_
Structure to hold thread specific data for all decode modules.
Definition: decode.h:685
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1283
detect-parse.h
Signature_
Signature container.
Definition: detect.h:596
SigMatch_
a single match condition for a signature
Definition: detect.h:350
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2494
Address_::family
char family
Definition: decode.h:117
Packet_::dst
Address dst
Definition: decode.h:442
FLOW_QUIET
#define FLOW_QUIET
Definition: flow.h:42
DetectFragOffsetData_::frag_off
uint16_t frag_off
Definition: detect-fragoffset.h:31
PrefilterPacketHeaderValue
Definition: detect-engine-prefilter-common.h:23
SigMatchAppendSMToList
SigMatch * SigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:447
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:841
detect-engine-prefilter-common.h
IPV4Hdr_::ip_off
uint16_t ip_off
Definition: decode-ipv4.h:77
PKT_IS_IPV4
#define PKT_IS_IPV4(p)
Definition: decode.h:246
Packet_::src
Address src
Definition: decode.h:441
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1288
SIG_FLAG_REQUIRE_PACKET
#define SIG_FLAG_REQUIRE_PACKET
Definition: detect.h:249