suricata
runmode-pfring.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-2018 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 #include "suricata-common.h"
19 #include "runmode-pfring.h"
20 #include "tm-threads.h"
21 #include "conf.h"
22 #include "runmodes.h"
23 #include "source-pfring.h"
24 
25 #include "util-debug.h"
26 #include "util-time.h"
27 #include "util-cpu.h"
28 #include "util-runmodes.h"
29 #include "util-device.h"
30 #include "util-ioctl.h"
31 #include "util-byte.h"
32 #include "util-conf.h"
33 
34 #ifdef HAVE_PFRING
35 #include <pfring.h>
36 #endif
37 
38 #define PFRING_CONF_V1 1
39 #define PFRING_CONF_V2 2
40 
42 {
43 #ifdef HAVE_PFRING
44  return "workers";
45 #else
46  return NULL;
47 #endif
48 }
49 
51 {
53  "Multi threaded pfring mode. Packets from "
54  "each flow are assigned to a single detect "
55  "thread, unlike \"pfring_auto\" where packets "
56  "from the same flow can be processed by any "
57  "detect thread",
60  RUNMODE_PFRING, "single", "Single threaded pfring mode", RunModeIdsPfringSingle, NULL);
62  "Workers pfring mode, each thread does all"
63  " tasks from acquisition to logging",
65  return;
66 }
67 
68 #ifdef HAVE_PFRING
69 static void PfringDerefConfig(void *conf)
70 {
71  PfringIfaceConfig *pfp = (PfringIfaceConfig *)conf;
72  if (SC_ATOMIC_SUB(pfp->ref, 1) == 1) {
73  if (pfp->bpf_filter) {
74  SCFree(pfp->bpf_filter);
75  }
76  SCFree(pfp);
77  }
78 }
79 
80 /**
81  * \brief extract information from config file
82  *
83  * The returned structure will be freed by the thread init function.
84  * This is thus necessary to or copy the structure before giving it
85  * to thread or to reparse the file for each thread (and thus have
86  * new structure.
87  *
88  * If old config system is used, then return the smae parameters
89  * value for each interface.
90  *
91  * \return a PfringIfaceConfig corresponding to the interface name
92  */
93 static void *OldParsePfringConfig(const char *iface)
94 {
95  const char *threadsstr = NULL;
96  PfringIfaceConfig *pfconf = SCMalloc(sizeof(*pfconf));
97  const char *tmpclusterid;
98  const char *tmpctype = NULL;
99  cluster_type default_ctype = CLUSTER_ROUND_ROBIN;
100 
101  if (unlikely(pfconf == NULL)) {
102  return NULL;
103  }
104 
105  if (iface == NULL) {
106  SCFree(pfconf);
107  return NULL;
108  }
109 
110  strlcpy(pfconf->iface, iface, sizeof(pfconf->iface));
111  pfconf->flags = 0;
112  pfconf->threads = 1;
113  pfconf->cluster_id = 1;
114  pfconf->ctype = default_ctype;
115  pfconf->DerefFunc = PfringDerefConfig;
117  SC_ATOMIC_INIT(pfconf->ref);
118  (void) SC_ATOMIC_ADD(pfconf->ref, 1);
119 
120  /* Find initial node */
121  if (ConfGet("pfring.threads", &threadsstr) != 1) {
122  pfconf->threads = 1;
123  } else {
124  if (threadsstr != NULL) {
125  if (StringParseInt32(&pfconf->threads, 10, 0, threadsstr) < 0) {
126  SCLogWarning("Invalid value for "
127  "pfring.threads: '%s'. Resetting to 1.",
128  threadsstr);
129  pfconf->threads = 1;
130  }
131  }
132  }
133  if (pfconf->threads == 0) {
134  pfconf->threads = 1;
135  }
136 
137  SC_ATOMIC_RESET(pfconf->ref);
138  (void) SC_ATOMIC_ADD(pfconf->ref, pfconf->threads);
139 
140  if (strncmp(pfconf->iface, "zc", 2) == 0) {
141  SCLogInfo("ZC interface detected, not setting cluster-id");
142  }
143  else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) {
144  SCLogInfo("DNA interface detected, not setting cluster-id");
145  } else if (ConfGet("pfring.cluster-id", &tmpclusterid) != 1) {
146  SCLogError("Could not get cluster-id from config");
147  } else {
148  if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
149  SCLogWarning("Invalid value for "
150  "pfring.cluster_id: '%s'. Resetting to 1.",
151  tmpclusterid);
152  pfconf->cluster_id = 1;
153  }
154  pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
155  SCLogDebug("Going to use cluster-id %" PRId32, pfconf->cluster_id);
156  }
157 
158  if (strncmp(pfconf->iface, "zc", 2) == 0) {
159  SCLogInfo("ZC interface detected, not setting cluster type for PF_RING (iface %s)",
160  pfconf->iface);
161  } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) {
162  SCLogInfo("DNA interface detected, not setting cluster type for PF_RING (iface %s)",
163  pfconf->iface);
164  } else if (ConfGet("pfring.cluster-type", &tmpctype) != 1) {
165  SCLogError("Could not get cluster-type from config");
166  } else if (strcmp(tmpctype, "cluster_round_robin") == 0) {
167  SCLogInfo("Using round-robin cluster mode for PF_RING (iface %s)",
168  pfconf->iface);
169  pfconf->ctype = (cluster_type)tmpctype;
170  } else if (strcmp(tmpctype, "cluster_flow") == 0) {
171  SCLogInfo("Using flow cluster mode for PF_RING (iface %s)",
172  pfconf->iface);
173  pfconf->ctype = (cluster_type)tmpctype;
174  } else {
175  SCLogError("invalid cluster-type %s", tmpctype);
176  SCFree(pfconf);
177  return NULL;
178  }
179 
180  return pfconf;
181 }
182 
183 /**
184  * \brief extract information from config file
185  *
186  * The returned structure will be freed by the thread init function.
187  * This is thus necessary to or copy the structure before giving it
188  * to thread or to reparse the file for each thread (and thus have
189  * new structure.
190  *
191  * If old config system is used, then return the smae parameters
192  * value for each interface.
193  *
194  * \return a PfringIfaceConfig corresponding to the interface name
195  */
196 static void *ParsePfringConfig(const char *iface)
197 {
198  const char *threadsstr = NULL;
199  ConfNode *if_root;
200  ConfNode *if_default = NULL;
201  ConfNode *pf_ring_node;
202  PfringIfaceConfig *pfconf = SCMalloc(sizeof(*pfconf));
203  const char *tmpclusterid;
204  const char *tmpctype = NULL;
205  cluster_type default_ctype = CLUSTER_ROUND_ROBIN;
206  int getctype = 0;
207  const char *bpf_filter = NULL;
208  int bool_val;
209 
210  if (unlikely(pfconf == NULL)) {
211  return NULL;
212  }
213 
214  if (iface == NULL) {
215  SCFree(pfconf);
216  return NULL;
217  }
218 
219  memset(pfconf, 0, sizeof(PfringIfaceConfig));
220  strlcpy(pfconf->iface, iface, sizeof(pfconf->iface));
221  pfconf->threads = 1;
222  pfconf->cluster_id = 1;
223  pfconf->ctype = (cluster_type)default_ctype;
224  pfconf->DerefFunc = PfringDerefConfig;
225  SC_ATOMIC_INIT(pfconf->ref);
226  (void) SC_ATOMIC_ADD(pfconf->ref, 1);
227 
228  /* Find initial node */
229  pf_ring_node = ConfGetNode("pfring");
230  if (pf_ring_node == NULL) {
231  SCLogInfo("Unable to find pfring config using default value");
232  return pfconf;
233  }
234 
235  if_root = ConfFindDeviceConfig(pf_ring_node, iface);
236 
237  if_default = ConfFindDeviceConfig(pf_ring_node, "default");
238 
239  if (if_root == NULL && if_default == NULL) {
240  SCLogInfo("Unable to find pfring config for "
241  "interface %s, using default value or 1.0 "
242  "configuration system. ",
243  iface);
244  return pfconf;
245  }
246 
247  /* If there is no setting for current interface use default one as main iface */
248  if (if_root == NULL) {
249  if_root = if_default;
250  if_default = NULL;
251  }
252 
253  if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
254  pfconf->threads = 1;
255  } else if (threadsstr != NULL) {
256  if (strcmp(threadsstr, "auto") == 0) {
257  pfconf->threads = (int)UtilCpuGetNumProcessorsOnline();
258  if (pfconf->threads > 0) {
259  SCLogPerf("%u cores, so using %u threads", pfconf->threads, pfconf->threads);
260  } else {
261  pfconf->threads = GetIfaceRSSQueuesNum(iface);
262  if (pfconf->threads > 0) {
263  SCLogPerf("%d RSS queues, so using %u threads", pfconf->threads, pfconf->threads);
264  }
265  }
266  } else {
267  uint16_t threads = 0;
268  if (StringParseUint16(&threads, 10, 0, (const char *)threadsstr) < 0) {
269  SCLogWarning("Invalid value for "
270  "pfring.threads: '%s'. Resetting to 1.",
271  threadsstr);
272  pfconf->threads = 1;
273  } else {
274  pfconf->threads = threads;
275  }
276  }
277  }
278  if (pfconf->threads <= 0) {
279  pfconf->threads = 1;
280  }
281 
282  SC_ATOMIC_RESET(pfconf->ref);
283  (void) SC_ATOMIC_ADD(pfconf->ref, pfconf->threads);
284 
285  /* command line value has precedence */
286  if (ConfGet("pfring.cluster-id", &tmpclusterid) == 1) {
287  if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
288  SCLogWarning("Invalid value for "
289  "pfring.cluster-id: '%s'. Resetting to 1.",
290  tmpclusterid);
291  pfconf->cluster_id = 1;
292  }
293  pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
294  SCLogDebug("Going to use command-line provided cluster-id %" PRId32,
295  pfconf->cluster_id);
296  } else {
297 
298  if (strncmp(pfconf->iface, "zc", 2) == 0) {
299  SCLogInfo("ZC interface detected, not setting cluster-id for PF_RING (iface %s)",
300  pfconf->iface);
301  } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) {
302  SCLogInfo("DNA interface detected, not setting cluster-id for PF_RING (iface %s)",
303  pfconf->iface);
304  } else if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-id", &tmpclusterid) != 1) {
305  SCLogError("Could not get cluster-id from config");
306  } else {
307  if (StringParseInt32(&pfconf->cluster_id, 10, 0, (const char *)tmpclusterid) < 0) {
308  SCLogWarning("Invalid value for "
309  "pfring.cluster-id: '%s'. Resetting to 1.",
310  tmpclusterid);
311  pfconf->cluster_id = 1;
312  }
313  pfconf->flags |= PFRING_CONF_FLAGS_CLUSTER;
314  SCLogDebug("Going to use cluster-id %" PRId32, pfconf->cluster_id);
315  }
316  }
317 
318  /*load pfring bpf filter*/
319  /* command line value has precedence */
320  if (ConfGet("bpf-filter", &bpf_filter) == 1) {
321  if (strlen(bpf_filter) > 0) {
322  pfconf->bpf_filter = SCStrdup(bpf_filter);
323  if (unlikely(pfconf->bpf_filter == NULL)) {
324  SCLogError("Can't allocate BPF filter string");
325  } else {
326  SCLogDebug("Going to use command-line provided bpf filter %s",
327  pfconf->bpf_filter);
328  }
329  }
330  } else {
331  if (ConfGetChildValueWithDefault(if_root, if_default, "bpf-filter", &bpf_filter) == 1) {
332  if (strlen(bpf_filter) > 0) {
333  pfconf->bpf_filter = SCStrdup(bpf_filter);
334  if (unlikely(pfconf->bpf_filter == NULL)) {
335  SCLogError("Can't allocate BPF filter string");
336  } else {
337  SCLogDebug("Going to use bpf filter %s",
338  pfconf->bpf_filter);
339  }
340  }
341  }
342  }
343 
344  if (ConfGet("pfring.cluster-type", &tmpctype) == 1) {
345  SCLogDebug("Going to use command-line provided cluster-type");
346  getctype = 1;
347  } else {
348  if (strncmp(pfconf->iface, "zc", 2) == 0) {
349  SCLogInfo("ZC interface detected, not setting cluster type for PF_RING (iface %s)",
350  pfconf->iface);
351  } else if ((pfconf->threads == 1) && (strncmp(pfconf->iface, "dna", 3) == 0)) {
352  SCLogInfo("DNA interface detected, not setting cluster type for PF_RING (iface %s)",
353  pfconf->iface);
354  } else if (ConfGetChildValueWithDefault(if_root, if_default, "cluster-type", &tmpctype) != 1) {
355  SCLogError("Could not get cluster-type from config");
356  } else {
357  getctype = 1;
358  }
359  }
360 
361  if (getctype) {
362  if (strcmp(tmpctype, "cluster_round_robin") == 0) {
363  SCLogInfo("Using round-robin cluster mode for PF_RING (iface %s)",
364  pfconf->iface);
365  pfconf->ctype = CLUSTER_ROUND_ROBIN;
366  } else if (strcmp(tmpctype, "cluster_flow") == 0) {
367  SCLogInfo("Using flow cluster mode for PF_RING (iface %s)",
368  pfconf->iface);
369  pfconf->ctype = CLUSTER_FLOW;
370  } else {
371  SCLogError("invalid cluster-type %s", tmpctype);
372  SCFree(pfconf);
373  return NULL;
374  }
375  }
376  if (ConfGetChildValueWithDefault(if_root, if_default, "checksum-checks", &tmpctype) == 1) {
377  if (strcmp(tmpctype, "auto") == 0) {
379  } else if (ConfValIsTrue(tmpctype)) {
381  } else if (ConfValIsFalse(tmpctype)) {
383  } else if (strcmp(tmpctype, "rx-only") == 0) {
385  } else {
386  SCLogError("Invalid value for checksum-checks for %s", pfconf->iface);
387  }
388  }
389 
390  if (ConfGetChildValueBoolWithDefault(if_root, if_default, "bypass", &bool_val) == 1) {
391  if (bool_val) {
392 #ifdef HAVE_PF_RING_FLOW_OFFLOAD
393  SCLogConfig("Enabling bypass support in PF_RING for iface %s (if supported by underlying hw)", pfconf->iface);
394  pfconf->flags |= PFRING_CONF_FLAGS_BYPASS;
395 #else
396  SCLogError("Bypass is not supported by this Pfring version, please upgrade");
397  SCFree(pfconf);
398  return NULL;
399 #endif
400  }
401  }
402 
403  if (LiveGetOffload() == 0) {
404  if (GetIfaceOffloading(iface, 0, 1) == 1) {
405  SCLogWarning("Using PF_RING with offloading activated leads to capture problems");
406  }
407  } else {
409  }
410  return pfconf;
411 }
412 
413 static int PfringConfigGetThreadsCount(void *conf)
414 {
415  PfringIfaceConfig *pfp = (PfringIfaceConfig *)conf;
416  return pfp->threads;
417 }
418 
419 static int PfringConfLevel(void)
420 {
421  const char *def_dev = NULL;
422  /* 1.0 config should return a string */
423  if (ConfGet("pfring.interface", &def_dev) != 1) {
424  return PFRING_CONF_V2;
425  } else {
426  return PFRING_CONF_V1;
427  }
428 }
429 
430 static int GetDevAndParser(const char **live_dev, ConfigIfaceParserFunc *parser)
431 {
432  ConfGet("pfring.live-interface", live_dev);
433 
434  /* determine which config type we have */
435  if (PfringConfLevel() > PFRING_CONF_V1) {
436  *parser = ParsePfringConfig;
437  } else {
438  SCLogInfo("Using 1.0 style configuration for pfring");
439  *parser = OldParsePfringConfig;
440  /* In v1: try to get interface name from config */
441  if (*live_dev == NULL) {
442  if (ConfGet("pfring.interface", live_dev) == 1) {
443  SCLogInfo("Using interface %s", *live_dev);
444  LiveRegisterDevice(*live_dev);
445  } else {
446  SCLogInfo("No interface found, problem incoming");
447  *live_dev = NULL;
448  }
449  }
450  }
451 
452  return 0;
453 }
454 #endif
455 
457 {
458  SCEnter();
459 
460 /* We include only if pfring is enabled */
461 #ifdef HAVE_PFRING
462  int ret;
463  const char *live_dev = NULL;
464  ConfigIfaceParserFunc tparser;
465 
467 
468  TimeModeSetLive();
469 
470  ret = GetDevAndParser(&live_dev, &tparser);
471  if (ret != 0) {
472  FatalError("Unable to get parser and interface params");
473  }
474 
475  ret = RunModeSetLiveCaptureAutoFp(tparser, PfringConfigGetThreadsCount, "ReceivePfring",
476  "DecodePfring", thread_name_autofp, live_dev);
477  if (ret != 0) {
478  FatalError("Runmode start failed");
479  }
480 
481  SCLogInfo("RunModeIdsPfringAutoFp initialised");
482 #endif /* HAVE_PFRING */
483 
484  return 0;
485 }
486 
488 {
489  SCEnter();
490 
491 /* We include only if pfring is enabled */
492 #ifdef HAVE_PFRING
493  int ret;
494  const char *live_dev = NULL;
495  ConfigIfaceParserFunc tparser;
496 
498 
499  TimeModeSetLive();
500 
501  ret = GetDevAndParser(&live_dev, &tparser);
502  if (ret != 0) {
503  FatalError("Unable to get parser and interface params");
504  }
505 
506  ret = RunModeSetLiveCaptureSingle(tparser,
507  PfringConfigGetThreadsCount,
508  "ReceivePfring",
509  "DecodePfring", thread_name_single,
510  live_dev);
511  if (ret != 0) {
512  FatalError("Runmode start failed");
513  }
514 
515  SCLogInfo("RunModeIdsPfringSingle initialised");
516 #endif /* HAVE_PFRING */
517 
518  return 0;
519 }
520 
522 {
523  SCEnter();
524 
525 /* We include only if pfring is enabled */
526 #ifdef HAVE_PFRING
527  int ret;
528  const char *live_dev = NULL;
529  ConfigIfaceParserFunc tparser;
530 
532 
533  TimeModeSetLive();
534 
535  ret = GetDevAndParser(&live_dev, &tparser);
536  if (ret != 0) {
537  FatalError("Unable to get parser and interface params");
538  }
539 
540  ret = RunModeSetLiveCaptureWorkers(tparser, PfringConfigGetThreadsCount, "ReceivePfring",
541  "DecodePfring", thread_name_workers, live_dev);
542  if (ret != 0) {
543  FatalError("Runmode start failed");
544  }
545 
546  SCLogInfo("RunModeIdsPfringWorkers initialised");
547 #endif /* HAVE_PFRING */
548 
549  return 0;
550 }
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:81
RunModeIdsPfringWorkers
int RunModeIdsPfringWorkers(void)
Definition: runmode-pfring.c:521
util-byte.h
tm-threads.h
PfringIfaceConfig_
Definition: source-pfring.h:36
LiveRegisterDevice
int LiveRegisterDevice(const char *dev)
Add a pcap device for monitoring and create structure.
Definition: util-device.c:126
RunModeSetLiveCaptureWorkers
int RunModeSetLiveCaptureWorkers(ConfigIfaceParserFunc ConfigParser, ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name, const char *decode_mod_name, const char *thread_name, const char *live_dev)
Definition: util-runmodes.c:322
SC_ATOMIC_INIT
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
Definition: util-atomic.h:315
PfringIfaceConfig_::cluster_id
int cluster_id
Definition: source-pfring.h:40
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
ConfGetChildValueBoolWithDefault
int ConfGetChildValueBoolWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, int *val)
Definition: conf.c:513
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:269
LiveGetOffload
int LiveGetOffload(void)
Definition: util-device.c:81
ConfGetNode
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
Definition: conf.c:181
PfringIfaceConfig_::bpf_filter
char * bpf_filter
Definition: source-pfring.h:47
SC_ATOMIC_ADD
#define SC_ATOMIC_ADD(name, val)
add a value to our atomic variable
Definition: util-atomic.h:333
StringParseUint16
int StringParseUint16(uint16_t *res, int base, size_t len, const char *str)
Definition: util-byte.c:337
RunModeInitialize
void RunModeInitialize(void)
Definition: runmodes.c:985
RunModeIdsPfringRegister
void RunModeIdsPfringRegister(void)
Definition: runmode-pfring.c:50
CHECKSUM_VALIDATION_RXONLY
@ CHECKSUM_VALIDATION_RXONLY
Definition: decode.h:48
util-runmodes.h
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:79
RunModeRegisterNewRunMode
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void), void(*RunModeIsIPSEnabled)(void))
Registers a new runmode.
Definition: runmodes.c:491
CHECKSUM_VALIDATION_DISABLE
@ CHECKSUM_VALIDATION_DISABLE
Definition: decode.h:45
StringParseInt32
int StringParseInt32(int32_t *res, int base, size_t len, const char *str)
Definition: util-byte.c:622
thread_name_single
const char * thread_name_single
Definition: runmodes.c:80
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:536
RunModeIdsPfringGetDefaultMode
const char * RunModeIdsPfringGetDefaultMode(void)
Definition: runmode-pfring.c:41
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
RunModeSetLiveCaptureAutoFp
int RunModeSetLiveCaptureAutoFp(ConfigIfaceParserFunc ConfigParser, ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name, const char *decode_mod_name, const char *thread_name, const char *live_dev)
Definition: util-runmodes.c:86
CHECKSUM_VALIDATION_ENABLE
@ CHECKSUM_VALIDATION_ENABLE
Definition: decode.h:46
ConfGet
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
Definition: conf.c:335
PfringIfaceConfig_::iface
char iface[PFRING_IFACE_NAME_LENGTH]
Definition: source-pfring.h:43
RunModeIdsPfringAutoFp
int RunModeIdsPfringAutoFp(void)
Definition: runmode-pfring.c:456
CHECKSUM_VALIDATION_AUTO
@ CHECKSUM_VALIDATION_AUTO
Definition: decode.h:47
util-device.h
util-debug.h
runmode-pfring.h
util-cpu.h
LiveGetDevice
LiveDevice * LiveGetDevice(const char *name)
Get a pointer to the device at idx.
Definition: util-device.c:242
GetIfaceRSSQueuesNum
int GetIfaceRSSQueuesNum(const char *dev)
Definition: util-ioctl.c:718
ConfFindDeviceConfig
ConfNode * ConfFindDeviceConfig(ConfNode *node, const char *iface)
Find the configuration node for a specific device.
Definition: util-conf.c:130
SCEnter
#define SCEnter(...)
Definition: util-debug.h:271
ConfGetChildValueWithDefault
int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, const char **vptr)
Definition: conf.c:376
util-time.h
SCLogWarning
#define SCLogWarning(...)
Macro used to log WARNING messages.
Definition: util-debug.h:249
source-pfring.h
SC_ATOMIC_SUB
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
Definition: util-atomic.h:342
PFRING_CONF_FLAGS_CLUSTER
#define PFRING_CONF_FLAGS_CLUSTER
Definition: source-pfring.h:32
conf.h
GetIfaceOffloading
int GetIfaceOffloading(const char *dev, int csum, int other)
output offloading status of the link
Definition: util-ioctl.c:675
DisableIfaceOffloading
int DisableIfaceOffloading(LiveDevice *dev, int csum, int other)
Definition: util-ioctl.c:688
PFRING_CONF_FLAGS_BYPASS
#define PFRING_CONF_FLAGS_BYPASS
Definition: source-pfring.h:33
runmodes.h
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:224
TimeModeSetLive
void TimeModeSetLive(void)
Definition: util-time.c:99
PfringIfaceConfig_::flags
uint32_t flags
Definition: source-pfring.h:37
util-conf.h
RUNMODE_PFRING
@ RUNMODE_PFRING
Definition: runmodes.h:31
CLUSTER_ROUND_ROBIN
#define CLUSTER_ROUND_ROBIN
Definition: source-pfring.h:74
suricata-common.h
SCLogPerf
#define SCLogPerf(...)
Definition: util-debug.h:230
PfringIfaceConfig_::DerefFunc
void(* DerefFunc)(void *)
Definition: source-pfring.h:51
SCStrdup
#define SCStrdup(s)
Definition: util-mem.h:56
FatalError
#define FatalError(...)
Definition: util-debug.h:502
SC_ATOMIC_RESET
#define SC_ATOMIC_RESET(name)
wrapper for reinitializing an atomic variable.
Definition: util-atomic.h:324
ConfigIfaceParserFunc
void *(* ConfigIfaceParserFunc)(const char *)
Definition: util-runmodes.h:26
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
SCLogConfig
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
PfringIfaceConfig_::threads
int threads
Definition: source-pfring.h:45
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:261
SCFree
#define SCFree(p)
Definition: util-mem.h:61
ConfNode_
Definition: conf.h:32
util-ioctl.h
ConfValIsFalse
int ConfValIsFalse(const char *val)
Check if a value is false.
Definition: conf.c:561
RunModeSetLiveCaptureSingle
int RunModeSetLiveCaptureSingle(ConfigIfaceParserFunc ConfigParser, ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name, const char *decode_mod_name, const char *thread_name, const char *live_dev)
Definition: util-runmodes.c:351
CLUSTER_FLOW
#define CLUSTER_FLOW
Definition: source-pfring.h:73
PFRING_CONF_V1
#define PFRING_CONF_V1
Definition: runmode-pfring.c:38
UtilCpuGetNumProcessorsOnline
uint16_t UtilCpuGetNumProcessorsOnline(void)
Get the number of cpus online in the system.
Definition: util-cpu.c:108
PfringIfaceConfig_::checksum_mode
ChecksumValidationMode checksum_mode
Definition: source-pfring.h:49
RunModeIdsPfringSingle
int RunModeIdsPfringSingle(void)
Definition: runmode-pfring.c:487
PFRING_CONF_V2
#define PFRING_CONF_V2
Definition: runmode-pfring.c:39
PfringIfaceConfig_::ctype
unsigned int ctype
Definition: source-pfring.h:41