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