suricata
util-runmodes.c
Go to the documentation of this file.
1 /* Copyright (C) 2011-2025 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  * \file
20  *
21  * \author Eric Leblond <eric@regit.org>
22  *
23  * Helper function for runmode.
24  *
25  */
26 
27 #include "suricata-common.h"
28 #include "tm-threads.h"
29 #include "conf.h"
30 #include "runmodes.h"
31 #include "runmode-af-packet.h"
32 #include "output.h"
33 #include "log-httplog.h"
34 
35 #include "detect-engine.h"
36 #include "detect-engine-mpm.h"
37 
38 #include "alert-fastlog.h"
39 #include "alert-debuglog.h"
40 
41 #include "util-debug.h"
42 #include "util-time.h"
43 #include "util-cpu.h"
44 #include "util-affinity.h"
45 #include "util-device-private.h"
46 
47 #include "util-runmodes.h"
48 
49 #include "flow-hash.h"
50 
51 #define THREADS_MAX (uint16_t)1024
52 
53 /** \brief create a queue string for autofp to pass to
54  * the flow queue handler.
55  *
56  * The string will be "pickup1,pickup2,pickup3\0"
57  */
59 {
60  if (n > 1024)
61  return NULL;
62 
63  /* 13 because pickup12345, = 12 + \0 */
64  size_t queues_size = n * 13;
65  char qname[TM_QUEUE_NAME_MAX];
66 
67  char *queues = SCCalloc(1, queues_size);
68  if (unlikely(queues == NULL)) {
69  SCLogError("failed to alloc queues buffer: %s", strerror(errno));
70  return NULL;
71  }
72 
73  for (int thread = 0; thread < n; thread++) {
74  if (strlen(queues) > 0)
75  strlcat(queues, ",", queues_size);
76 
77  snprintf(qname, sizeof(qname), "pickup%d", (int16_t)thread+1);
78  strlcat(queues, qname, queues_size);
79  }
80 
81  SCLogDebug("%d %"PRIuMAX", queues %s", n, (uintmax_t)queues_size, queues);
82  return queues;
83 }
84 
85 /**
86  */
88  ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name,
89  const char *decode_mod_name, const char *thread_name, const char *live_dev)
90 {
91  char tname[TM_THREAD_NAME_MAX];
92  char qname[TM_QUEUE_NAME_MAX];
93 
94  /* Available cpus */
95  int nlive = LiveGetDeviceCount();
96  uint16_t thread_max = TmThreadsGetWorkerThreadMax();
97 
98  char *queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
99  if (queues == NULL) {
100  FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
101  }
102 
103  if ((nlive <= 1) && (live_dev != NULL)) {
104  SCLogDebug("live_dev %s", live_dev);
105 
106  void *aconf = ConfigParser(live_dev);
107  if (aconf == NULL) {
108  FatalError("Failed to allocate config for %s", live_dev);
109  }
110 
111  const uint16_t threads_count = MIN(ModThreadsCount(aconf), THREADS_MAX);
112  SCLogInfo("Going to use %" PRIu16 " %s receive thread(s)", threads_count, recv_mod_name);
113 
114  /* create the threads */
115  for (uint16_t thread = 0; thread < threads_count; thread++) {
116  const uint16_t thread_id = (uint16_t)(thread + 1);
117  snprintf(tname, sizeof(tname), "%s#%02u", thread_name, thread_id);
118  ThreadVars *tv_receive =
120  "packetpool", "packetpool",
121  queues, "flow", "pktacqloop");
122  if (tv_receive == NULL) {
123  FatalError("TmThreadsCreate failed");
124  }
125  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
126  if (tm_module == NULL) {
127  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
128  }
129  TmSlotSetFuncAppend(tv_receive, tm_module, aconf);
130 
131  tm_module = TmModuleGetByName(decode_mod_name);
132  if (tm_module == NULL) {
133  FatalError("TmModuleGetByName %s failed", decode_mod_name);
134  }
135  TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
136 
137  TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
138 
139  if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
140  FatalError("TmThreadSpawn failed");
141  }
142  }
143  } else { /* Multiple input device */
144  SCLogInfo("Using %d live device(s).", nlive);
145 
146  for (int lthread = 0; lthread < nlive; lthread++) {
147  const char *dev = LiveGetDeviceName(lthread);
148  const char *visual_devname = LiveGetShortName(dev);
149 
150  if (dev == NULL) {
151  FatalError("Failed to lookup live dev %d", lthread);
152  }
153  SCLogDebug("dev %s", dev);
154 
155  void *aconf = ConfigParser(dev);
156  if (aconf == NULL) {
157  FatalError("Multidev: Failed to allocate config for %s (%d)", dev, lthread);
158  }
159 
160  const uint16_t threads_count = MIN(ModThreadsCount(aconf), THREADS_MAX);
161  for (uint16_t thread = 0; thread < threads_count; thread++) {
162  const uint16_t thread_id = (uint16_t)(thread + 1);
163  const size_t printable_threadname_size = strlen(thread_name) + 5 + strlen(dev) + 1;
164  char *printable_threadname = SCMalloc(printable_threadname_size);
165  if (unlikely(printable_threadname == NULL)) {
166  FatalError("failed to alloc printable thread name: %s", strerror(errno));
167  }
168  snprintf(
169  tname, sizeof(tname), "%s#%02u-%s", thread_name, thread_id, visual_devname);
170  snprintf(printable_threadname, printable_threadname_size, "%s#%02u-%s", thread_name,
171  thread_id, dev);
172 
173  ThreadVars *tv_receive =
175  "packetpool", "packetpool",
176  queues, "flow", "pktacqloop");
177  if (tv_receive == NULL) {
178  FatalError("TmThreadsCreate failed");
179  }
180  tv_receive->printable_name = printable_threadname;
181  tv_receive->iface_name = SCStrdup(dev);
182  if (tv_receive->iface_name == NULL) {
183  FatalError("Failed to allocate memory for iface name");
184  }
185 
186  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
187  if (tm_module == NULL) {
188  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
189  }
190  TmSlotSetFuncAppend(tv_receive, tm_module, aconf);
191 
192  tm_module = TmModuleGetByName(decode_mod_name);
193  if (tm_module == NULL) {
194  FatalError("TmModuleGetByName %s failed", decode_mod_name);
195  }
196  TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
197 
198  TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
199 
200  if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
201  FatalError("TmThreadSpawn failed");
202  }
203  }
204  }
205  }
206 
207  for (uint16_t thread = 0; thread < thread_max; thread++) {
208  const uint16_t thread_id = (uint16_t)(thread + 1);
209  snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread_id);
210  snprintf(qname, sizeof(qname), "pickup%u", thread_id);
211  SCLogDebug("tname %s, qname %s", tname, qname);
212 
213  ThreadVars *tv_detect_ncpu =
215  qname, "flow",
216  "packetpool", "packetpool",
217  "varslot");
218  if (tv_detect_ncpu == NULL) {
219  FatalError("TmThreadsCreate failed");
220  }
221  TmModule *tm_module = TmModuleGetByName("FlowWorker");
222  if (tm_module == NULL) {
223  FatalError("TmModuleGetByName for FlowWorker failed");
224  }
225  TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
226 
227  TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
228 
229  TmThreadSetGroupName(tv_detect_ncpu, "Detect");
230 
231  tm_module = TmModuleGetByName("RespondReject");
232  if (tm_module == NULL) {
233  FatalError("TmModuleGetByName RespondReject failed");
234  }
235  TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
236 
237  if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
238  FatalError("TmThreadSpawn failed");
239  }
240  }
241 
242  SCFree(queues);
243  return 0;
244 }
245 
246 /**
247  */
248 static int RunModeSetLiveCaptureWorkersForDevice(ConfigIfaceThreadsCountFunc ModThreadsCount,
249  const char *recv_mod_name,
250  const char *decode_mod_name, const char *thread_name,
251  const char *live_dev, void *aconf,
252  unsigned char single_mode)
253 {
254  uint16_t threads_count;
255  const uint16_t thread_max = TmThreadsGetWorkerThreadMax();
256 
257  if (single_mode) {
258  threads_count = 1;
259  } else {
260  threads_count = MIN(ModThreadsCount(aconf), thread_max);
261  SCLogInfo("%s: creating %" PRIu16 " thread%s", live_dev, threads_count,
262  threads_count > 1 ? "s" : "");
263  }
264 
265  /* create the threads */
266  for (uint16_t thread = 0; thread < threads_count; thread++) {
267  const uint16_t thread_id = (uint16_t)(thread + 1);
268  const char *visual_devname = LiveGetShortName(live_dev);
269  const size_t printable_threadname_size = strlen(thread_name) + 5 + strlen(live_dev) + 1;
270  char *printable_threadname = SCMalloc(printable_threadname_size);
271  if (unlikely(printable_threadname == NULL)) {
272  FatalError("failed to alloc printable thread name: %s", strerror(errno));
273  exit(EXIT_FAILURE);
274  }
275 
276  char tname[TM_THREAD_NAME_MAX];
277  if (single_mode) {
278  snprintf(tname, sizeof(tname), "%s#01-%s", thread_name, visual_devname);
279  snprintf(printable_threadname, printable_threadname_size, "%s#01-%s", thread_name,
280  live_dev);
281  } else {
282  snprintf(tname, sizeof(tname), "%s#%02u-%s", thread_name, thread_id, visual_devname);
283  snprintf(printable_threadname, printable_threadname_size, "%s#%02u-%s", thread_name,
284  thread_id, live_dev);
285  }
287  "packetpool", "packetpool",
288  "packetpool", "packetpool",
289  "pktacqloop");
290  if (tv == NULL) {
291  FatalError("TmThreadsCreate failed");
292  }
293  tv->printable_name = printable_threadname;
294  tv->iface_name = SCStrdup(live_dev);
295  if (tv->iface_name == NULL) {
296  FatalError("Failed to allocate memory for iface name");
297  }
298 
299  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
300  if (tm_module == NULL) {
301  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
302  }
303  TmSlotSetFuncAppend(tv, tm_module, aconf);
304 
305  tm_module = TmModuleGetByName(decode_mod_name);
306  if (tm_module == NULL) {
307  FatalError("TmModuleGetByName %s failed", decode_mod_name);
308  }
309  TmSlotSetFuncAppend(tv, tm_module, NULL);
310 
311  tm_module = TmModuleGetByName("FlowWorker");
312  if (tm_module == NULL) {
313  FatalError("TmModuleGetByName for FlowWorker failed");
314  }
315  TmSlotSetFuncAppend(tv, tm_module, NULL);
316 
317  tm_module = TmModuleGetByName("RespondReject");
318  if (tm_module == NULL) {
319  FatalError("TmModuleGetByName RespondReject failed");
320  }
321  TmSlotSetFuncAppend(tv, tm_module, NULL);
322 
324 
325  if (TmThreadSpawn(tv) != TM_ECODE_OK) {
326  FatalError("TmThreadSpawn failed");
327  }
328  }
329 
330  return 0;
331 }
332 
334  ConfigIfaceThreadsCountFunc ModThreadsCount, const char *recv_mod_name,
335  const char *decode_mod_name, const char *thread_name, const char *live_dev)
336 {
337  const int nlive = LiveGetDeviceCount();
338 
339  for (int ldev = 0; ldev < nlive; ldev++) {
340  const char *live_dev_c = NULL;
341  void *aconf;
342 
343  if ((nlive <= 1) && (live_dev != NULL)) {
344  aconf = ConfigParser(live_dev);
345  live_dev_c = live_dev;
346  } else {
347  live_dev_c = LiveGetDeviceName(ldev);
348  aconf = ConfigParser(live_dev_c);
349  }
350  RunModeSetLiveCaptureWorkersForDevice(
351  ModThreadsCount, recv_mod_name, decode_mod_name, thread_name, live_dev_c, aconf, 0);
352  }
353 
354  return 0;
355 }
356 
358  ConfigIfaceThreadsCountFunc ModThreadsCount,
359  const char *recv_mod_name,
360  const char *decode_mod_name, const char *thread_name,
361  const char *live_dev)
362 {
363  const int nlive = LiveGetDeviceCount();
364  const char *live_dev_c = NULL;
365  void *aconf;
366 
367  if (nlive > 1) {
368  FatalError("Can't use the 'single' runmode with multiple devices");
369  }
370 
371  if (live_dev != NULL) {
372  aconf = ConfigParser(live_dev);
373  live_dev_c = live_dev;
374  } else {
375  live_dev_c = LiveGetDeviceName(0);
376  aconf = ConfigParser(live_dev_c);
377  }
378 
379  return RunModeSetLiveCaptureWorkersForDevice(
380  ModThreadsCount, recv_mod_name, decode_mod_name, thread_name, live_dev_c, aconf, 1);
381 }
382 
383 
384 /**
385  */
387  const char *recv_mod_name,
388  const char *verdict_mod_name,
389  const char *decode_mod_name)
390 {
391  SCEnter();
392  char tname[TM_THREAD_NAME_MAX];
393  TmModule *tm_module ;
394 
395  const int nqueue = LiveGetDeviceCount();
396  const uint16_t thread_max = TmThreadsGetWorkerThreadMax();
397 
398  char *queues = RunmodeAutoFpCreatePickupQueuesString(thread_max);
399  if (queues == NULL) {
400  FatalError("RunmodeAutoFpCreatePickupQueuesString failed");
401  }
402 
403  /* create the threads */
404  for (int i = 0; i < nqueue; i++) {
405  const char *cur_queue = LiveGetDeviceName(i);
406  if (cur_queue == NULL) {
407  FatalError("invalid queue number");
408  }
409  memset(tname, 0, sizeof(tname));
410  snprintf(tname, sizeof(tname), "%s-%s", thread_name_autofp, cur_queue);
411 
412  ThreadVars *tv_receive =
414  "packetpool", "packetpool",
415  queues, "flow", "pktacqloop");
416  if (tv_receive == NULL) {
417  FatalError("TmThreadsCreate failed");
418  }
419  tm_module = TmModuleGetByName(recv_mod_name);
420  if (tm_module == NULL) {
421  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
422  }
423  TmSlotSetFuncAppend(tv_receive, tm_module, (void *) ConfigParser(i));
424 
425  tm_module = TmModuleGetByName(decode_mod_name);
426  if (tm_module == NULL) {
427  FatalError("TmModuleGetByName %s failed", decode_mod_name);
428  }
429  TmSlotSetFuncAppend(tv_receive, tm_module, NULL);
430 
431  TmThreadSetCPU(tv_receive, RECEIVE_CPU_SET);
432 
433  if (TmThreadSpawn(tv_receive) != TM_ECODE_OK) {
434  FatalError("TmThreadSpawn failed");
435  }
436 
437  }
438  for (uint16_t thread = 0; thread < thread_max; thread++) {
439  const uint16_t thread_id = (uint16_t)(thread + 1);
440  snprintf(tname, sizeof(tname), "%s#%02u", thread_name_workers, thread_id);
441  char qname[TM_QUEUE_NAME_MAX];
442  snprintf(qname, sizeof(qname), "pickup%u", thread_id);
443  SCLogDebug("tname %s, qname %s", tname, qname);
444 
445  ThreadVars *tv_detect_ncpu =
447  qname, "flow",
448  "verdict-queue", "simple",
449  "varslot");
450  if (tv_detect_ncpu == NULL) {
451  FatalError("TmThreadsCreate failed");
452  }
453 
454  tm_module = TmModuleGetByName("FlowWorker");
455  if (tm_module == NULL) {
456  FatalError("TmModuleGetByName for FlowWorker failed");
457  }
458  TmSlotSetFuncAppend(tv_detect_ncpu, tm_module, NULL);
459 
460  TmThreadSetCPU(tv_detect_ncpu, WORKER_CPU_SET);
461 
462  TmThreadSetGroupName(tv_detect_ncpu, "Detect");
463 
464  if (TmThreadSpawn(tv_detect_ncpu) != TM_ECODE_OK) {
465  FatalError("TmThreadSpawn failed");
466  }
467  }
468 
469  /* create the threads */
470  for (int i = 0; i < nqueue; i++) {
471  memset(tname, 0, sizeof(tname));
472  snprintf(tname, sizeof(tname), "%s#%02d", thread_name_verdict, i);
473 
474  ThreadVars *tv_verdict =
476  "verdict-queue", "simple",
477  "packetpool", "packetpool",
478  "varslot");
479  if (tv_verdict == NULL) {
480  FatalError("TmThreadsCreate failed");
481  }
482  tm_module = TmModuleGetByName(verdict_mod_name);
483  if (tm_module == NULL) {
484  FatalError("TmModuleGetByName %s failed", verdict_mod_name);
485  }
486  TmSlotSetFuncAppend(tv_verdict, tm_module, (void *)ConfigParser(i));
487 
488  tm_module = TmModuleGetByName("RespondReject");
489  if (tm_module == NULL) {
490  FatalError("TmModuleGetByName for RespondReject failed");
491  }
492  TmSlotSetFuncAppend(tv_verdict, tm_module, NULL);
493 
494  TmThreadSetCPU(tv_verdict, VERDICT_CPU_SET);
495 
496  if (TmThreadSpawn(tv_verdict) != TM_ECODE_OK) {
497  FatalError("TmThreadSpawn failed");
498  }
499  }
500 
501  SCFree(queues);
502  return 0;
503 }
504 
505 /**
506  */
508  const char *recv_mod_name,
509  const char *verdict_mod_name,
510  const char *decode_mod_name)
511 {
512  const int nqueue = LiveGetDeviceCount();
513 
514  for (int i = 0; i < nqueue; i++) {
515  /* create the threads */
516  const char *cur_queue = LiveGetDeviceName(i);
517  if (cur_queue == NULL) {
518  FatalError("invalid queue number");
519  }
520 
521  char tname[TM_THREAD_NAME_MAX];
522  memset(tname, 0, sizeof(tname));
523  snprintf(tname, sizeof(tname), "%s-%s", thread_name_workers, cur_queue);
524 
526  "packetpool", "packetpool",
527  "packetpool", "packetpool",
528  "pktacqloop");
529  if (tv == NULL) {
530  FatalError("TmThreadsCreate failed");
531  }
532 
533  TmModule *tm_module = TmModuleGetByName(recv_mod_name);
534  if (tm_module == NULL) {
535  FatalError("TmModuleGetByName failed for %s", recv_mod_name);
536  }
537  TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
538 
539  tm_module = TmModuleGetByName(decode_mod_name);
540  if (tm_module == NULL) {
541  FatalError("TmModuleGetByName %s failed", decode_mod_name);
542  }
543  TmSlotSetFuncAppend(tv, tm_module, NULL);
544 
545  tm_module = TmModuleGetByName("FlowWorker");
546  if (tm_module == NULL) {
547  FatalError("TmModuleGetByName for FlowWorker failed");
548  }
549  TmSlotSetFuncAppend(tv, tm_module, NULL);
550 
551  tm_module = TmModuleGetByName(verdict_mod_name);
552  if (tm_module == NULL) {
553  FatalError("TmModuleGetByName %s failed", verdict_mod_name);
554  }
555  TmSlotSetFuncAppend(tv, tm_module, (void *) ConfigParser(i));
556 
557  tm_module = TmModuleGetByName("RespondReject");
558  if (tm_module == NULL) {
559  FatalError("TmModuleGetByName for RespondReject failed");
560  }
561  TmSlotSetFuncAppend(tv, tm_module, NULL);
562 
564 
565  if (TmThreadSpawn(tv) != TM_ECODE_OK) {
566  FatalError("TmThreadSpawn failed");
567  }
568  }
569 
570  return 0;
571 }
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:68
util-device-private.h
tm-threads.h
RunModeSetIPSAutoFp
int RunModeSetIPSAutoFp(ConfigIPSParserFunc ConfigParser, const char *recv_mod_name, const char *verdict_mod_name, const char *decode_mod_name)
Definition: util-runmodes.c:386
TmThreadSpawn
TmEcode TmThreadSpawn(ThreadVars *tv)
Spawns a thread associated with the ThreadVars instance tv.
Definition: tm-threads.c:1724
detect-engine.h
ThreadVars_::iface_name
char * iface_name
Definition: threadvars.h:139
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:333
alert-debuglog.h
LiveGetShortName
const char * LiveGetShortName(const char *dev)
Definition: util-device.c:286
runmode-af-packet.h
TmThreadCreatePacketHandler
ThreadVars * TmThreadCreatePacketHandler(const char *name, const char *inq_name, const char *inqh_name, const char *outq_name, const char *outqh_name, const char *slots)
Creates and returns a TV instance for a Packet Processing Thread. This function doesn't support custo...
Definition: tm-threads.c:1068
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
TmThreadSetGroupName
void TmThreadSetGroupName(ThreadVars *tv, const char *name)
Definition: tm-threads.c:1681
RunModeSetIPSWorker
int RunModeSetIPSWorker(ConfigIPSParserFunc ConfigParser, const char *recv_mod_name, const char *verdict_mod_name, const char *decode_mod_name)
Definition: util-runmodes.c:507
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:279
flow-hash.h
util-runmodes.h
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:66
MIN
#define MIN(x, y)
Definition: suricata-common.h:408
WORKER_CPU_SET
@ WORKER_CPU_SET
Definition: util-affinity.h:58
TM_THREAD_NAME_MAX
#define TM_THREAD_NAME_MAX
Definition: tm-threads.h:49
TM_ECODE_OK
@ TM_ECODE_OK
Definition: tm-threads-common.h:81
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
TmModuleGetByName
TmModule * TmModuleGetByName(const char *name)
get a tm module ptr by name
Definition: tm-modules.c:46
util-debug.h
RunmodeAutoFpCreatePickupQueuesString
char * RunmodeAutoFpCreatePickupQueuesString(int n)
create a queue string for autofp to pass to the flow queue handler.
Definition: util-runmodes.c:58
strlcat
size_t strlcat(char *, const char *src, size_t siz)
Definition: util-strlcatu.c:45
util-cpu.h
ConfigIPSParserFunc
void *(* ConfigIPSParserFunc)(int)
Definition: util-runmodes.h:27
THREADS_MAX
#define THREADS_MAX
Definition: util-runmodes.c:51
SCEnter
#define SCEnter(...)
Definition: util-debug.h:281
detect-engine-mpm.h
ThreadVars_
Per thread variable structure.
Definition: threadvars.h:58
util-affinity.h
util-time.h
TM_QUEUE_NAME_MAX
#define TM_QUEUE_NAME_MAX
Definition: tm-threads.h:48
ConfigIfaceThreadsCountFunc
uint16_t(* ConfigIfaceThreadsCountFunc)(void *)
Definition: util-runmodes.h:28
conf.h
runmodes.h
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:229
TmModule_
Definition: tm-modules.h:47
alert-fastlog.h
TmSlotSetFuncAppend
void TmSlotSetFuncAppend(ThreadVars *tv, TmModule *tm, const void *data)
Appends a new entry to the slots.
Definition: tm-threads.c:658
suricata-common.h
TmThreadSetCPU
TmEcode TmThreadSetCPU(ThreadVars *tv, uint8_t type)
Definition: tm-threads.c:831
LiveGetDeviceName
const char * LiveGetDeviceName(int number)
Get a pointer to the device name at idx.
Definition: util-device.c:204
SCStrdup
#define SCStrdup(s)
Definition: util-mem.h:56
FatalError
#define FatalError(...)
Definition: util-debug.h:514
RECEIVE_CPU_SET
@ RECEIVE_CPU_SET
Definition: util-affinity.h:57
TmThreadsGetWorkerThreadMax
uint16_t TmThreadsGetWorkerThreadMax(void)
Definition: tm-threads.c:2410
ThreadVars_::printable_name
char * printable_name
Definition: threadvars.h:66
tv
ThreadVars * tv
Definition: fuzz_decodepcapfile.c:32
log-httplog.h
ConfigIfaceParserFunc
void *(* ConfigIfaceParserFunc)(const char *)
Definition: util-runmodes.h:26
SCMalloc
#define SCMalloc(sz)
Definition: util-mem.h:47
SCLogError
#define SCLogError(...)
Macro used to log ERROR messages.
Definition: util-debug.h:271
SCFree
#define SCFree(p)
Definition: util-mem.h:61
thread_name_verdict
const char * thread_name_verdict
Definition: runmodes.c:69
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:357
VERDICT_CPU_SET
@ VERDICT_CPU_SET
Definition: util-affinity.h:59
LiveGetDeviceCount
int LiveGetDeviceCount(void)
Get the number of registered devices.
Definition: util-device.c:170
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
output.h