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  const SigMatch *sm;
211  for (sm = s->init_data->smlists[DETECT_SM_LIST_MATCH] ; sm != NULL; sm = sm->next) {
212  switch (sm->type) {
213  case DETECT_ICMP_ID:
214  return true;
215  }
216  }
217  return false;
218 }
219 
220 #ifdef UNITTESTS
221 #include "detect-engine.h"
222 #include "detect-engine-mpm.h"
223 
224 /**
225  * \test DetectIcmpIdParseTest01 is a test for setting a valid icmp_id value
226  */
227 static int DetectIcmpIdParseTest01 (void)
228 {
229  DetectU16Data *iid = SCDetectU16UnquoteParse("300");
230  FAIL_IF_NULL(iid);
231  FAIL_IF_NOT(iid->arg1 == 300);
232  DetectIcmpIdFree(NULL, iid);
233  PASS;
234 }
235 
236 /**
237  * \test DetectIcmpIdParseTest02 is a test for setting a valid icmp_id value
238  * with spaces all around
239  */
240 static int DetectIcmpIdParseTest02 (void)
241 {
242  DetectU16Data *iid = SCDetectU16UnquoteParse(" 300 ");
243  FAIL_IF_NULL(iid);
244  FAIL_IF_NOT(iid->arg1 == 300);
245  DetectIcmpIdFree(NULL, iid);
246  PASS;
247 }
248 
249 /**
250  * \test DetectIcmpIdParseTest03 is a test for setting a valid icmp_id value
251  * with quotation marks
252  */
253 static int DetectIcmpIdParseTest03 (void)
254 {
255  DetectU16Data *iid = SCDetectU16UnquoteParse("\"300\"");
256  FAIL_IF_NULL(iid);
257  FAIL_IF_NOT(iid->arg1 == 300);
258  DetectIcmpIdFree(NULL, iid);
259  PASS;
260 }
261 
262 /**
263  * \test DetectIcmpIdParseTest04 is a test for setting a valid icmp_id value
264  * with quotation marks and spaces all around
265  */
266 static int DetectIcmpIdParseTest04 (void)
267 {
268  DetectU16Data *iid = SCDetectU16UnquoteParse(" \" 300 \"");
269  FAIL_IF_NULL(iid);
270  FAIL_IF_NOT(iid->arg1 == 300);
271  DetectIcmpIdFree(NULL, iid);
272  PASS;
273 }
274 
275 /**
276  * \test DetectIcmpIdParseTest05 is a test for setting an invalid icmp_id
277  * value with missing quotation marks
278  */
279 static int DetectIcmpIdParseTest05 (void)
280 {
281  DetectU16Data *iid = SCDetectU16UnquoteParse("\"300");
282  FAIL_IF_NOT_NULL(iid);
283  PASS;
284 }
285 
286 /**
287  * \test DetectIcmpIdMatchTest01 is a test for checking the working of
288  * icmp_id keyword by creating 2 rules and matching a crafted packet
289  * against them. Only the first one shall trigger.
290  */
291 static int DetectIcmpIdMatchTest01 (void)
292 {
293  int result = 0;
294  Packet *p = NULL;
295  Signature *s = NULL;
296  ThreadVars th_v;
297  DetectEngineThreadCtx *det_ctx = NULL;
298 
299  memset(&th_v, 0, sizeof(ThreadVars));
300 
301  p = UTHBuildPacket(NULL, 0, IPPROTO_ICMP);
302  p->l4.vars.icmpv4.id = htons(21781);
303 
305  if (de_ctx == NULL) {
306  goto end;
307  }
308 
309  de_ctx->flags |= DE_QUIET;
310 
311  s = de_ctx->sig_list = SigInit(de_ctx, "alert icmp any any -> any any (icmp_id:21781; sid:1;)");
312  if (s == NULL) {
313  goto end;
314  }
315 
316  s = s->next = SigInit(de_ctx, "alert icmp any any -> any any (icmp_id:21782; sid:2;)");
317  if (s == NULL) {
318  goto end;
319  }
320 
322  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
323 
324  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
325  if (PacketAlertCheck(p, 1) == 0) {
326  printf("sid 1 did not alert, but should have: ");
327  goto cleanup;
328  } else if (PacketAlertCheck(p, 2)) {
329  printf("sid 2 alerted, but should not have: ");
330  goto cleanup;
331  }
332 
333  result = 1;
334 
335 cleanup:
336  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
338 
339  UTHFreePackets(&p, 1);
340 end:
341  StatsThreadCleanup(&th_v);
342  return result;
343 
344 }
345 
346 /**
347  * \test DetectIcmpIdMatchTest02 is a test for checking the working of
348  * icmp_id keyword by creating 1 rule and matching a crafted packet
349  * against them. The packet is an ICMP packet with no "id" field,
350  * therefore the rule should not trigger.
351  */
352 static int DetectIcmpIdMatchTest02 (void)
353 {
354  int result = 0;
355 
356  uint8_t raw_icmpv4[] = {
357  0x0b, 0x00, 0x8a, 0xdf, 0x00, 0x00, 0x00, 0x00,
358  0x45, 0x00, 0x00, 0x14, 0x25, 0x0c, 0x00, 0x00,
359  0xff, 0x11, 0x00, 0x00, 0x85, 0x64, 0xea, 0x5b,
360  0x51, 0xa6, 0xbb, 0x35, 0x59, 0x8a, 0x5a, 0xe2,
361  0x00, 0x14, 0x00, 0x00 };
362 
363  Packet *p = PacketGetFromAlloc();
364  if (unlikely(p == NULL))
365  return 0;
366  Signature *s = NULL;
368  ThreadVars th_v;
369  DetectEngineThreadCtx *det_ctx = NULL;
370  IPV4Hdr ip4h;
371 
372  memset(&ip4h, 0, sizeof(IPV4Hdr));
373  memset(&dtv, 0, sizeof(DecodeThreadVars));
374  memset(&th_v, 0, sizeof(ThreadVars));
375 
377 
378  p->src.addr_data32[0] = 0x01020304;
379  p->dst.addr_data32[0] = 0x04030201;
380 
381  ip4h.s_ip_src.s_addr = p->src.addr_data32[0];
382  ip4h.s_ip_dst.s_addr = p->dst.addr_data32[0];
383  UTHSetIPV4Hdr(p, &ip4h);
384 
385  DecodeICMPV4(&th_v, &dtv, p, raw_icmpv4, sizeof(raw_icmpv4));
386 
388  if (de_ctx == NULL) {
389  goto end;
390  }
391 
392  de_ctx->flags |= DE_QUIET;
393 
394  s = de_ctx->sig_list = SigInit(de_ctx, "alert icmp any any -> any any (icmp_id:0; sid:1;)");
395  if (s == NULL) {
396  goto end;
397  }
398 
400  DetectEngineThreadCtxInit(&th_v, (void *)de_ctx, (void *)&det_ctx);
401 
402  SigMatchSignatures(&th_v, de_ctx, det_ctx, p);
403  if (PacketAlertCheck(p, 1)) {
404  printf("sid 1 alerted, but should not have: ");
405  goto cleanup;
406  }
407 
408  result = 1;
409 
410 cleanup:
411  DetectEngineThreadCtxDeinit(&th_v, (void *)det_ctx);
413 
414  FlowShutdown();
415 end:
416  PacketFree(p);
417  StatsThreadCleanup(&th_v);
418  return result;
419 }
420 
421 static void DetectIcmpIdRegisterTests (void)
422 {
423  UtRegisterTest("DetectIcmpIdParseTest01", DetectIcmpIdParseTest01);
424  UtRegisterTest("DetectIcmpIdParseTest02", DetectIcmpIdParseTest02);
425  UtRegisterTest("DetectIcmpIdParseTest03", DetectIcmpIdParseTest03);
426  UtRegisterTest("DetectIcmpIdParseTest04", DetectIcmpIdParseTest04);
427  UtRegisterTest("DetectIcmpIdParseTest05", DetectIcmpIdParseTest05);
428  UtRegisterTest("DetectIcmpIdMatchTest01", DetectIcmpIdMatchTest01);
429  UtRegisterTest("DetectIcmpIdMatchTest02", DetectIcmpIdMatchTest02);
430 }
431 #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
SignatureInitData_::smlists
struct SigMatch_ * smlists[DETECT_SM_LIST_MAX]
Definition: detect.h:642
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:2416
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:18
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
SigMatch_::next
struct SigMatch_ * next
Definition: detect.h:360
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:3098
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
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:747
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:33
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
SigMatch_::type
uint16_t type
Definition: detect.h:357
FlowShutdown
void FlowShutdown(void)
shutdown the flow engine
Definition: flow.c:693
DetectEngineThreadCtxDeinit
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
Definition: detect-engine.c:3596
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
SigMatch_
a single match condition for a signature
Definition: detect.h:356
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
StatsThreadCleanup
void StatsThreadCleanup(ThreadVars *tv)
Definition: counters.c:1324
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