suricata
runmode-netmap.c
Go to the documentation of this file.
1 /* Copyright (C) 2014-2021 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 * \ingroup netmap
20 *
21 * @{
22 */
23 
24 /**
25  * \file
26  *
27  * \author Aleksey Katargin <gureedo@gmail.com>
28  * \author Bill Meeks <billmeeks8@gmail.com>
29  *
30  * Netmap runmode
31  *
32  */
33 
34 #include "suricata-common.h"
35 #include "runmodes.h"
36 #include "runmode-netmap.h"
37 #include "util-runmodes.h"
38 #include "util-ioctl.h"
39 #include "util-byte.h"
40 
41 #ifdef HAVE_NETMAP
42 #define NETMAP_WITH_LIBS
43 #include <net/netmap_user.h>
44 #include "util-time.h"
45 #endif /* HAVE_NETMAP */
46 
47 #include "source-netmap.h"
48 
49 extern int max_pending_packets;
50 
51 const char *RunModeNetmapGetDefaultMode(void)
52 {
53  return "workers";
54 }
55 
57 {
59  "Single threaded netmap mode",
62  "Workers netmap mode, each thread does all"
63  " tasks from acquisition to logging",
66  "Multi-threaded netmap mode. Packets from "
67  "each flow are assigned to a single detect "
68  "thread.",
70  return;
71 }
72 
73 #ifdef HAVE_NETMAP
74 
75 static void NetmapDerefConfig(void *conf)
76 {
77  NetmapIfaceConfig *pfp = (NetmapIfaceConfig *)conf;
78  /* config is used only once but cost of this low. */
79  if (SC_ATOMIC_SUB(pfp->ref, 1) == 1) {
80  SCFree(pfp);
81  }
82 }
83 
84 static int ParseNetmapSettings(NetmapIfaceSettings *ns, const char *iface,
85  ConfNode *if_root, ConfNode *if_default)
86 {
87  ns->threads = 0;
88  ns->promisc = true;
91  strlcpy(ns->iface, iface, sizeof(ns->iface));
92 
93  if (ns->iface[0]) {
94  size_t len = strlen(ns->iface);
95  if (ns->iface[len-1] == '+') {
97  "netmap interface %s uses obsolete '+' notation. "
98  "Using '^' instead.", ns->iface);
99  ns->iface[len-1] = '^';
100  ns->sw_ring = true;
101  } else if (ns->iface[len-1] == '^') {
102  ns->sw_ring = true;
103  }
104  }
105 
106  /* we will need the base interface name for later */
107  char base_name[IFNAMSIZ];
108  strlcpy(base_name, ns->iface, sizeof(base_name));
109  if (strlen(base_name) > 0 &&
110  (base_name[strlen(base_name) - 1] == '^' || base_name[strlen(base_name) - 1] == '*')) {
111  base_name[strlen(base_name) - 1] = '\0';
112  }
113 
114  /* prefixed with netmap or vale means it's not a real interface
115  * and we don't check offloading. */
116  if (strncmp(ns->iface, "netmap:", 7) != 0 &&
117  strncmp(ns->iface, "vale", 4) != 0) {
118  ns->real = true;
119  }
120 
121  const char *bpf_filter = NULL;
122  if (ConfGet("bpf-filter", &bpf_filter) == 1) {
123  if (strlen(bpf_filter) > 0) {
124  ns->bpf_filter = bpf_filter;
125  SCLogInfo("Going to use command-line provided bpf filter '%s'",
126  ns->bpf_filter);
127  }
128  }
129 
130  if (if_root == NULL && if_default == NULL) {
131  SCLogInfo("Unable to find netmap config for "
132  "interface \"%s\" or \"default\", using default values",
133  iface);
134  goto finalize;
135 
136  /* If there is no setting for current interface use default one as main iface */
137  } else if (if_root == NULL) {
138  if_root = if_default;
139  if_default = NULL;
140  }
141 
142  const char *threadsstr = NULL;
143  if (ConfGetChildValueWithDefault(if_root, if_default, "threads", &threadsstr) != 1) {
144  ns->threads = 0;
145  ns->threads_auto = true;
146  } else {
147  if (strcmp(threadsstr, "auto") == 0) {
148  ns->threads = 0;
149  ns->threads_auto = true;
150  } else {
151  if (StringParseUint16(&ns->threads, 10, 0, threadsstr) < 0) {
152  SCLogWarning(SC_ERR_INVALID_VALUE, "Invalid config value for "
153  "threads: %s, resetting to 0", threadsstr);
154  ns->threads = 0;
155  }
156  }
157  }
158 
159  /* load netmap bpf filter */
160  /* command line value has precedence */
161  if (ns->bpf_filter == NULL) {
162  if (ConfGetChildValueWithDefault(if_root, if_default, "bpf-filter", &bpf_filter) == 1) {
163  if (strlen(bpf_filter) > 0) {
164  ns->bpf_filter = bpf_filter;
165  SCLogInfo("Going to use bpf filter %s", ns->bpf_filter);
166  }
167  }
168  }
169 
170  int boolval = 0;
171  (void)ConfGetChildValueBoolWithDefault(if_root, if_default, "disable-promisc", (int *)&boolval);
172  if (boolval) {
173  SCLogInfo("Disabling promiscuous mode on iface %s", ns->iface);
174  ns->promisc = false;
175  }
176 
177  const char *tmpctype;
178  if (ConfGetChildValueWithDefault(if_root, if_default,
179  "checksum-checks", &tmpctype) == 1)
180  {
181  if (strcmp(tmpctype, "auto") == 0) {
183  } else if (ConfValIsTrue(tmpctype)) {
185  } else if (ConfValIsFalse(tmpctype)) {
187  } else {
188  SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid value for "
189  "checksum-checks for %s", iface);
190  }
191  }
192 
193  const char *copymodestr;
194  if (ConfGetChildValueWithDefault(if_root, if_default,
195  "copy-mode", &copymodestr) == 1)
196  {
197  if (strcmp(copymodestr, "ips") == 0) {
199  } else if (strcmp(copymodestr, "tap") == 0) {
201  } else {
202  SCLogWarning(SC_ERR_INVALID_ARGUMENT, "Invalid copy-mode "
203  "(valid are tap, ips)");
204  }
205  }
206 
207 finalize:
208 
209  ns->ips = (ns->copy_mode != NETMAP_COPY_MODE_NONE);
210 
211  if (ns->threads_auto) {
212  /* As NetmapGetRSSCount used to be broken on Linux,
213  * fall back to GetIfaceRSSQueuesNum if needed. */
214  ns->threads = NetmapGetRSSCount(ns->iface);
215  if (ns->threads == 0) {
216  /* need to use base_name of interface here */
217  ns->threads = GetIfaceRSSQueuesNum(base_name);
218  }
219  }
220  if (ns->threads <= 0) {
221  ns->threads = 1;
222  }
223 
224  return 0;
225 }
226 
227 /**
228  * \brief extract information from config file
229  *
230  * The returned structure will be freed by the thread init function.
231  * This is thus necessary to copy the structure before giving it
232  * to thread or to reparse the file for each thread (and thus have
233  * new structure.
234  *
235  * \return a NetmapIfaceConfig corresponding to the interface name
236  */
237 static void *ParseNetmapConfig(const char *iface_name)
238 {
239  ConfNode *if_root = NULL;
240  ConfNode *if_default = NULL;
241  const char *out_iface = NULL;
242 
243  if (iface_name == NULL) {
244  return NULL;
245  }
246 
247  NetmapIfaceConfig *aconf = SCCalloc(1, sizeof(*aconf));
248  if (unlikely(aconf == NULL)) {
249  return NULL;
250  }
251 
252  aconf->DerefFunc = NetmapDerefConfig;
253  strlcpy(aconf->iface_name, iface_name, sizeof(aconf->iface_name));
254  SC_ATOMIC_INIT(aconf->ref);
255  (void) SC_ATOMIC_ADD(aconf->ref, 1);
256 
257  /* Find initial node */
258  ConfNode *netmap_node = ConfGetNode("netmap");
259  if (netmap_node == NULL) {
260  SCLogInfo("Unable to find netmap config using default value");
261  } else {
262  if_root = ConfFindDeviceConfig(netmap_node, aconf->iface_name);
263  if_default = ConfFindDeviceConfig(netmap_node, "default");
264  }
265 
266  /* parse settings for capture iface */
267  ParseNetmapSettings(&aconf->in, aconf->iface_name, if_root, if_default);
268 
269  /* if we have a copy iface, parse that as well */
270  if (netmap_node != NULL &&
271  ConfGetChildValueWithDefault(if_root, if_default, "copy-iface", &out_iface) == 1)
272  {
273  if (strlen(out_iface) > 0) {
274  if_root = ConfFindDeviceConfig(netmap_node, out_iface);
275  ParseNetmapSettings(&aconf->out, out_iface, if_root, if_default);
276  }
277  }
278 
279  int ring_count = NetmapGetRSSCount(aconf->iface_name);
280  if (strlen(aconf->iface_name) > 0 &&
281  (aconf->iface_name[strlen(aconf->iface_name) - 1] == '^' ||
282  aconf->iface_name[strlen(aconf->iface_name) - 1] == '*')) {
283  SCLogDebug("%s -- using %d netmap host ring pair%s", aconf->iface_name, ring_count,
284  ring_count == 1 ? "" : "s");
285  } else {
286  SCLogDebug("%s -- using %d netmap ring pair%s", aconf->iface_name, ring_count,
287  ring_count == 1 ? "" : "s");
288  }
289 
290  for (int i = 0; i < ring_count; i++) {
291  char live_buf[32] = { 0 };
292  snprintf(live_buf, sizeof(live_buf), "netmap%d", i);
293  LiveRegisterDevice(live_buf);
294  }
295 
296  /* netmap needs all offloading to be disabled */
297  if (aconf->in.real) {
298  char base_name[sizeof(aconf->in.iface)];
299  strlcpy(base_name, aconf->in.iface, sizeof(base_name));
300  /* for a sw_ring enabled device name, strip the trailing char */
301  if (aconf->in.sw_ring) {
302  base_name[strlen(base_name) - 1] = '\0';
303  }
304 
305  if (LiveGetOffload() == 0) {
306  (void)GetIfaceOffloading(base_name, 1, 1);
307  } else {
308  DisableIfaceOffloading(LiveGetDevice(base_name), 1, 1);
309  }
310  }
311 
312  SC_ATOMIC_RESET(aconf->ref);
313  (void) SC_ATOMIC_ADD(aconf->ref, aconf->in.threads);
314  SCLogPerf("Using %d threads for interface %s", aconf->in.threads,
315  aconf->iface_name);
316 
318  return aconf;
319 }
320 
321 static int NetmapConfigGeThreadsCount(void *conf)
322 {
323  NetmapIfaceConfig *aconf = (NetmapIfaceConfig *)conf;
324  return aconf->in.threads;
325 }
326 
327 int NetmapRunModeIsIPS()
328 {
329  int nlive = LiveGetDeviceCount();
330  int ldev;
331  ConfNode *if_root;
332  ConfNode *if_default = NULL;
333  ConfNode *netmap_node;
334  int has_ips = 0;
335  int has_ids = 0;
336 
337  /* Find initial node */
338  netmap_node = ConfGetNode("netmap");
339  if (netmap_node == NULL) {
340  return 0;
341  }
342 
343  if_default = ConfNodeLookupKeyValue(netmap_node, "interface", "default");
344 
345  for (ldev = 0; ldev < nlive; ldev++) {
346  const char *live_dev = LiveGetDeviceName(ldev);
347  if (live_dev == NULL) {
348  SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
349  return 0;
350  }
351  const char *copymodestr = NULL;
352  if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
353 
354  if (if_root == NULL) {
355  if (if_default == NULL) {
356  SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
357  return 0;
358  }
359  if_root = if_default;
360  }
361 
362  if (ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) {
363  if (strcmp(copymodestr, "ips") == 0) {
364  has_ips = 1;
365  } else {
366  has_ids = 1;
367  }
368  } else {
369  has_ids = 1;
370  }
371  }
372 
373  if (has_ids && has_ips) {
374  SCLogInfo("Netmap mode using IPS and IDS mode");
375  for (ldev = 0; ldev < nlive; ldev++) {
376  const char *live_dev = LiveGetDeviceName(ldev);
377  if (live_dev == NULL) {
378  SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
379  return 0;
380  }
381  if_root = ConfNodeLookupKeyValue(netmap_node, "interface", live_dev);
382  const char *copymodestr = NULL;
383 
384  if (if_root == NULL) {
385  if (if_default == NULL) {
386  SCLogError(SC_ERR_INVALID_VALUE, "Problem with config file");
387  return 0;
388  }
389  if_root = if_default;
390  }
391 
392  if (! ((ConfGetChildValueWithDefault(if_root, if_default, "copy-mode", &copymodestr) == 1) &&
393  (strcmp(copymodestr, "ips") == 0))) {
395  "Netmap IPS mode used and interface '%s' is in IDS or TAP mode. "
396  "Sniffing '%s' but expect bad result as stream-inline is activated.",
397  live_dev, live_dev);
398  }
399  }
400  }
401 
402  return has_ips;
403 }
404 
405 typedef enum { NETMAP_AUTOFP, NETMAP_WORKERS, NETMAP_SINGLE } NetmapRunMode_t;
406 
407 static int NetmapRunModeInit(NetmapRunMode_t runmode)
408 {
409  SCEnter();
410 
412  TimeModeSetLive();
413 
414  const char *live_dev = NULL;
415  (void)ConfGet("netmap.live-interface", &live_dev);
416 
417  int ret;
418  switch (runmode) {
419  case NETMAP_AUTOFP:
420  ret = RunModeSetLiveCaptureAutoFp(ParseNetmapConfig, NetmapConfigGeThreadsCount,
421  "ReceiveNetmap", "DecodeNetmap", thread_name_autofp, live_dev);
422  break;
423  case NETMAP_WORKERS:
424  ret = RunModeSetLiveCaptureWorkers(ParseNetmapConfig, NetmapConfigGeThreadsCount,
425  "ReceiveNetmap", "DecodeNetmap", thread_name_workers, live_dev);
426  break;
427  case NETMAP_SINGLE:
428  ret = RunModeSetLiveCaptureSingle(ParseNetmapConfig, NetmapConfigGeThreadsCount,
429  "ReceiveNetmap", "DecodeNetmap", thread_name_single, live_dev);
430  break;
431  }
432  if (ret != 0) {
433  FatalError(SC_ERR_FATAL, "Unable to start runmode %s",
434  runmode == NETMAP_AUTOFP ? "autofp"
435  : runmode == NETMAP_WORKERS ? "workers" : "single");
436  }
437 
438  SCLogDebug("%s initialized",
439  runmode == NETMAP_AUTOFP ? "autofp" : runmode == NETMAP_WORKERS ? "workers" : "single");
440 
441  SCReturnInt(0);
442 }
443 
444 int RunModeIdsNetmapAutoFp(void)
445 {
446  return NetmapRunModeInit(NETMAP_AUTOFP);
447 }
448 
449 /**
450 * \brief Single thread version of the netmap processing.
451 */
452 int RunModeIdsNetmapSingle(void)
453 {
454  return NetmapRunModeInit(NETMAP_SINGLE);
455 }
456 
457 /**
458  * \brief Workers version of the netmap processing.
459  *
460  * Start N threads with each thread doing all the work.
461  *
462  */
463 int RunModeIdsNetmapWorkers(void)
464 {
465  return NetmapRunModeInit(NETMAP_WORKERS);
466 }
467 #else
469 {
470  SCEnter();
471  FatalError(SC_ERR_FATAL, "Netmap not configured");
472  SCReturnInt(0);
473 }
474 
475 /**
476  * \brief Single thread version of the netmap processing.
477  */
479 {
480  SCEnter();
481  FatalError(SC_ERR_FATAL, "Netmap not configured");
482  SCReturnInt(0);
483 }
484 
485 /**
486 * \brief Workers version of the netmap processing.
487 *
488 * Start N threads with each thread doing all the work.
489 *
490 */
492 {
493  SCEnter();
494  FatalError(SC_ERR_FATAL, "Netmap not configured");
495  SCReturnInt(0);
496 }
497 #endif // #ifdef HAVE_NETMAP
498 
499 /**
500 * @}
501 */
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:80
RunModeIdsNetmapSingle
int RunModeIdsNetmapSingle(void)
Single thread version of the netmap processing.
Definition: runmode-netmap.c:478
util-byte.h
len
uint8_t len
Definition: app-layer-dnp3.h:2
LiveRegisterDevice
int LiveRegisterDevice(const char *dev)
Add a pcap device for monitoring and create structure.
Definition: util-device.c:125
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:330
SC_ERR_INVALID_VALUE
@ SC_ERR_INVALID_VALUE
Definition: util-error.h:160
GetIfaceRSSQueuesNum
int GetIfaceRSSQueuesNum(const char *pcap_dev)
Definition: util-ioctl.c:738
SC_ATOMIC_INIT
#define SC_ATOMIC_INIT(name)
wrapper for initializing an atomic variable.
Definition: util-atomic.h:315
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
NetmapIfaceSettings_::checksum_mode
ChecksumValidationMode checksum_mode
Definition: source-netmap.h:51
ConfGetChildValueBoolWithDefault
int ConfGetChildValueBoolWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, int *val)
Definition: conf.c:498
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:296
LiveGetOffload
int LiveGetOffload(void)
Definition: util-device.c:80
ConfGetNode
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
Definition: conf.c:175
LiveDeviceHasNoStats
void LiveDeviceHasNoStats()
Definition: util-device.c:343
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:336
RunModeInitialize
void RunModeInitialize(void)
Definition: runmodes.c:946
util-runmodes.h
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:78
NetmapIfaceConfig_::out
NetmapIfaceSettings out
Definition: source-netmap.h:64
ConfNodeLookupKeyValue
ConfNode * ConfNodeLookupKeyValue(const ConfNode *base, const char *key, const char *value)
Lookup for a key value under a specific node.
Definition: conf.c:815
CHECKSUM_VALIDATION_DISABLE
@ CHECKSUM_VALIDATION_DISABLE
Definition: decode.h:46
NetmapIfaceSettings_::iface
char iface[NETMAP_IFACE_NAME_LENGTH]
Definition: source-netmap.h:40
thread_name_single
const char * thread_name_single
Definition: runmodes.c:79
NetmapIfaceSettings_::ips
bool ips
Definition: source-netmap.h:46
NETMAP_COPY_MODE_NONE
@ NETMAP_COPY_MODE_NONE
Definition: source-netmap.h:30
RUNMODE_NETMAP
@ RUNMODE_NETMAP
Definition: runmodes.h:38
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:521
RunModeIdsNetmapWorkers
int RunModeIdsNetmapWorkers(void)
Workers version of the netmap processing.
Definition: runmode-netmap.c:491
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:87
NetmapGetRSSCount
int NetmapGetRSSCount(const char *ifname)
CHECKSUM_VALIDATION_ENABLE
@ CHECKSUM_VALIDATION_ENABLE
Definition: decode.h:47
ConfGet
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
Definition: conf.c:330
CHECKSUM_VALIDATION_AUTO
@ CHECKSUM_VALIDATION_AUTO
Definition: decode.h:48
NETMAP_COPY_MODE_TAP
@ NETMAP_COPY_MODE_TAP
Definition: source-netmap.h:31
NetmapIfaceConfig_::DerefFunc
void(* DerefFunc)(void *)
Definition: source-netmap.h:67
NetmapIfaceSettings_::real
bool real
Definition: source-netmap.h:45
NetmapIfaceSettings_::sw_ring
bool sw_ring
Definition: source-netmap.h:43
LiveGetDevice
LiveDevice * LiveGetDevice(const char *name)
Get a pointer to the device at idx.
Definition: util-device.c:279
ConfFindDeviceConfig
ConfNode * ConfFindDeviceConfig(ConfNode *node, const char *iface)
Find the configuration node for a specific device.
Definition: util-conf.c:129
SCEnter
#define SCEnter(...)
Definition: util-debug.h:298
ConfGetChildValueWithDefault
int ConfGetChildValueWithDefault(const ConfNode *base, const ConfNode *dflt, const char *name, const char **vptr)
Definition: conf.c:371
util-time.h
SC_ERR_INVALID_ARGUMENT
@ SC_ERR_INVALID_ARGUMENT
Definition: util-error.h:43
NetmapIfaceSettings_
Definition: source-netmap.h:38
runmode-netmap.h
NetmapIfaceSettings_::threads
uint16_t threads
Definition: source-netmap.h:49
SC_ATOMIC_SUB
#define SC_ATOMIC_SUB(name, val)
sub a value from our atomic variable
Definition: util-atomic.h:342
source-netmap.h
NetmapIfaceSettings_::promisc
bool promisc
Definition: source-netmap.h:44
GetIfaceOffloading
int GetIfaceOffloading(const char *dev, int csum, int other)
output offloading status of the link
Definition: util-ioctl.c:695
DisableIfaceOffloading
int DisableIfaceOffloading(LiveDevice *dev, int csum, int other)
Definition: util-ioctl.c:708
NetmapIfaceSettings_::threads_auto
bool threads_auto
Definition: source-netmap.h:47
runmodes.h
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:215
TimeModeSetLive
void TimeModeSetLive(void)
Definition: util-time.c:99
max_pending_packets
int max_pending_packets
Definition: suricata.c:220
NetmapIfaceSettings_::bpf_filter
const char * bpf_filter
Definition: source-netmap.h:52
NetmapIfaceConfig_
Definition: source-netmap.h:56
suricata-common.h
RunModeRegisterNewRunMode
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void))
Registers a new runmode.
Definition: runmodes.c:460
LiveGetDeviceName
const char * LiveGetDeviceName(int number)
Get a pointer to the device name at idx.
Definition: util-device.c:177
SCLogPerf
#define SCLogPerf(...)
Definition: util-debug.h:222
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:255
FatalError
#define FatalError(x,...)
Definition: util-debug.h:530
SC_ATOMIC_RESET
#define SC_ATOMIC_RESET(name)
wrapper for reinitializing an atomic variable.
Definition: util-atomic.h:324
NETMAP_COPY_MODE_IPS
@ NETMAP_COPY_MODE_IPS
Definition: source-netmap.h:32
RunModeNetmapGetDefaultMode
const char * RunModeNetmapGetDefaultMode(void)
Definition: runmode-netmap.c:51
SCLogWarning
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
Definition: util-debug.h:242
SCFree
#define SCFree(p)
Definition: util-mem.h:61
RunModeIdsNetmapRegister
void RunModeIdsNetmapRegister(void)
Definition: runmode-netmap.c:56
NetmapIfaceConfig_::iface_name
char iface_name[NETMAP_IFACE_NAME_LENGTH]
Definition: source-netmap.h:58
ConfNode_
Definition: conf.h:32
NetmapIfaceSettings_::copy_mode
int copy_mode
Definition: source-netmap.h:50
SC_ERR_FATAL
@ SC_ERR_FATAL
Definition: util-error.h:203
util-ioctl.h
ConfValIsFalse
int ConfValIsFalse(const char *val)
Check if a value is false.
Definition: conf.c:546
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:364
SC_WARN_OPTION_OBSOLETE
@ SC_WARN_OPTION_OBSOLETE
Definition: util-error.h:265
NetmapIfaceConfig_::in
NetmapIfaceSettings in
Definition: source-netmap.h:61
RunModeIdsNetmapAutoFp
int RunModeIdsNetmapAutoFp(void)
Definition: runmode-netmap.c:468
LiveGetDeviceCount
int LiveGetDeviceCount(void)
Get the number of registered devices.
Definition: util-device.c:157
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
SCReturnInt
#define SCReturnInt(x)
Definition: util-debug.h:302
NetmapRunModeIsIPS
int NetmapRunModeIsIPS(void)