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