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