suricata
detect-geoip.c
Go to the documentation of this file.
1 /* Copyright (C) 2012-2019 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 Ignacio Sanchez <sanchezmartin.ji@gmail.com>
22  * \author Bill Meeks <billmeeks8@gmail.com>
23  *
24  * Implements the geoip keyword.
25  * Updated to use MaxMind GeoIP2 database.
26  */
27 
28 #include "suricata-common.h"
29 #include "decode.h"
30 #include "detect.h"
31 
32 #include "detect-parse.h"
33 #include "detect-engine.h"
34 #include "detect-engine-mpm.h"
35 
36 #include "detect-geoip.h"
37 
38 #include "util-unittest-helper.h"
39 
40 #ifndef HAVE_GEOIP
41 
42 static int DetectGeoipSetupNoSupport (DetectEngineCtx *a, Signature *b, const char *c)
43 {
44  SCLogError("no GeoIP support built in, needed for geoip keyword");
45  return -1;
46 }
47 
48 /**
49  * \brief Registration function for geoip keyword (no libgeoip support)
50  * \todo add support for src_only and dst_only
51  */
53 {
54  sigmatch_table[DETECT_GEOIP].name = "geoip";
55  sigmatch_table[DETECT_GEOIP].desc = "match on the source, destination or source and destination IP addresses of network traffic, and to see to which country it belongs";
56  sigmatch_table[DETECT_GEOIP].url = "/rules/header-keywords.html#geoip";
57  sigmatch_table[DETECT_GEOIP].Setup = DetectGeoipSetupNoSupport;
59 }
60 
61 #else /* HAVE_GEOIP */
62 
63 #include <maxminddb.h>
64 
65 static int DetectGeoipMatch(DetectEngineThreadCtx *, Packet *,
66  const Signature *, const SigMatchCtx *);
67 static int DetectGeoipSetup(DetectEngineCtx *, Signature *, const char *);
68 #ifdef UNITTESTS
69 static void DetectGeoipRegisterTests(void);
70 #endif
71 static void DetectGeoipDataFree(DetectEngineCtx *, void *);
72 
73 /**
74  * \brief Registration function for geoip keyword
75  * \todo add support for src_only and dst_only
76  */
77 void DetectGeoipRegister(void)
78 {
79  sigmatch_table[DETECT_GEOIP].name = "geoip";
80  sigmatch_table[DETECT_GEOIP].url = "/rules/header-keywords.html#geoip";
81  sigmatch_table[DETECT_GEOIP].desc = "keyword to match on country of src and or dst IP";
82  sigmatch_table[DETECT_GEOIP].Match = DetectGeoipMatch;
83  sigmatch_table[DETECT_GEOIP].Setup = DetectGeoipSetup;
84  sigmatch_table[DETECT_GEOIP].Free = DetectGeoipDataFree;
85 #ifdef UNITTESTS
86  sigmatch_table[DETECT_GEOIP].RegisterTests = DetectGeoipRegisterTests;
87 #endif
88 }
89 
90 /**
91  * \internal
92  * \brief This function is used to initialize the geolocation MaxMind engine
93  *
94  * \retval false if the engine couldn't be initialized
95  */
96 static bool InitGeolocationEngine(DetectGeoipData *geoipdata)
97 {
98  const char *filename = NULL;
99 
100  /* Get location and name of GeoIP2 database from YAML conf */
101  (void)SCConfGet("geoip-database", &filename);
102 
103  if (filename == NULL) {
104  SCLogWarning("Unable to locate a GeoIP2"
105  "database filename in YAML conf. GeoIP rule matching "
106  "is disabled.");
107  geoipdata->mmdb_status = MMDB_FILE_OPEN_ERROR;
108  return false;
109  }
110 
111  /* Attempt to open MaxMind DB and save file handle if successful */
112  int status = MMDB_open(filename, MMDB_MODE_MMAP, &geoipdata->mmdb);
113 
114  if (status == MMDB_SUCCESS) {
115  geoipdata->mmdb_status = status;
116  return true;
117  }
118 
119  SCLogWarning("Failed to open GeoIP2 database: %s. "
120  "Error was: %s. GeoIP rule matching is disabled.",
121  filename, MMDB_strerror(status));
122  geoipdata->mmdb_status = status;
123  return false;
124 }
125 
126 /**
127  * \internal
128  * \brief This function is used to geolocate the IP using the MaxMind libraries
129  *
130  * \param ip IPv4 to geolocate (uint32_t ip)
131  *
132  * \retval NULL if it couldn't be geolocated
133  * \retval ptr (const char *) to the country code string
134  */
135 static const char *GeolocateIPv4(const DetectGeoipData *geoipdata, uint32_t ip)
136 {
137  int mmdb_error;
138  struct sockaddr_in sa;
139  sa.sin_family = AF_INET;
140  sa.sin_port = 0;
141  sa.sin_addr.s_addr = ip;
142  MMDB_lookup_result_s result;
143  MMDB_entry_data_s entry_data;
144 
145  /* Return if no GeoIP database access available */
146  if (geoipdata->mmdb_status != MMDB_SUCCESS)
147  return NULL;
148 
149  /* Attempt to find the IPv4 address in the database */
150  result = MMDB_lookup_sockaddr((MMDB_s *)&geoipdata->mmdb,
151  (struct sockaddr*)&sa, &mmdb_error);
152  if (mmdb_error != MMDB_SUCCESS)
153  return NULL;
154 
155  /* The IPv4 address was found, so grab ISO country code if available */
156  if (result.found_entry) {
157  mmdb_error = MMDB_get_value(&result.entry, &entry_data, "country",
158  "iso_code", NULL);
159  if (mmdb_error != MMDB_SUCCESS)
160  return NULL;
161 
162  /* If ISO country code was found, then return it */
163  if (entry_data.has_data) {
164  if (entry_data.type == MMDB_DATA_TYPE_UTF8_STRING) {
165  char *country_code = SCStrndup((char *)entry_data.utf8_string,
166  entry_data.data_size);
167  return country_code;
168  }
169  }
170  }
171 
172  /* The country code for the IP was not found */
173  return NULL;
174 }
175 
176 /* Match-on conditions supported */
177 #define GEOIP_MATCH_SRC_STR "src"
178 #define GEOIP_MATCH_DST_STR "dst"
179 #define GEOIP_MATCH_BOTH_STR "both"
180 #define GEOIP_MATCH_ANY_STR "any"
181 
182 #define GEOIP_MATCH_NO_FLAG 0
183 #define GEOIP_MATCH_SRC_FLAG 1
184 #define GEOIP_MATCH_DST_FLAG 2
185 #define GEOIP_MATCH_ANY_FLAG 3 /* default src and dst*/
186 #define GEOIP_MATCH_BOTH_FLAG 4
187 #define GEOIP_MATCH_NEGATED 8
188 
189 /**
190  * \internal
191  * \brief This function is used to geolocate the IP using the MaxMind libraries
192  *
193  * \param ip IPv4 to geolocate (uint32_t ip)
194  *
195  * \retval 0 no match
196  * \retval 1 match
197  */
198 static int CheckGeoMatchIPv4(const DetectGeoipData *geoipdata, uint32_t ip)
199 {
200  int i;
201 
202  /* Attempt country code lookup for the IP address */
203  const char *country = GeolocateIPv4(geoipdata, ip);
204 
205  /* Skip further checks if did not find a country code */
206  if (country == NULL)
207  return 0;
208 
209  /* Check if NOT NEGATED match-on condition */
210  if ((geoipdata->flags & GEOIP_MATCH_NEGATED) == 0)
211  {
212  for (i = 0; i < geoipdata->nlocations; i++) {
213  if (strcmp(country, (char *)geoipdata->location[i])==0) {
214  SCFree((void *)country);
215  return 1;
216  }
217  }
218  } else {
219  /* Check if NEGATED match-on condition */
220  for (i = 0; i < geoipdata->nlocations; i++) {
221  if (strcmp(country, (char *)geoipdata->location[i])==0) {
222  SCFree((void *)country);
223  return 0; /* if one matches, rule does NOT match (negated) */
224  }
225  }
226  SCFree((void *)country);
227  return 1; /* returns 1 if no location matches (negated) */
228  }
229  SCFree((void *)country);
230  return 0;
231 }
232 
233 /**
234  * \internal
235  * \brief This function is used to match packets with a IPs in an specified country
236  *
237  * \param t pointer to thread vars
238  * \param det_ctx pointer to the pattern matcher thread
239  * \param p pointer to the current packet
240  * \param m pointer to the sigmatch that we will cast into DetectGeoipData
241  *
242  * \retval 0 no match
243  * \retval 1 match
244  */
245 static int DetectGeoipMatch(DetectEngineThreadCtx *det_ctx,
246  Packet *p, const Signature *s, const SigMatchCtx *ctx)
247 {
248  const DetectGeoipData *geoipdata = (const DetectGeoipData *)ctx;
249  int matches = 0;
250 
251  if (PacketIsIPv4(p)) {
252  if (geoipdata->flags & ( GEOIP_MATCH_SRC_FLAG | GEOIP_MATCH_BOTH_FLAG ))
253  {
254  if (CheckGeoMatchIPv4(geoipdata, GET_IPV4_SRC_ADDR_U32(p)))
255  {
256  if (geoipdata->flags & GEOIP_MATCH_BOTH_FLAG)
257  matches++;
258  else
259  return 1;
260  }
261  }
262  if (geoipdata->flags & ( GEOIP_MATCH_DST_FLAG | GEOIP_MATCH_BOTH_FLAG ))
263  {
264  if (CheckGeoMatchIPv4(geoipdata, GET_IPV4_DST_ADDR_U32(p)))
265  {
266  if (geoipdata->flags & GEOIP_MATCH_BOTH_FLAG)
267  matches++;
268  else
269  return 1;
270  }
271  }
272  /* if matches == 2 is because match-on is "both" */
273  if (matches == 2)
274  return 1;
275  }
276 
277  return 0;
278 }
279 
280 /**
281  * \brief This function is used to parse geoipdata
282  *
283  * \param de_ctx Pointer to the detection engine context
284  * \param str Pointer to the geoipdata value string
285  *
286  * \retval pointer to DetectGeoipData on success
287  * \retval NULL on failure
288  */
289 static DetectGeoipData *DetectGeoipDataParse (DetectEngineCtx *de_ctx, const char *str)
290 {
291  DetectGeoipData *geoipdata = NULL;
292  uint16_t pos = 0;
293  uint16_t prevpos = 0;
294  uint16_t slen = 0;
295  int skiplocationparsing = 0;
296 
297  slen = strlen(str);
298  if (slen == 0)
299  goto error;
300 
301  /* We have a correct geoip options string */
302  geoipdata = SCCalloc(1, sizeof(DetectGeoipData));
303  if (unlikely(geoipdata == NULL))
304  goto error;
305 
306  /* Parse the geoip option string */
307  while (pos <= slen)
308  {
309  /* search for ',' or end of string */
310  if (str[pos] == ',' || pos == slen)
311  {
312  if (geoipdata->flags == GEOIP_MATCH_NO_FLAG)
313  {
314  /* Parse match-on condition */
315  if (pos == slen) /* if end of option str then there are no match-on cond. */
316  {
317  /* There was NO match-on condition! we default to ANY*/
318  skiplocationparsing = 0;
319  geoipdata->flags |= GEOIP_MATCH_ANY_FLAG;
320  } else {
321  skiplocationparsing = 1;
322  if (strncmp(&str[prevpos], GEOIP_MATCH_SRC_STR, pos-prevpos) == 0)
323  geoipdata->flags |= GEOIP_MATCH_SRC_FLAG;
324  else if (strncmp(&str[prevpos], GEOIP_MATCH_DST_STR, pos-prevpos) == 0)
325  geoipdata->flags |= GEOIP_MATCH_DST_FLAG;
326  else if (strncmp(&str[prevpos], GEOIP_MATCH_BOTH_STR, pos-prevpos) == 0)
327  geoipdata->flags |= GEOIP_MATCH_BOTH_FLAG;
328  else if (strncmp(&str[prevpos], GEOIP_MATCH_ANY_STR, pos-prevpos) == 0)
329  geoipdata->flags |= GEOIP_MATCH_ANY_FLAG;
330  else {
331  /* There was NO match-on condition! we default to ANY*/
332  skiplocationparsing = 0;
333  geoipdata->flags |= GEOIP_MATCH_ANY_FLAG;
334  }
335  }
336  }
337  if (geoipdata->flags != GEOIP_MATCH_NO_FLAG && skiplocationparsing == 0)
338  {
339  /* Parse location string: for now just the country code(s) */
340  if (str[prevpos] == '!') {
341  geoipdata->flags |= GEOIP_MATCH_NEGATED;
342  prevpos++; /* dot not copy the ! */
343  }
344 
345  if (geoipdata->nlocations >= GEOOPTION_MAXLOCATIONS) {
346  SCLogError("too many arguments for geoip keyword");
347  goto error;
348  }
349 
350  if (pos-prevpos > GEOOPTION_MAXSIZE)
351  strlcpy((char *)geoipdata->location[geoipdata->nlocations], &str[prevpos],
352  GEOOPTION_MAXSIZE);
353  else
354  strlcpy((char *)geoipdata->location[geoipdata->nlocations], &str[prevpos],
355  pos-prevpos+1);
356 
357  if (geoipdata->nlocations < GEOOPTION_MAXLOCATIONS)
358  geoipdata->nlocations++;
359  }
360  prevpos = pos+1;
361  skiplocationparsing = 0; /* match-on condition for sure has been parsed already */
362  }
363  pos++;
364  }
365 
366  SCLogDebug("GeoIP: %"PRIu32" countries loaded", geoipdata->nlocations);
367  for (int i=0; i<geoipdata->nlocations; i++)
368  SCLogDebug("GeoIP country code: %s", geoipdata->location[i]);
369 
370  SCLogDebug("flags %02X", geoipdata->flags);
371  if (geoipdata->flags & GEOIP_MATCH_NEGATED) {
372  SCLogDebug("negated geoip");
373  }
374 
375  /* init geo engine, but not when running as unittests */
376  if (!(RunmodeIsUnittests())) {
377  /* Initialize the geolocation engine */
378  if (!InitGeolocationEngine(geoipdata))
379  goto error;
380  }
381 
382  return geoipdata;
383 
384 error:
385  if (geoipdata != NULL)
386  DetectGeoipDataFree(de_ctx, geoipdata);
387  return NULL;
388 }
389 
390 /**
391  * \internal
392  * \brief this function is used to add the geoip option into the signature
393  *
394  * \param de_ctx pointer to the Detection Engine Context
395  * \param s pointer to the Current Signature
396  * \param optstr pointer to the user provided options
397  *
398  * \retval 0 on Success
399  * \retval -1 on Failure
400  */
401 static int DetectGeoipSetup(DetectEngineCtx *de_ctx, Signature *s, const char *optstr)
402 {
403  DetectGeoipData *geoipdata = NULL;
404 
405  geoipdata = DetectGeoipDataParse(de_ctx, optstr);
406  if (geoipdata == NULL)
407  goto error;
408 
409  /* Get this into a SigMatch and put it in the Signature. */
410 
412  de_ctx, s, DETECT_GEOIP, (SigMatchCtx *)geoipdata, DETECT_SM_LIST_MATCH) == NULL) {
413  goto error;
414  }
415 
416  return 0;
417 
418 error:
419  if (geoipdata != NULL)
420  DetectGeoipDataFree(de_ctx, geoipdata);
421  return -1;
422 
423 }
424 
425 /**
426  * \brief this function will free memory associated with DetectGeoipData
427  *
428  * \param geoipdata pointer to DetectGeoipData
429  */
430 static void DetectGeoipDataFree(DetectEngineCtx *de_ctx, void *ptr)
431 {
432  if (ptr != NULL) {
433  DetectGeoipData *geoipdata = (DetectGeoipData *)ptr;
434  if (geoipdata->mmdb_status == MMDB_SUCCESS)
435  MMDB_close(&geoipdata->mmdb);
436  SCFree(geoipdata);
437  }
438 }
439 
440 #ifdef UNITTESTS
441 
442 static int GeoipParseTest(const char *rule, int ncountries, const char **countries, uint32_t flags)
443 {
444  DetectEngineCtx *de_ctx = NULL;
445  Signature *s = NULL;
446  DetectGeoipData *data = NULL;
447 
449  FAIL_IF(de_ctx == NULL);
450  de_ctx->flags |= DE_QUIET;
451 
452  de_ctx->sig_list = SigInit(de_ctx, rule);
453  FAIL_IF(de_ctx->sig_list == NULL);
454 
455  s = de_ctx->sig_list;
457 
459 
460  data = (DetectGeoipData *)s->init_data->smlists_tail[DETECT_SM_LIST_MATCH]->ctx;
461  FAIL_IF(data->flags != flags);
462 
463  FAIL_IF(data->nlocations!=ncountries);
464 
465  for (int i=0; i<ncountries; i++)
466  {
467  FAIL_IF(strcmp((char *)data->location[i],countries[i])!=0);
468  }
469 
471  PASS;
472 }
473 
474 static int GeoipParseTest01(void)
475 {
476  const char *ccodes[1] = {"US"};
477  return GeoipParseTest("alert tcp any any -> any any (geoip:US;sid:1;)", 1, ccodes,
478  GEOIP_MATCH_ANY_FLAG);
479 }
480 
481 static int GeoipParseTest02(void)
482 {
483  const char *ccodes[1] = {"US"};
484  return GeoipParseTest("alert tcp any any -> any any (geoip:!US;sid:1;)", 1, ccodes,
485  GEOIP_MATCH_ANY_FLAG | GEOIP_MATCH_NEGATED);
486 }
487 
488 static int GeoipParseTest03(void)
489 {
490  const char *ccodes[1] = {"US"};
491  return GeoipParseTest("alert tcp any any -> any any (geoip:!US;sid:1;)", 1, ccodes,
492  GEOIP_MATCH_ANY_FLAG | GEOIP_MATCH_NEGATED);
493 }
494 
495 static int GeoipParseTest04(void)
496 {
497  const char *ccodes[1] = {"US"};
498  return GeoipParseTest("alert tcp any any -> any any (geoip:src,US;sid:1;)", 1, ccodes,
499  GEOIP_MATCH_SRC_FLAG);
500 }
501 
502 static int GeoipParseTest05(void)
503 {
504  const char *ccodes[1] = {"US"};
505  return GeoipParseTest("alert tcp any any -> any any (geoip:dst,!US;sid:1;)", 1, ccodes,
506  GEOIP_MATCH_DST_FLAG | GEOIP_MATCH_NEGATED);
507 }
508 
509 static int GeoipParseTest06(void)
510 {
511  const char *ccodes[3] = {"US", "ES", "UK"};
512  return GeoipParseTest("alert tcp any any -> any any (geoip:US,ES,UK;sid:1;)", 3, ccodes,
513  GEOIP_MATCH_ANY_FLAG);
514 }
515 
516 static int GeoipParseTest07(void)
517 {
518  const char *ccodes[3] = {"US", "ES", "UK"};
519  return GeoipParseTest("alert tcp any any -> any any (geoip:both,!US,ES,UK;sid:1;)", 3, ccodes,
520  GEOIP_MATCH_BOTH_FLAG | GEOIP_MATCH_NEGATED);
521 }
522 
523 /**
524  * \internal
525  * \brief This function registers unit tests for DetectGeoip
526  */
527 static void DetectGeoipRegisterTests(void)
528 {
529  UtRegisterTest("GeoipParseTest01", GeoipParseTest01);
530  UtRegisterTest("GeoipParseTest02", GeoipParseTest02);
531  UtRegisterTest("GeoipParseTest03", GeoipParseTest03);
532  UtRegisterTest("GeoipParseTest04", GeoipParseTest04);
533  UtRegisterTest("GeoipParseTest05", GeoipParseTest05);
534  UtRegisterTest("GeoipParseTest06", GeoipParseTest06);
535  UtRegisterTest("GeoipParseTest07", GeoipParseTest07);
536 }
537 #endif /* UNITTESTS */
538 #endif /* HAVE_GEOIP */
SigTableElmt_::url
const char * url
Definition: detect.h:1545
detect-engine.h
DetectGeoipRegister
void DetectGeoipRegister(void)
Registration function for geoip keyword (no libgeoip support)
Definition: detect-geoip.c:52
SigTableElmt_::desc
const char * desc
Definition: detect.h:1544
sigmatch_table
SigTableElmt * sigmatch_table
Definition: detect-parse.c:78
SigTableElmt_::Free
void(* Free)(DetectEngineCtx *, void *)
Definition: detect.h:1529
SigTableElmt_::name
const char * name
Definition: detect.h:1542
SignatureInitData_::smlists_tail
struct SigMatch_ * smlists_tail[DETECT_SM_LIST_MAX]
Definition: detect.h:668
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:101
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:282
ctx
struct Thresholds ctx
DetectEngineCtx_
main detection engine ctx
Definition: detect.h:995
SCConfGet
int SCConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
Definition: conf.c:352
DetectEngineCtxFree
void DetectEngineCtxFree(DetectEngineCtx *)
Free a DetectEngineCtx::
Definition: detect-engine.c:2912
DE_QUIET
#define DE_QUIET
Definition: detect.h:334
p
Packet * p
Definition: fuzz_dataset.c:30
SigTableElmt_::Setup
int(* Setup)(DetectEngineCtx *, Signature *, const char *)
Definition: detect.h:1524
util-unittest-helper.h
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
decode.h
PASS
#define PASS
Pass the test.
Definition: util-unittest.h:105
de_ctx
DetectEngineCtx * de_ctx
Definition: fuzz_siginit.c:22
DetectEngineThreadCtx_
Definition: detect.h:1316
DETECT_GEOIP
@ DETECT_GEOIP
Definition: detect-engine-register.h:113
detect-engine-mpm.h
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:424
detect.h
DETECT_SM_LIST_MATCH
@ DETECT_SM_LIST_MATCH
Definition: detect.h:118
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:262
SigInit
Signature * SigInit(DetectEngineCtx *de_ctx, const char *sigstr)
Parses a signature and adds it to the Detection Engine Context.
Definition: detect-parse.c:3618
SigMatch_::ctx
SigMatchCtx * ctx
Definition: detect.h:363
Packet_
Definition: decode.h:516
Signature_::init_data
SignatureInitData * init_data
Definition: detect.h:775
SigTableElmt_::Match
int(* Match)(DetectEngineThreadCtx *, Packet *, const Signature *, const SigMatchCtx *)
Definition: detect.h:1504
RunmodeIsUnittests
int RunmodeIsUnittests(void)
Definition: suricata.c:293
SigMatchCtx_
Used to start a pointer to SigMatch context Should never be dereferenced without casting to something...
Definition: detect.h:355
FAIL_IF
#define FAIL_IF(expr)
Fail a test if expression evaluates to true.
Definition: util-unittest.h:71
flags
uint8_t flags
Definition: decode-gre.h:0
suricata-common.h
SigMatch_::type
uint16_t type
Definition: detect.h:361
SCStrndup
#define SCStrndup(s, n)
Definition: util-mem.h:59
DetectEngineCtx_::sig_list
Signature * sig_list
Definition: detect.h:1005
str
#define str(s)
Definition: suricata-common.h:313
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:274
SCFree
#define SCFree(p)
Definition: util-mem.h:61
detect-parse.h
Signature_
Signature container.
Definition: detect.h:692
detect-geoip.h
DetectEngineCtxInit
DetectEngineCtx * DetectEngineCtxInit(void)
Definition: detect-engine.c:2873
DetectEngineCtx_::flags
uint8_t flags
Definition: detect.h:997
GET_IPV4_SRC_ADDR_U32
#define GET_IPV4_SRC_ADDR_U32(p)
Definition: decode.h:197
GET_IPV4_DST_ADDR_U32
#define GET_IPV4_DST_ADDR_U32(p)
Definition: decode.h:198
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
SigTableElmt_::RegisterTests
void(* RegisterTests)(void)
Definition: detect.h:1531