suricata
detect-icmp-id.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 Gerardo Iglesias Galvan <iglesiasg@gmail.com>
22  *
23  * Implements the icmp_id keyword
24  */
25 
26 #include "suricata-common.h"
27 #include "decode.h"
28 
29 #include "detect.h"
30 #include "detect-parse.h"
32 #include "detect-engine-build.h"
33 #include "detect-engine-alert.h"
34 #include "detect-engine-uint.h"
35 
36 #include "detect-icmp-id.h"
37 
38 #include "util-byte.h"
39 #include "util-unittest.h"
40 #include "util-unittest-helper.h"
41 #include "util-debug.h"
42 
43 static int DetectIcmpIdMatch(DetectEngineThreadCtx *, Packet *,
44  const Signature *, const SigMatchCtx *);
45 static int DetectIcmpIdSetup(DetectEngineCtx *, Signature *, const char *);
46 #ifdef UNITTESTS
47 static void DetectIcmpIdRegisterTests(void);
48 #endif
49 void DetectIcmpIdFree(DetectEngineCtx *, void *);
50 static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh);
51 static bool PrefilterIcmpIdIsPrefilterable(const Signature *s);
52 
53 /**
54  * \brief Registration function for icode: icmp_id
55  */
57 {
58  sigmatch_table[DETECT_ICMP_ID].name = "icmp_id";
59  sigmatch_table[DETECT_ICMP_ID].desc = "check for a ICMP ID";
60  sigmatch_table[DETECT_ICMP_ID].url = "/rules/header-keywords.html#icmp-id";
61  sigmatch_table[DETECT_ICMP_ID].Match = DetectIcmpIdMatch;
62  sigmatch_table[DETECT_ICMP_ID].Setup = DetectIcmpIdSetup;
65 #ifdef UNITTESTS
66  sigmatch_table[DETECT_ICMP_ID].RegisterTests = DetectIcmpIdRegisterTests;
67 #endif
68  sigmatch_table[DETECT_ICMP_ID].SupportsPrefilter = PrefilterIcmpIdIsPrefilterable;
69  sigmatch_table[DETECT_ICMP_ID].SetupPrefilter = PrefilterSetupIcmpId;
70 }
71 
72 static inline bool GetIcmpId(Packet *p, uint16_t *id)
73 {
74  uint16_t pid;
75  if (PacketIsICMPv4(p)) {
76  switch (p->icmp_s.type) {
77  case ICMP_ECHOREPLY:
78  case ICMP_ECHO:
79  case ICMP_TIMESTAMP:
81  case ICMP_INFO_REQUEST:
82  case ICMP_INFO_REPLY:
83  case ICMP_ADDRESS:
84  case ICMP_ADDRESSREPLY:
85  SCLogDebug("ICMPV4_GET_ID(p) %"PRIu16" (network byte order), "
86  "%"PRIu16" (host byte order)", ICMPV4_GET_ID(p),
88 
89  pid = ICMPV4_GET_ID(p);
90  break;
91  default:
92  SCLogDebug("Packet has no id field");
93  return false;
94  }
95  } else if (PacketIsICMPv6(p)) {
96  switch (ICMPV6_GET_TYPE(PacketGetICMPv6(p))) {
97  case ICMP6_ECHO_REQUEST:
98  case ICMP6_ECHO_REPLY:
99  SCLogDebug("ICMPV6_GET_ID(p) %"PRIu16" (network byte order), "
100  "%"PRIu16" (host byte order)", ICMPV6_GET_ID(p),
101  SCNtohs(ICMPV6_GET_ID(p)));
102 
103  pid = ICMPV6_GET_ID(p);
104  break;
105  default:
106  SCLogDebug("Packet has no id field");
107  return false;
108  }
109  } else {
110  SCLogDebug("Packet not ICMPV4 nor ICMPV6");
111  return false;
112  }
113 
114  *id = SCNtohs(pid);
115  return true;
116 }
117 
118 /**
119  * \brief This function is used to match icmp_id rule option set on a packet
120  *
121  * \param t pointer to thread vars
122  * \param det_ctx pointer to the pattern matcher thread
123  * \param p pointer to the current packet
124  * \param m pointer to the sigmatch that we will cast into DetectIcmpIdData
125  *
126  * \retval 0 no match
127  * \retval 1 match
128  */
129 static int DetectIcmpIdMatch (DetectEngineThreadCtx *det_ctx, Packet *p,
130  const Signature *s, const SigMatchCtx *ctx)
131 {
132  uint16_t pid;
133 
134  if (!GetIcmpId(p, &pid))
135  return 0;
136 
137  const DetectU16Data *iid = (const DetectU16Data *)ctx;
138  return DetectU16Match(pid, iid);
139 }
140 
141 /**
142  * \brief this function is used to add the parsed icmp_id data into the current signature
143  *
144  * \param de_ctx pointer to the Detection Engine Context
145  * \param s pointer to the Current Signature
146  * \param icmpidstr pointer to the user provided icmp_id option
147  *
148  * \retval 0 on Success
149  * \retval -1 on Failure
150  */
151 static int DetectIcmpIdSetup (DetectEngineCtx *de_ctx, Signature *s, const char *icmpidstr)
152 {
153  DetectU16Data *iid = SCDetectU16UnquoteParse(icmpidstr);
154  if (iid == NULL)
155  return -1;
156 
158  de_ctx, s, DETECT_ICMP_ID, (SigMatchCtx *)iid, DETECT_SM_LIST_MATCH) == NULL) {
159  goto error;
160  }
162 
163  return 0;
164 
165 error:
166  DetectIcmpIdFree(de_ctx, iid);
167  return -1;
168 
169 }
170 
171 /**
172  * \brief this function will free memory associated with DetectIcmpIdData
173  *
174  * \param ptr pointer to DetectIcmpIdData
175  */
177 {
178  SCDetectU16Free(ptr);
179 }
180 
181 /* prefilter code */
182 
183 static void
184 PrefilterPacketIcmpIdMatch(DetectEngineThreadCtx *det_ctx, Packet *p, const void *pectx)
185 {
186  const PrefilterPacketHeaderCtx *ctx = pectx;
187 
188  uint16_t pid;
189  if (!GetIcmpId(p, &pid))
190  return;
191 
192  DetectU16Data du16;
193  du16.mode = ctx->v1.u8[0];
194  du16.arg1 = ctx->v1.u16[1];
195  du16.arg2 = ctx->v1.u16[2];
196  if (DetectU16Match(pid, &du16)) {
197  SCLogDebug("packet matches ICMP ID %u", ctx->v1.u16[0]);
198  PrefilterAddSids(&det_ctx->pmq, ctx->sigs_array, ctx->sigs_cnt);
199  }
200 }
201 
202 static int PrefilterSetupIcmpId(DetectEngineCtx *de_ctx, SigGroupHead *sgh)
203 {
205  PrefilterPacketU16Set, PrefilterPacketU16Compare, PrefilterPacketIcmpIdMatch);
206 }
207 
208 static bool PrefilterIcmpIdIsPrefilterable(const Signature *s)
209 {
210  return PrefilterIsPrefilterableById(s, DETECT_ICMP_ID);
211 }
212 
213 #ifdef UNITTESTS
214 #include "detect-engine.h"
215 #include "detect-engine-mpm.h"
216 
217 /**
218  * \test DetectIcmpIdParseTest01 is a test for setting a valid icmp_id value
219  */
220 static int DetectIcmpIdParseTest01 (void)
221 {
222  DetectU16Data *iid = SCDetectU16UnquoteParse("300");
223  FAIL_IF_NULL(iid);
224  FAIL_IF_NOT(iid->arg1 == 300);
225  DetectIcmpIdFree(NULL, iid);
226  PASS;
227 }
228 
229 /**
230  * \test DetectIcmpIdParseTest02 is a test for setting a valid icmp_id value
231  * with spaces all around
232  */
233 static int DetectIcmpIdParseTest02 (void)
234 {
235  DetectU16Data *iid = SCDetectU16UnquoteParse(" 300 ");
236  FAIL_IF_NULL(iid);
237  FAIL_IF_NOT(iid->arg1 == 300);
238  DetectIcmpIdFree(NULL, iid);
239  PASS;
240 }
241 
242 /**
243  * \test DetectIcmpIdParseTest03 is a test for setting a valid icmp_id value
244  * with quotation marks
245  */
246 static int DetectIcmpIdParseTest03 (void)
247 {
248  DetectU16Data *iid = SCDetectU16UnquoteParse("\"300\"");
249  FAIL_IF_NULL(iid);
250  FAIL_IF_NOT(iid->arg1 == 300);
251  DetectIcmpIdFree(NULL, iid);
252  PASS;
253 }
254 
255 /**
256  * \test DetectIcmpIdParseTest04 is a test for setting a valid icmp_id value
257  * with quotation marks and spaces all around
258  */
259 static int DetectIcmpIdParseTest04 (void)
260 {
261  DetectU16Data *iid = SCDetectU16UnquoteParse(" \" 300 \"");
262  FAIL_IF_NULL(iid);
263  FAIL_IF_NOT(iid->arg1 == 300);
264  DetectIcmpIdFree(NULL, iid);
265  PASS;
266 }
267 
268 /**
269  * \test DetectIcmpIdParseTest05 is a test for setting an invalid icmp_id
270  * value with missing quotation marks
271  */
272 static int DetectIcmpIdParseTest05 (void)
273 {
274  DetectU16Data *iid = SCDetectU16UnquoteParse("\"300");
275  FAIL_IF_NOT_NULL(iid);
276  PASS;
277 }
278 
279 /**
280  * \test DetectIcmpIdMatchTest01 is a test for checking the working of
281  * icmp_id keyword by creating 2 rules and matching a crafted packet
282  * against them. Only the first one shall trigger.
283  */
284 static int DetectIcmpIdMatchTest01 (void)
285 {
286  int result = 0;
287  Packet *p = NULL;
288  Signature *s = NULL;
289  ThreadVars th_v;
290  DetectEngineThreadCtx *det_ctx = NULL;
291 
292  memset(&th_v, 0, sizeof(ThreadVars));
293  StatsThreadInit(&th_v.stats);
294 
295  p = UTHBuildPacket(NULL, 0, IPPROTO_ICMP);
296  p->l4.vars.icmpv4.id = htons(21781);
297 
299  if (de_ctx == NULL) {
300  goto end;
301  }
302 
303  de_ctx->flags |= DE_QUIET;
304 
305  s = de_ctx->sig_list = SigInit(de_ctx, "alert icmp any any -> any any (icmp_id:21781; sid:1;)");
306  if (s == NULL) {
307  goto end;
308  }
309 
310  s = s->next = SigInit(de_ctx, "alert icmp any any -> any any (icmp_id:21782; sid:2;)");
311  if (s == NULL) {
312  goto end;
313  }
314 
316  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
317 
318  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
319  if (PacketAlertCheck(p, 1) == 0) {
320  printf("sid 1 did not alert, but should have: ");
321  goto cleanup;
322  } else if (PacketAlertCheck(p, 2)) {
323  printf("sid 2 alerted, but should not have: ");
324  goto cleanup;
325  }
326 
327  result = 1;
328 
329 cleanup:
330  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
332 
333  UTHFreePackets(&p, 1);
334 end:
335  StatsThreadCleanup(&th_v.stats);
336  return result;
337 
338 }
339 
340 /**
341  * \test DetectIcmpIdMatchTest02 is a test for checking the working of
342  * icmp_id keyword by creating 1 rule and matching a crafted packet
343  * against them. The packet is an ICMP packet with no "id" field,
344  * therefore the rule should not trigger.
345  */
346 static int DetectIcmpIdMatchTest02 (void)
347 {
348  int result = 0;
349 
350  uint8_t raw_icmpv4[] = {
351  0x0b, 0x00, 0x8a, 0xdf, 0x00, 0x00, 0x00, 0x00,
352  0x45, 0x00, 0x00, 0x14, 0x25, 0x0c, 0x00, 0x00,
353  0xff, 0x11, 0x00, 0x00, 0x85, 0x64, 0xea, 0x5b,
354  0x51, 0xa6, 0xbb, 0x35, 0x59, 0x8a, 0x5a, 0xe2,
355  0x00, 0x14, 0x00, 0x00 };
356 
357  Packet *p = PacketGetFromAlloc();
358  if (unlikely(p == NULL))
359  return 0;
360  Signature *s = NULL;
362  ThreadVars th_v;
363  DetectEngineThreadCtx *det_ctx = NULL;
364  IPV4Hdr ip4h;
365 
366  memset(&ip4h, 0, sizeof(IPV4Hdr));
367  memset(&dtv, 0, sizeof(DecodeThreadVars));
368  memset(&th_v, 0, sizeof(ThreadVars));
369  StatsThreadInit(&th_v.stats);
370 
372 
373  p->src.addr_data32[0] = 0x01020304;
374  p->dst.addr_data32[0] = 0x04030201;
375 
376  ip4h.s_ip_src.s_addr = p->src.addr_data32[0];
377  ip4h.s_ip_dst.s_addr = p->dst.addr_data32[0];
378  UTHSetIPV4Hdr(p, &ip4h);
379 
380  DecodeICMPV4(&th_v, &dtv, p, raw_icmpv4, sizeof(raw_icmpv4));
381 
383  if (de_ctx == NULL) {
384  goto end;
385  }
386 
387  de_ctx->flags |= DE_QUIET;
388 
389  s = de_ctx->sig_list = SigInit(de_ctx, "alert icmp any any -> any any (icmp_id:0; sid:1;)");
390  if (s == NULL) {
391  goto end;
392  }
393 
395  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
396 
397  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
398  if (PacketAlertCheck(p, 1)) {
399  printf("sid 1 alerted, but should not have: ");
400  goto cleanup;
401  }
402 
403  result = 1;
404 
405 cleanup:
406  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
408 
409  FlowShutdown();
410 end:
411  PacketFree(p);
412  StatsThreadCleanup(&th_v.stats);
413  return result;
414 }
415 
416 static void DetectIcmpIdRegisterTests (void)
417 {
418  UtRegisterTest("DetectIcmpIdParseTest01", DetectIcmpIdParseTest01);
419  UtRegisterTest("DetectIcmpIdParseTest02", DetectIcmpIdParseTest02);
420  UtRegisterTest("DetectIcmpIdParseTest03", DetectIcmpIdParseTest03);
421  UtRegisterTest("DetectIcmpIdParseTest04", DetectIcmpIdParseTest04);
422  UtRegisterTest("DetectIcmpIdParseTest05", DetectIcmpIdParseTest05);
423  UtRegisterTest("DetectIcmpIdMatchTest01", DetectIcmpIdMatchTest01);
424  UtRegisterTest("DetectIcmpIdMatchTest02", DetectIcmpIdMatchTest02);
425 }
426 #endif /* UNITTESTS */
util-byte.h
SIGMATCH_INFO_UINT16
#define SIGMATCH_INFO_UINT16
Definition: detect.h:1689
detect-engine-uint.h
SigTableElmt_::url
const char * url
Definition: detect.h:1461
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:316
PrefilterPacketU16Set
void PrefilterPacketU16Set(PrefilterPacketHeaderValue *v, void *smctx)
Definition: detect-engine-uint.c:126
SigTableElmt_::desc
const char * desc
Definition: detect.h:1460
ICMP_INFO_REQUEST
#define ICMP_INFO_REQUEST
Definition: decode-icmpv4.h:66
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:79
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1445
SigTableElmt_::name
const char * name
Definition: detect.h:1458
SigGroupHead_
Container for matching data for a signature group.
Definition: detect.h:1628
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
SigTableElmt_::flags
uint32_t flags
Definition: detect.h:1449
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:279
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:142
DetectEngineThreadCtx_::pmq
PrefilterRuleStore pmq
Definition: detect.h:1348
UTHSetIPV4Hdr
void UTHSetIPV4Hdr(Packet *p, IPV4Hdr *ip4h)
Definition: util-unittest-helper.c:126
ctx
struct Thresholds ctx
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:933
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2634
DE_QUIET
#define DE_QUIET
Definition: detect.h:330
ICMPV6_GET_ID
#define ICMPV6_GET_ID(p)
Definition: decode-icmpv6.h:107
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:365
SigMatchSignatures
void SigMatchSignatures(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p)
wrapper for old tests
Definition: detect.c:2418
Packet_::icmp_s
struct Packet_::@33::@40 icmp_s
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1440
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
ICMP6_ECHO_REQUEST
#define ICMP6_ECHO_REQUEST
Definition: decode-icmpv6.h:42
ICMP_ECHO
#define ICMP_ECHO
Definition: decode-icmpv4.h:45
SigTableElmt_::SetupPrefilter
int(* SetupPrefilter)(DetectEngineCtx *de_ctx, struct SigGroupHead_ *sgh)
Definition: detect.h:1443
Signature_::next
struct Signature_ * next
Definition: detect.h:750
ICMP_ADDRESSREPLY
#define ICMP_ADDRESSREPLY
Definition: decode-icmpv4.h:75
FlowInitConfig
void FlowInitConfig(bool quiet)
initialize the configuration
Definition: flow.c:549
ICMP_ADDRESS
#define ICMP_ADDRESS
Definition: decode-icmpv4.h:72
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:19
ICMP6_ECHO_REPLY
#define ICMP6_ECHO_REPLY
Definition: decode-icmpv6.h:43
DetectEngineThreadCtx_
Definition: detect.h:1245
PacketL4::L4Vars::icmpv4
ICMPV4Vars icmpv4
Definition: decode.h:479
detect-engine-mpm.h
DetectIcmpIdRegister
void DetectIcmpIdRegister(void)
Registration function for icode: icmp_id.
Definition: detect-icmp-id.c:56
SCSigMatchAppendSMToList
SigMatch * SCSigMatchAppendSMToList(DetectEngineCtx *de_ctx, Signature *s, uint16_t type, SigMatchCtx *ctx, const int list)
Append a SigMatch to the list type.
Definition: detect-parse.c:388
detect.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
DetectEngineThreadCtxInit
TmEcode DetectEngineThreadCtxInit(ThreadVars *tv, void *initdata, void **data)
initialize thread specific detection engine context
Definition: detect-engine.c:3364
PacketFree
void PacketFree(Packet *p)
Return a malloced packet.
Definition: decode.c:223
DETECT_ICMP_ID
@ DETECT_ICMP_ID
Definition: detect-engine-register.h:49
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:117
ICMPV4Vars_::id
uint16_t id
Definition: decode-icmpv4.h:186
SigInit
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
Definition: detect-parse.c:3105
Signature_::flags
uint32_t flags
Definition: detect.h:669
Packet_
Definition: decode.h:501
detect-engine-build.h
ICMP_INFO_REPLY
#define ICMP_INFO_REPLY
Definition: decode-icmpv4.h:69
detect-engine-alert.h
Packet_::l4
struct PacketL4 l4
Definition: decode.h:601
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:470
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1420
ICMP_ECHOREPLY
#define ICMP_ECHOREPLY
Definition: decode-icmpv4.h:33
SigGroupBuild
int SigGroupBuild(DetectEngineCtx *de_ctx)
Convert the signature list into the runtime match structure.
Definition: detect-engine-build.c:2194
dtv
DecodeThreadVars * dtv
Definition: fuzz_decodepcapfile.c:34
StatsThreadInit
void StatsThreadInit(StatsThreadContext *stats)
Definition: counters.c:1258
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:351
IPV4Hdr_
Definition: decode-ipv4.h:72
ICMPV4_GET_ID
#define ICMPV4_GET_ID(p)
Definition: decode-icmpv4.h:236
DetectU16Match
int DetectU16Match(const uint16_t parg, const DetectUintData_u16 *du16)
Definition: detect-engine-uint.c:107
PrefilterPacketU16Compare
bool PrefilterPacketU16Compare(PrefilterPacketHeaderValue v, void *smctx)
Definition: detect-engine-uint.c:134
SCNtohs
#define SCNtohs(x)
Definition: suricata-common.h:431
suricata-common.h
FlowShutdown
void FlowShutdown(void)
shutdown the flow engine
Definition: flow.c:693
DetectEngineThreadCtxDeinit
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
Definition: detect-engine.c:3601
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:942
PacketGetFromAlloc
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Definition: decode.c:262
DecodeThreadVars_
Structure to hold thread specific data for all decode modules.
Definition: decode.h:963
SigTableElmt_::SupportsPrefilter
bool(* SupportsPrefilter)(const Signature *s)
Definition: detect.h:1442
detect-parse.h
Signature_
Signature container.
Definition: detect.h:668
DetectIcmpIdFree
void DetectIcmpIdFree(DetectEngineCtx *, void *)
this function will free memory associated with DetectIcmpIdData
Definition: detect-icmp-id.c:176
ICMP_TIMESTAMPREPLY
#define ICMP_TIMESTAMPREPLY
Definition: decode-icmpv4.h:63
ICMPV6_GET_TYPE
#define ICMPV6_GET_TYPE(icmp6h)
Definition: decode-icmpv6.h:101
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2595
detect-icmp-id.h
Packet_::dst
Address dst
Definition: decode.h:506
FLOW_QUIET
#define FLOW_QUIET
Definition: flow.h:43
ICMP_TIMESTAMP
#define ICMP_TIMESTAMP
Definition: decode-icmpv4.h:60
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:935
detect-engine-prefilter-common.h
DetectU16Data
DetectUintData_u16 DetectU16Data
Definition: detect-engine-uint.h:42
ThreadVars_::stats
StatsThreadContext stats
Definition: threadvars.h:121
StatsThreadCleanup
void StatsThreadCleanup(StatsThreadContext *stats)
Definition: counters.c:1354
Packet_::src
Address src
Definition: decode.h:505
PacketL4::vars
union PacketL4::L4Vars vars
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1447
DecodeICMPV4
int DecodeICMPV4(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, const uint8_t *pkt, uint32_t len)
Main ICMPv4 decoding function.
Definition: decode-icmpv4.c:143
SIG_FLAG_REQUIRE_PACKET
#define SIG_FLAG_REQUIRE_PACKET
Definition: detect.h:254
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:456