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