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 
115 
116  if (PacketIsIPv4(p)) {
117  const IPV4Hdr *ip4h = PacketGetIPv4(p);
118  frag = IPV4_GET_RAW_FRAGOFFSET(ip4h);
119  } else if (PacketIsIPv6(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 {
267 
268  uint16_t frag;
269 
270  if (PacketIsIPv4(p)) {
271  const IPV4Hdr *ip4h = PacketGetIPv4(p);
272  frag = IPV4_GET_RAW_FRAGOFFSET(ip4h);
273  } else if (PacketIsIPv6(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, PrefilterPacketFragOffsetCompare,
315  PrefilterPacketFragOffsetMatch);
316 }
317 
318 static bool PrefilterFragOffsetIsPrefilterable(const Signature *s)
319 {
320  const SigMatch *sm;
321  for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) {
322  switch (sm->type) {
323  case DETECT_FRAGOFFSET:
324  return true;
325  }
326  }
327  return false;
328 }
329 
330 #ifdef UNITTESTS
331 #include "util-unittest-helper.h"
332 #include "detect-engine.h"
333 #include "detect-engine-alert.h"
334 
335 /**
336  * \test DetectFragOffsetParseTest01 is a test for setting a valid fragoffset value
337  */
338 static int DetectFragOffsetParseTest01 (void)
339 {
340  DetectFragOffsetData *fragoff = DetectFragOffsetParse(NULL, "300");
341 
342  FAIL_IF_NULL(fragoff);
343  FAIL_IF_NOT(fragoff->frag_off == 300);
344 
345  DetectFragOffsetFree(NULL, fragoff);
346 
347  PASS;
348 }
349 
350 /**
351  * \test DetectFragOffsetParseTest02 is a test for setting a valid fragoffset value
352  * with spaces all around
353  */
354 static int DetectFragOffsetParseTest02 (void)
355 {
356  DetectFragOffsetData *fragoff = DetectFragOffsetParse(NULL, ">300");
357 
358  FAIL_IF_NULL(fragoff);
359  FAIL_IF_NOT(fragoff->frag_off == 300);
360  FAIL_IF_NOT(fragoff->mode == FRAG_MORE);
361 
362  DetectFragOffsetFree(NULL, fragoff);
363 
364  PASS;
365 }
366 
367 /**
368  * \test DetectFragOffsetParseTest03 is a test for setting an invalid fragoffset value
369  */
370 static int DetectFragOffsetParseTest03 (void)
371 {
372  DetectFragOffsetData *fragoff = DetectFragOffsetParse(NULL, "badc");
373 
374  FAIL_IF_NOT_NULL(fragoff);
375 
376  PASS;
377 }
378 
379 /**
380  * \test DetectFragOffsetMatchTest01 is a test for checking the working of
381  * fragoffset keyword by creating 2 rules and matching a crafted packet
382  * against them. Only the first one shall trigger.
383  */
384 static int DetectFragOffsetMatchTest01 (void)
385 {
386  Packet *p = PacketGetFromAlloc();
387 
388  FAIL_IF_NULL(p);
389  Signature *s = NULL;
391  ThreadVars th_v;
392  DetectEngineThreadCtx *det_ctx = NULL;
393  IPV4Hdr ip4h;
394 
395  memset(&ip4h, 0, sizeof(IPV4Hdr));
396  memset(&dtv, 0, sizeof(DecodeThreadVars));
397  memset(&th_v, 0, sizeof(ThreadVars));
398 
400 
401  p->src.family = AF_INET;
402  p->dst.family = AF_INET;
403  p->src.addr_data32[0] = 0x01020304;
404  p->dst.addr_data32[0] = 0x04030201;
405 
406  ip4h.s_ip_src.s_addr = p->src.addr_data32[0];
407  ip4h.s_ip_dst.s_addr = p->dst.addr_data32[0];
408  ip4h.ip_off = 0x2222;
409  UTHSetIPV4Hdr(p, &ip4h);
410 
413 
414  de_ctx->flags |= DE_QUIET;
415 
416  s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any (fragoffset:546; sid:1;)");
417  FAIL_IF_NULL(s);
418 
419  s = DetectEngineAppendSig(de_ctx, "alert ip any any -> any any (fragoffset:5000; sid:2;)");
420  FAIL_IF_NULL(s);
421 
423  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
424 
425  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
426 
427  FAIL_IF(PacketAlertCheck(p, 1) == 0);
428  FAIL_IF(PacketAlertCheck(p, 2));
429 
430  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
432 
433  FlowShutdown();
434 
435  SCFree(p);
436  PASS;
437 }
438 
440 {
441  UtRegisterTest("DetectFragOffsetParseTest01", DetectFragOffsetParseTest01);
442  UtRegisterTest("DetectFragOffsetParseTest02", DetectFragOffsetParseTest02);
443  UtRegisterTest("DetectFragOffsetParseTest03", DetectFragOffsetParseTest03);
444  UtRegisterTest("DetectFragOffsetMatchTest01", DetectFragOffsetMatchTest01);
445 }
446 #endif /* UNITTESTS */
util-byte.h
SigTableElmt_::url
const char * url
Definition: detect.h:1304
detect-engine.h
FAIL_IF_NULL
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
Definition: util-unittest.h:89
SIG_MASK_REQUIRE_REAL_PKT
#define SIG_MASK_REQUIRE_REAL_PKT
Definition: detect.h:306
SignatureInitData_::smlists
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
Definition: detect.h:586
DetectFragOffsetRegisterTests
void DetectFragOffsetRegisterTests(void)
Definition: detect-fragoffset.c:439
SigTableElmt_::desc
const char * desc
Definition: detect.h:1303
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:127
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1291
IPV6_EXTHDR_GET_FH_OFFSET
#define IPV6_EXTHDR_GET_FH_OFFSET(p)
Definition: decode-ipv6.h:101
DetectParseRegex
Definition: detect-parse.h:62
SigTableElmt_::name
const char * name
Definition: detect.h:1301
PKT_IS_PSEUDOPKT
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Definition: decode.h:1326
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1457
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:174
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:1197
UTHSetIPV4Hdr
void UTHSetIPV4Hdr(Packet *p, IPV4Hdr *ip4h)
Definition: util-unittest-helper.c:126
DetectFragOffsetRegister
void DetectFragOffsetRegister(void)
Registration function for fragoffset.
Definition: detect-fragoffset.c:60
ctx
struct Thresholds ctx
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:841
StringParseUint16
int StringParseUint16(uint16_t *res, int base, size_t len, const char *str)
Definition: util-byte.c:337
FRAG_MORE
#define FRAG_MORE
Definition: detect-fragoffset.h:28
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2597
PrefilterPacketHeaderValue::u8
uint8_t u8[16]
Definition: detect-engine-prefilter-common.h:24
DE_QUIET
#define DE_QUIET
Definition: detect.h:323
SigMatchSignatures
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1926
DetectParsePcreExec
int DetectParsePcreExec(DetectParseRegex *parse_regex, pcre2_match_data **match, const char *str, int start_offset, int options)
Definition: detect-parse.c:2641
DetectEngineAppendSig
Signature * DetectEngineAppendSig(DetectEngineCtx *, const char *)
Parse and append a Signature into the Detection Engine Context signature list.
Definition: detect-parse.c:2587
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1286
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:1289
FlowInitConfig
void FlowInitConfig(bool quiet)
initialize the configuration
Definition: flow.c:530
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:1090
IPV4_GET_RAW_FRAGOFFSET
#define IPV4_GET_RAW_FRAGOFFSET(ip4h)
Definition: decode-ipv4.h:101
DetectSetupParseRegexes
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
Definition: detect-parse.c:2767
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:353
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:2755
Signature_::flags
uint32_t flags
Definition: detect.h:602
Packet_
Definition: decode.h:479
detect-engine-build.h
detect-engine-alert.h
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:670
PrefilterSetupPacketHeader
int PrefilterSetupPacketHeader(DetectEngineCtx *de_ctx, SigGroupHead *sgh, int sm_type, SignatureMask mask, 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:404
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1269
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:2161
dtv
DecodeThreadVars * dtv
Definition: fuzz_decodepcapfile.c:33
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:344
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:3312
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:3539
SigMatch_::type
uint16_t type
Definition: detect.h:350
FlowShutdown
void FlowShutdown(void)
shutdown the flow engine
Definition: flow.c:677
DETECT_FRAGOFFSET
@ DETECT_FRAGOFFSET
Definition: detect-engine-register.h:44
PacketGetFromAlloc
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Definition: decode.c:232
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:938
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1288
detect-parse.h
Signature_
Signature container.
Definition: detect.h:601
SigMatch_
a single match condition for a signature
Definition: detect.h:349
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2558
Address_::family
char family
Definition: decode.h:115
Packet_::dst
Address dst
Definition: decode.h:484
FLOW_QUIET
#define FLOW_QUIET
Definition: flow.h:43
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:436
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:843
detect-engine-prefilter-common.h
IPV4Hdr_::ip_off
uint16_t ip_off
Definition: decode-ipv4.h:77
DEBUG_VALIDATE_BUG_ON
#define DEBUG_VALIDATE_BUG_ON(exp)
Definition: util-validate.h:102
Packet_::src
Address src
Definition: decode.h:483
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1293
SIG_FLAG_REQUIRE_PACKET
#define SIG_FLAG_REQUIRE_PACKET
Definition: detect.h:250