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