suricata
detect-icmp-seq.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2020 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 the icmp_seq keyword
24  */
25 
26 #include "suricata-common.h"
27 #include "debug.h"
28 #include "decode.h"
29 
30 #include "detect.h"
31 #include "detect-parse.h"
33 
34 #include "detect-icmp-seq.h"
35 
36 #include "util-byte.h"
37 #include "util-unittest.h"
38 #include "util-unittest-helper.h"
39 #include "util-debug.h"
40 
41 #define PARSE_REGEX "^\\s*(\"\\s*)?([0-9]+)(\\s*\")?\\s*$"
42 
43 static DetectParseRegex parse_regex;
44 
45 static int DetectIcmpSeqMatch(DetectEngineThreadCtx *, Packet *,
46  const Signature *, const SigMatchCtx *);
47 static int DetectIcmpSeqSetup(DetectEngineCtx *, Signature *, const char *);
48 #ifdef UNITTESTS
49 static void DetectIcmpSeqRegisterTests(void);
50 #endif
51 void DetectIcmpSeqFree(DetectEngineCtx *, void *);
52 static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
53 static bool PrefilterIcmpSeqIsPrefilterable(const Signature *s);
54 
55 /**
56  * \brief Registration function for icmp_seq
57  */
59 {
60  sigmatch_table[DETECT_ICMP_SEQ].name = "icmp_seq";
61  sigmatch_table[DETECT_ICMP_SEQ].desc = "check for a ICMP sequence number";
62  sigmatch_table[DETECT_ICMP_SEQ].url = "/rules/header-keywords.html#icmp-seq";
63  sigmatch_table[DETECT_ICMP_SEQ].Match = DetectIcmpSeqMatch;
64  sigmatch_table[DETECT_ICMP_SEQ].Setup = DetectIcmpSeqSetup;
66 #ifdef UNITTESTS
67  sigmatch_table[DETECT_ICMP_SEQ].RegisterTests = DetectIcmpSeqRegisterTests;
68 #endif
69  sigmatch_table[DETECT_ICMP_SEQ].SupportsPrefilter = PrefilterIcmpSeqIsPrefilterable;
70  sigmatch_table[DETECT_ICMP_SEQ].SetupPrefilter = PrefilterSetupIcmpSeq;
71 
72  DetectSetupParseRegexes(PARSE_REGEX, &parse_regex);
73 }
74 
75 static inline bool GetIcmpSeq(Packet *p, uint16_t *seq)
76 {
77  uint16_t seqn;
78 
79  if (PKT_IS_PSEUDOPKT(p))
80  return FALSE;
81 
82  if (PKT_IS_ICMPV4(p)) {
83  switch (ICMPV4_GET_TYPE(p)){
84  case ICMP_ECHOREPLY:
85  case ICMP_ECHO:
86  case ICMP_TIMESTAMP:
87  case ICMP_TIMESTAMPREPLY:
88  case ICMP_INFO_REQUEST:
89  case ICMP_INFO_REPLY:
90  case ICMP_ADDRESS:
91  case ICMP_ADDRESSREPLY:
92  SCLogDebug("ICMPV4_GET_SEQ(p) %"PRIu16" (network byte order), "
93  "%"PRIu16" (host byte order)", ICMPV4_GET_SEQ(p),
95 
96  seqn = ICMPV4_GET_SEQ(p);
97  break;
98  default:
99  SCLogDebug("Packet has no seq field");
100  return FALSE;
101  }
102  } else if (PKT_IS_ICMPV6(p)) {
103 
104  switch (ICMPV6_GET_TYPE(p)) {
105  case ICMP6_ECHO_REQUEST:
106  case ICMP6_ECHO_REPLY:
107  SCLogDebug("ICMPV6_GET_SEQ(p) %"PRIu16" (network byte order), "
108  "%"PRIu16" (host byte order)", ICMPV6_GET_SEQ(p),
109  SCNtohs(ICMPV6_GET_SEQ(p)));
110 
111  seqn = ICMPV6_GET_SEQ(p);
112  break;
113  default:
114  SCLogDebug("Packet has no seq field");
115  return FALSE;
116  }
117  } else {
118  SCLogDebug("Packet not ICMPV4 nor ICMPV6");
119  return FALSE;
120  }
121 
122  *seq = seqn;
123  return TRUE;
124 }
125 
126 /**
127  * \brief This function is used to match icmp_seq rule option set on a packet
128  *
129  * \param t pointer to thread vars
130  * \param det_ctx pointer to the pattern matcher thread
131  * \param p pointer to the current packet
132  * \param m pointer to the sigmatch that we will cast into DetectIcmpSeqData
133  *
134  * \retval 0 no match
135  * \retval 1 match
136  */
137 static int DetectIcmpSeqMatch (DetectEngineThreadCtx *det_ctx, Packet *p,
138  const Signature *s, const SigMatchCtx *ctx)
139 {
140  uint16_t seqn;
141 
142  if (GetIcmpSeq(p, &seqn) == FALSE)
143  return 0;
144 
145  const DetectIcmpSeqData *iseq = (const DetectIcmpSeqData *)ctx;
146  if (seqn == iseq->seq)
147  return 1;
148 
149  return 0;
150 }
151 
152 /**
153  * \brief This function is used to parse icmp_seq option passed via icmp_seq: keyword
154  *
155  * \param de_ctx Pointer to the detection engine context
156  * \param icmpseqstr Pointer to the user provided icmp_seq options
157  *
158  * \retval iseq pointer to DetectIcmpSeqData on success
159  * \retval NULL on failure
160  */
161 static DetectIcmpSeqData *DetectIcmpSeqParse (DetectEngineCtx *de_ctx, const char *icmpseqstr)
162 {
163  DetectIcmpSeqData *iseq = NULL;
164  char *substr[3] = {NULL, NULL, NULL};
165  int ret = 0, res = 0;
166  int ov[MAX_SUBSTRINGS];
167  int i;
168  const char *str_ptr;
169 
170  ret = DetectParsePcreExec(&parse_regex, icmpseqstr, 0, 0, ov, MAX_SUBSTRINGS);
171  if (ret < 1 || ret > 4) {
172  SCLogError(SC_ERR_PCRE_MATCH,"Parse error %s", icmpseqstr);
173  goto error;
174  }
175 
176  for (i = 1; i < ret; i++) {
177  res = pcre_get_substring((char *)icmpseqstr, ov, MAX_SUBSTRINGS, i, &str_ptr);
178  if (res < 0) {
179  SCLogError(SC_ERR_PCRE_GET_SUBSTRING,"pcre_get_substring failed");
180  goto error;
181  }
182  substr[i-1] = (char *)str_ptr;
183  }
184 
185  iseq = SCMalloc(sizeof(DetectIcmpSeqData));
186  if (unlikely(iseq == NULL))
187  goto error;
188 
189  iseq->seq = 0;
190 
191  if (substr[0] != NULL && strlen(substr[0]) != 0) {
192  if (substr[2] == NULL) {
193  SCLogError(SC_ERR_MISSING_QUOTE,"Missing quote in input");
194  goto error;
195  }
196  } else {
197  if (substr[2] != NULL) {
198  SCLogError(SC_ERR_MISSING_QUOTE,"Missing quote in input");
199  goto error;
200  }
201  }
202 
203  uint16_t seq = 0;
204  if (StringParseUint16(&seq, 10, 0, substr[1]) < 0) {
205  SCLogError(SC_ERR_INVALID_ARGUMENT, "specified icmp seq %s is not "
206  "valid", substr[1]);
207  goto error;
208  }
209  iseq->seq = htons(seq);
210 
211  for (i = 0; i < 3; i++) {
212  if (substr[i] != NULL) SCFree(substr[i]);
213  }
214 
215  return iseq;
216 
217 error:
218  for (i = 0; i < 3; i++) {
219  if (substr[i] != NULL) SCFree(substr[i]);
220  }
221  if (iseq != NULL) DetectIcmpSeqFree(de_ctx, iseq);
222  return NULL;
223 
224 }
225 
226 /**
227  * \brief this function is used to add the parsed icmp_seq data into the current signature
228  *
229  * \param de_ctx pointer to the Detection Engine Context
230  * \param s pointer to the Current Signature
231  * \param icmpseqstr pointer to the user provided icmp_seq option
232  *
233  * \retval 0 on Success
234  * \retval -1 on Failure
235  */
236 static int DetectIcmpSeqSetup (DetectEngineCtx *de_ctx, Signature *s, const char *icmpseqstr)
237 {
238  DetectIcmpSeqData *iseq = NULL;
239  SigMatch *sm = NULL;
240 
241  iseq = DetectIcmpSeqParse(de_ctx, icmpseqstr);
242  if (iseq == NULL) goto error;
243 
244  sm = SigMatchAlloc();
245  if (sm == NULL) goto error;
246 
247  sm->type = DETECT_ICMP_SEQ;
248  sm->ctx = (SigMatchCtx *)iseq;
249 
251 
252  return 0;
253 
254 error:
255  if (iseq != NULL) DetectIcmpSeqFree(de_ctx, iseq);
256  if (sm != NULL) SCFree(sm);
257  return -1;
258 
259 }
260 
261 /**
262  * \brief this function will free memory associated with DetectIcmpSeqData
263  *
264  * \param ptr pointer to DetectIcmpSeqData
265  */
267 {
268  DetectIcmpSeqData *iseq = (DetectIcmpSeqData *)ptr;
269  SCFree(iseq);
270 }
271 
272 /* prefilter code */
273 
274 static void
275 PrefilterPacketIcmpSeqMatch(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
276 {
277  const PrefilterPacketHeaderCtx *ctx = pectx;
278 
279  uint16_t seqn;
280 
281  if (GetIcmpSeq(p, &seqn) == FALSE)
282  return;
283 
284  if (seqn == ctx->v1.u16[0])
285  {
286  SCLogDebug("packet matches ICMP SEQ %u", ctx->v1.u16[0]);
287  PrefilterAddSids(&det_ctx->pmq, ctx->sigs_array, ctx->sigs_cnt);
288  }
289 }
290 
291 static void
292 PrefilterPacketIcmpSeqSet(PrefilterPacketHeaderValue *v, void *smctx)
293 {
294  const DetectIcmpSeqData *a = smctx;
295  v->u16[0] = a->seq;
296 }
297 
298 static bool
299 PrefilterPacketIcmpSeqCompare(PrefilterPacketHeaderValue v, void *smctx)
300 {
301  const DetectIcmpSeqData *a = smctx;
302  if (v.u16[0] == a->seq)
303  return TRUE;
304  return FALSE;
305 }
306 
307 static int PrefilterSetupIcmpSeq(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
308 {
310  PrefilterPacketIcmpSeqSet,
311  PrefilterPacketIcmpSeqCompare,
312  PrefilterPacketIcmpSeqMatch);
313 }
314 
315 static bool PrefilterIcmpSeqIsPrefilterable(const Signature *s)
316 {
317  const SigMatch *sm;
318  for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) {
319  switch (sm->type) {
320  case DETECT_ICMP_SEQ:
321  return TRUE;
322  }
323  }
324  return FALSE;
325 }
326 
327 #ifdef UNITTESTS
328 #include "detect-engine.h"
329 #include "detect-engine-mpm.h"
330 
331 /**
332  * \test DetectIcmpSeqParseTest01 is a test for setting a valid icmp_seq value
333  */
334 static int DetectIcmpSeqParseTest01 (void)
335 {
336  DetectIcmpSeqData *iseq = NULL;
337  iseq = DetectIcmpSeqParse(NULL, "300");
338  if (iseq != NULL && htons(iseq->seq) == 300) {
339  DetectIcmpSeqFree(NULL, iseq);
340  return 1;
341  }
342  return 0;
343 }
344 
345 /**
346  * \test DetectIcmpSeqParseTest02 is a test for setting a valid icmp_seq value
347  * with spaces all around
348  */
349 static int DetectIcmpSeqParseTest02 (void)
350 {
351  DetectIcmpSeqData *iseq = NULL;
352  iseq = DetectIcmpSeqParse(NULL, " 300 ");
353  if (iseq != NULL && htons(iseq->seq) == 300) {
354  DetectIcmpSeqFree(NULL, iseq);
355  return 1;
356  }
357  return 0;
358 }
359 
360 /**
361  * \test DetectIcmpSeqParseTest03 is a test for setting an invalid icmp_seq value
362  */
363 static int DetectIcmpSeqParseTest03 (void)
364 {
365  DetectIcmpSeqData *iseq = NULL;
366  iseq = DetectIcmpSeqParse(NULL, "badc");
367  if (iseq != NULL) {
368  DetectIcmpSeqFree(NULL, iseq);
369  return 0;
370  }
371  return 1;
372 }
373 
374 /**
375  * \test DetectIcmpSeqMatchTest01 is a test for checking the working of
376  * icmp_seq keyword by creating 2 rules and matching a crafted packet
377  * against them. Only the first one shall trigger.
378  */
379 static int DetectIcmpSeqMatchTest01 (void)
380 {
381  int result = 0;
382  Packet *p = NULL;
383  Signature *s = NULL;
384  ThreadVars th_v;
385  DetectEngineThreadCtx *det_ctx = NULL;
386 
387  memset(&th_v, 0, sizeof(th_v));
388 
389  p = UTHBuildPacket(NULL, 0, IPPROTO_ICMP);
390  p->icmpv4vars.seq = htons(2216);
391 
393  if (de_ctx == NULL) {
394  goto end;
395  }
396 
397  de_ctx->flags |= DE_QUIET;
398 
399  s = de_ctx->sig_list = SigInit(de_ctx, "alert icmp any any -> any any (icmp_seq:2216; sid:1;)");
400  if (s == NULL) {
401  goto end;
402  }
403 
404  s = s->next = SigInit(de_ctx, "alert icmp any any -> any any (icmp_seq:5000; sid:2;)");
405  if (s == NULL) {
406  goto end;
407  }
408 
410  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
411 
412  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
413  if (PacketAlertCheck(p, 1) == 0) {
414  printf("sid 1 did not alert, but should have: ");
415  goto cleanup;
416  } else if (PacketAlertCheck(p, 2)) {
417  printf("sid 2 alerted, but should not have: ");
418  goto cleanup;
419  }
420 
421  result = 1;
422 
423 cleanup:
426 
427  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
429 
430  UTHFreePackets(&p, 1);
431 end:
432  return result;
433 }
434 
435 static void DetectIcmpSeqRegisterTests (void)
436 {
437  UtRegisterTest("DetectIcmpSeqParseTest01", DetectIcmpSeqParseTest01);
438  UtRegisterTest("DetectIcmpSeqParseTest02", DetectIcmpSeqParseTest02);
439  UtRegisterTest("DetectIcmpSeqParseTest03", DetectIcmpSeqParseTest03);
440  UtRegisterTest("DetectIcmpSeqMatchTest01", DetectIcmpSeqMatchTest01);
441 }
442 #endif /* UNITTESTS */
util-byte.h
SigTableElmt_::url
const char * url
Definition: detect.h:1214
detect-engine.h
StringParseUint16
int StringParseUint16(uint16_t *res, int base, uint16_t len, const char *str)
Definition: util-byte.c:336
SigTableElmt_::desc
const char * desc
Definition: detect.h:1213
PARSE_REGEX
#define PARSE_REGEX
Definition: detect-icmp-seq.c:41
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1201
SigTableElmt_::name
const char * name
Definition: detect.h:1211
PKT_IS_PSEUDOPKT
#define PKT_IS_PSEUDOPKT(p)
return 1 if the packet is a pseudo packet
Definition: decode.h:1147
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1347
MAX_SUBSTRINGS
#define MAX_SUBSTRINGS
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:298
seq
uint32_t seq
Definition: stream-tcp-private.h:2
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:138
SigInit
Signature * SigInit(DetectEngineCtx *, const char *)
Parses a signature and adds it to the Detection Engine Context.
Definition: detect-parse.c:2056
ICMPV6_GET_SEQ
#define ICMPV6_GET_SEQ(p)
Definition: decode-icmpv6.h:113
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1111
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:767
PrefilterPacketHeaderCtx_::sigs_array
SigIntId * sigs_array
Definition: detect-engine-prefilter-common.h:41
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2093
DE_QUIET
#define DE_QUIET
Definition: detect.h:294
UTHBuildPacket
Packet * UTHBuildPacket(uint8_t *payload, uint16_t payload_len, uint8_t ipproto)
UTHBuildPacket is a wrapper that build packets with default ip and port fields.
Definition: util-unittest-helper.c:337
PrefilterPacketHeaderCtx_::sigs_cnt
uint32_t sigs_cnt
Definition: detect-engine-prefilter-common.h:40
SC_ERR_PCRE_GET_SUBSTRING
@ SC_ERR_PCRE_GET_SUBSTRING
Definition: util-error.h:34
SigCleanSignatures
void SigCleanSignatures(DetectEngineCtx *de_ctx)
Definition: detect-engine-build.c:39
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1196
PrefilterPacketHeaderValue::u16
uint16_t u16[8]
Definition: detect-engine-prefilter-common.h:23
util-unittest.h
util-unittest-helper.h
ICMP6_ECHO_REQUEST
#define ICMP6_ECHO_REQUEST
Definition: decode-icmpv6.h:43
ICMPV4_GET_SEQ
#define ICMPV4_GET_SEQ(p)
Definition: decode-icmpv4.h:227
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1199
Signature_::next
struct Signature_ * next
Definition: detect.h:600
PrefilterPacketHeaderCtx_
Definition: detect-engine-prefilter-common.h:33
decode.h
util-debug.h
SC_ERR_PCRE_MATCH
@ SC_ERR_PCRE_MATCH
Definition: util-error.h:32
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:17
ICMP6_ECHO_REPLY
#define ICMP6_ECHO_REPLY
Definition: decode-icmpv6.h:44
DetectEngineThreadCtx_
Definition: detect.h:1010
ICMPV4_GET_TYPE
#define ICMPV4_GET_TYPE(p)
Definition: decode-icmpv4.h:215
res
PoolThreadReserved res
Definition: stream-tcp-private.h:0
DetectSetupParseRegexes
void DetectSetupParseRegexes(const char *parse_str, DetectParseRegex *detect_parse)
Definition: detect-parse.c:2493
detect-engine-mpm.h
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:324
DetectIcmpSeqRegister
void DetectIcmpSeqRegister(void)
Registration function for icmp_seq.
Definition: detect-icmp-seq.c:58
DetectIcmpSeqData_
Definition: detect-icmp-seq.h:27
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:89
SC_ERR_INVALID_ARGUMENT
@ SC_ERR_INVALID_ARGUMENT
Definition: util-error.h:43
TRUE
#define TRUE
Definition: suricata-common.h:33
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:323
PKT_IS_ICMPV6
#define PKT_IS_ICMPV6(p)
Definition: decode.h:262
SigMatchSignatures
void SigMatchSignatures(ThreadVars *th_v, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:1688
SigGroupCleanup
int SigGroupCleanup(DetectEngineCtx *de_ctx)
Definition: detect-engine-build.c:1953
FALSE
#define FALSE
Definition: suricata-common.h:34
DetectParsePcreExec
int DetectParsePcreExec(DetectParseRegex *parse_regex, const char *str, int start_offset, int options, int *ovector, int ovector_size)
Definition: detect-parse.c:2423
Packet_
Definition: decode.h:414
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:597
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1179
SignatureInitData_::smlists
struct SigMatch_ ** smlists
Definition: detect.h:522
SigMatchAlloc
SigMatch * SigMatchAlloc(void)
Definition: detect-parse.c:235
SigGroupBuild
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
Definition: detect-engine-build.c:1888
SigMatch_::type
uint8_t type
Definition: detect.h:321
PrefilterPacketHeaderCtx_::v1
PrefilterPacketHeaderValue v1
Definition: detect-engine-prefilter-common.h:34
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:315
DetectIcmpSeqData_::seq
uint16_t seq
Definition: detect-icmp-seq.h:28
Packet_::icmpv4vars
ICMPV4Vars icmpv4vars
Definition: decode.h:524
DetectEngineThreadCtxInit
TmEcode DetectEngineThreadCtxInit(ThreadVars *, void *, void **)
initialize thread specific detection engine context
Definition: detect-engine.c:2797
SCNtohs
#define SCNtohs(x)
Definition: suricata-common.h:398
suricata-common.h
DetectEngineThreadCtxDeinit
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
Definition: detect-engine.c:3005
DETECT_ICMP_SEQ
@ DETECT_ICMP_SEQ
Definition: detect-engine-register.h:48
sigmatch_table
SigTableElmt sigmatch_table[DETECT_TBLSIZE]
Definition: detect-parse.c:73
DetectParseRegex_
Definition: detect-parse.h:42
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:257
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:773
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:407
PKT_IS_ICMPV4
#define PKT_IS_ICMPV4(p)
Definition: decode.h:261
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
SCFree
#define SCFree(p)
Definition: util-mem.h:61
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1198
detect-parse.h
Signature_
Signature container.
Definition: detect.h:528
SigMatch_
a single match condition for a signature
Definition: detect.h:320
ICMPV6_GET_TYPE
#define ICMPV6_GET_TYPE(p)
Definition: decode-icmpv6.h:102
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2048
PrefilterPacketHeaderValue
Definition: detect-engine-prefilter-common.h:21
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:768
detect-engine-prefilter-common.h
ICMPV4Vars_::seq
uint16_t seq
Definition: decode-icmpv4.h:187
SC_ERR_MISSING_QUOTE
@ SC_ERR_MISSING_QUOTE
Definition: util-error.h:150
SigMatchAppendSMToList
void SigMatchAppendSMToList(Signature *s, SigMatch *new, int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:349
debug.h
DetectIcmpSeqFree
void DetectIcmpSeqFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectIcmpSeqData
Definition: detect-icmp-seq.c:266
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1203
detect-icmp-seq.h
UTHFreePackets
void UTHFreePackets(Packet **p, int numpkts)
UTHFreePackets: function to release the allocated data from UTHBuildPacket and the packet itself.
Definition: util-unittest-helper.c:468