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 ret = 0, res = 0;
147  size_t pcre2_len;
148  int i;
149  const char *str_ptr;
150  char *mode = NULL;
151 
152  ret = DetectParsePcreExec(&parse_regex, fragoffsetstr, 0, 0);
153  if (ret < 1 || ret > 4) {
154  SCLogError("Parse error %s", fragoffsetstr);
155  goto error;
156  }
157 
158  for (i = 1; i < ret; i++) {
159  res = SC_Pcre2SubstringGet(parse_regex.match, i, (PCRE2_UCHAR8 **)&str_ptr, &pcre2_len);
160  if (res < 0) {
161  SCLogError("pcre2_substring_get_bynumber failed");
162  goto error;
163  }
164  substr[i-1] = (char *)str_ptr;
165  }
166 
167  fragoff = SCMalloc(sizeof(DetectFragOffsetData));
168  if (unlikely(fragoff == NULL))
169  goto error;
170 
171  fragoff->frag_off = 0;
172  fragoff->mode = 0;
173 
174  mode = substr[0];
175 
176  if(mode != NULL) {
177 
178  while(*mode != '\0') {
179  switch(*mode) {
180  case '>':
181  fragoff->mode = FRAG_MORE;
182  break;
183  case '<':
184  fragoff->mode = FRAG_LESS;
185  break;
186  }
187  mode++;
188  }
189  }
190 
191  if (StringParseUint16(&fragoff->frag_off, 10, 0, substr[1]) < 0) {
192  SCLogError("specified frag offset %s is not "
193  "valid",
194  substr[1]);
195  goto error;
196  }
197 
198  for (i = 0; i < 3; i++) {
199  if (substr[i] != NULL)
200  pcre2_substring_free((PCRE2_UCHAR8 *)substr[i]);
201  }
202 
203  return fragoff;
204 
205 error:
206  for (i = 0; i < 3; i++) {
207  if (substr[i] != NULL)
208  pcre2_substring_free((PCRE2_UCHAR8 *)substr[i]);
209  }
210  if (fragoff != NULL) DetectFragOffsetFree(de_ctx, fragoff);
211  return NULL;
212 
213 }
214 
215 /**
216  * \brief this function is used to add the parsed fragoffset data into the current signature
217  *
218  * \param de_ctx pointer to the Detection Engine Context
219  * \param s pointer to the Current Signature
220  * \param fragoffsetstr pointer to the user provided fragoffset option
221  *
222  * \retval 0 on Success
223  * \retval -1 on Failure
224  */
225 static int DetectFragOffsetSetup (DetectEngineCtx *de_ctx, Signature *s, const char *fragoffsetstr)
226 {
227  DetectFragOffsetData *fragoff = NULL;
228  SigMatch *sm = NULL;
229 
230  fragoff = DetectFragOffsetParse(de_ctx, fragoffsetstr);
231  if (fragoff == NULL) goto error;
232 
233  sm = SigMatchAlloc();
234  if (sm == NULL) goto error;
235 
236  sm->type = DETECT_FRAGOFFSET;
237  sm->ctx = (SigMatchCtx *)fragoff;
238 
241 
242  return 0;
243 
244 error:
245  if (fragoff != NULL) DetectFragOffsetFree(de_ctx, fragoff);
246  if (sm != NULL) SCFree(sm);
247  return -1;
248 
249 }
250 
251 /**
252  * \brief this function will free memory associated with DetectFragOffsetData
253  *
254  * \param ptr pointer to DetectFragOffsetData
255  */
257 {
258  DetectFragOffsetData *fragoff = (DetectFragOffsetData *)ptr;
259  SCFree(fragoff);
260 }
261 
262 static void
263 PrefilterPacketFragOffsetMatch(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
264 {
265  if (PKT_IS_PSEUDOPKT(p))
266  return;
267 
268  uint16_t frag;
269 
270  if (PKT_IS_IPV4(p)) {
271  frag = IPV4_GET_IPOFFSET(p);
272  } else if (PKT_IS_IPV6(p)) {
273  if (IPV6_EXTHDR_ISSET_FH(p)) {
274  frag = IPV6_EXTHDR_GET_FH_OFFSET(p);
275  } else {
276  return;
277  }
278  } else {
279  SCLogDebug("No IPv4 or IPv6 packet");
280  return;
281  }
282 
283  const PrefilterPacketHeaderCtx *ctx = pectx;
284  if (FragOffsetMatch(frag, ctx->v1.u8[0], ctx->v1.u16[1]))
285  {
286  PrefilterAddSids(&det_ctx->pmq, ctx->sigs_array, ctx->sigs_cnt);
287  }
288 }
289 
290 static void
291 PrefilterPacketFragOffsetSet(PrefilterPacketHeaderValue *v, void *smctx)
292 {
293  const DetectFragOffsetData *fb = smctx;
294  v->u8[0] = fb->mode;
295  v->u16[1] = fb->frag_off;
296 }
297 
298 static bool
299 PrefilterPacketFragOffsetCompare(PrefilterPacketHeaderValue v, void *smctx)
300 {
301  const DetectFragOffsetData *fb = smctx;
302  if (v.u8[0] == fb->mode &&
303  v.u16[1] == fb->frag_off)
304  {
305  return true;
306  }
307  return false;
308 }
309 
310 static int PrefilterSetupFragOffset(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
311 {
313  PrefilterPacketFragOffsetSet,
314  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  p->ip4h = &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
DetectParseRegex::match
pcre2_match_data * match
Definition: detect-parse.h:47
SigTableElmt_::url
const char * url
Definition: detect.h:1243
detect-engine.h
FAIL_IF_NULL
#define FAIL_IF_NULL(expr)
Fail a test if expression evaluates to NULL.
Definition: util-unittest.h:89
DetectFragOffsetRegisterTests
void DetectFragOffsetRegisterTests(void)
Definition: detect-fragoffset.c:439
SigTableElmt_::desc
const char * desc
Definition: detect.h:1242
DetectParsePcreExec
int DetectParsePcreExec(DetectParseRegex *parse_regex, const char *str, int start_offset, int options)
Definition: detect-parse.c:2477
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1230
IPV6_EXTHDR_GET_FH_OFFSET
#define IPV6_EXTHDR_GET_FH_OFFSET(p)
Definition: decode-ipv6.h:128
DetectParseRegex
Definition: detect-parse.h:44
SigTableElmt_::name
const char * name
Definition: detect.h:1240
PKT_IS_PSEUDOPKT
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Definition: decode.h:1059
PKT_IS_IPV6
#define PKT_IS_IPV6(p)
Definition: decode.h:246
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1397
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:1136
DetectFragOffsetRegister
void DetectFragOffsetRegister(void)
Registration function for fragoffset.
Definition: detect-fragoffset.c:60
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:787
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:2455
PrefilterPacketHeaderValue::u8
uint8_t u8[16]
Definition: detect-engine-prefilter-common.h:24
DE_QUIET
#define DE_QUIET
Definition: detect.h:289
SigMatchSignatures
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1809
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:2423
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1225
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:1228
FlowInitConfig
void FlowInitConfig(bool quiet)
initialize the configuration
Definition: flow.c:543
DetectFragOffsetFree
void DetectFragOffsetFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectFragOffsetData
Definition: detect-fragoffset.c:256
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:1027
DetectSetupParseRegexes
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
Definition: detect-parse.c:2598
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:57
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:319
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:79
SC_Pcre2SubstringGet
int SC_Pcre2SubstringGet(pcre2_match_data *match_data, uint32_t number, PCRE2_UCHAR **bufferptr, PCRE2_SIZE *bufflen)
Definition: detect-parse.c:2586
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:318
Signature_::flags
uint32_t flags
Definition: detect.h:543
Packet_
Definition: decode.h:428
detect-engine-build.h
detect-engine-alert.h
Packet_::ip4h
IPV4Hdr * ip4h
Definition: decode.h:531
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:613
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1208
SignatureInitData_::smlists
struct SigMatch_ ** smlists
Definition: detect.h:536
SigMatchAlloc
SigMatch * SigMatchAlloc(void)
Definition: detect-parse.c:241
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:1951
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:310
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:3166
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:3380
SigMatch_::type
uint16_t type
Definition: detect.h:316
FlowShutdown
void FlowShutdown(void)
shutdown the flow engine
Definition: flow.c:689
DETECT_FRAGOFFSET
@ DETECT_FRAGOFFSET
Definition: detect-engine-register.h:44
sigmatch_table
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect-parse.c:76
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:173
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:664
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1227
detect-parse.h
Signature_
Signature container.
Definition: detect.h:542
SigMatch_
a single match condition for a signature
Definition: detect.h:315
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2416
Address_::family
char family
Definition: decode.h:115
Packet_::dst
Address dst
Definition: decode.h:433
FLOW_QUIET
#define FLOW_QUIET
Definition: flow.h:41
DetectFragOffsetData_::frag_off
uint16_t frag_off
Definition: detect-fragoffset.h:31
PrefilterPacketHeaderValue
Definition: detect-engine-prefilter-common.h:23
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:788
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:245
SigMatchAppendSMToList
void SigMatchAppendSMToList(Signature *s, SigMatch *new, int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:356
Packet_::src
Address src
Definition: decode.h:432
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1232
SIG_FLAG_REQUIRE_PACKET
#define SIG_FLAG_REQUIRE_PACKET
Definition: detect.h:217