suricata
runmodes.c
Go to the documentation of this file.
1 /* Copyright (C) 2007-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 /** \file
19  *
20  * \author Victor Julien <victor@inliniac.net>
21  *
22  * Pre-cooked threading runmodes.
23  */
24 
25 #include "suricata-common.h"
26 #include "detect.h"
27 #include "detect-engine.h"
28 #include "detect-engine-mpm.h"
29 #include "app-layer-parser.h"
30 #include "tm-threads.h"
31 #include "util-debug.h"
32 #include "util-time.h"
33 #include "util-cpu.h"
34 #include "util-byte.h"
35 #include "util-affinity.h"
36 #include "conf.h"
37 #include "queue.h"
38 #include "runmodes.h"
39 #include "runmode-af-packet.h"
40 #include "runmode-dpdk.h"
41 #include "runmode-erf-dag.h"
42 #include "runmode-erf-file.h"
43 #include "runmode-ipfw.h"
44 #include "runmode-napatech.h"
45 #include "runmode-netmap.h"
46 #include "runmode-nflog.h"
47 #include "runmode-nfq.h"
48 #include "runmode-pcap.h"
49 #include "runmode-pcap-file.h"
50 #include "runmode-pfring.h"
51 #include "runmode-unix-socket.h"
52 #include "runmode-windivert.h"
53 #include "util-unittest.h"
54 #include "util-misc.h"
55 #include "util-plugin.h"
56 
57 #include "output.h"
58 
59 #include "alert-fastlog.h"
60 #include "alert-debuglog.h"
61 
62 #include "log-httplog.h"
63 
64 #include "source-pfring.h"
65 
66 #include "tmqh-flow.h"
67 #include "flow-manager.h"
68 #include "flow-bypass.h"
69 #include "counters.h"
70 
71 #include "suricata-plugin.h"
72 
76 
77 /* Runmode Global Thread Names */
78 const char *thread_name_autofp = "RX";
79 const char *thread_name_single = "W";
80 const char *thread_name_workers = "W";
81 const char *thread_name_verdict = "TX";
82 const char *thread_name_flow_mgr = "FM";
83 const char *thread_name_flow_rec = "FR";
84 const char *thread_name_flow_bypass = "FB";
85 const char *thread_name_unix_socket = "US";
86 const char *thread_name_detect_loader = "DL";
87 const char *thread_name_counter_stats = "CS";
88 const char *thread_name_counter_wakeup = "CW";
89 
90 /**
91  * \brief Holds description for a runmode.
92  */
93 typedef struct RunMode_ {
94  /* the runmode type */
95  enum RunModes runmode;
96  const char *name;
97  const char *description;
98  /* runmode function */
99  int (*RunModeFunc)(void);
101 
102 typedef struct RunModes_ {
103  int cnt;
106 
107 static RunModes runmodes[RUNMODE_USER_MAX];
108 
109 static char *active_runmode;
110 
111 /* free list for our outputs */
112 typedef struct OutputFreeList_ {
115 
116  TAILQ_ENTRY(OutputFreeList_) entries;
118 static TAILQ_HEAD(, OutputFreeList_) output_free_list =
119  TAILQ_HEAD_INITIALIZER(output_free_list);
120 
121 /**
122  * \internal
123  * \brief Translate a runmode mode to a printale string.
124  *
125  * \param runmode Runmode to be converted into a printable string.
126  *
127  * \retval string Printable string.
128  */
129 static const char *RunModeTranslateModeToName(int runmode)
130 {
131  switch (runmode) {
132  case RUNMODE_PCAP_DEV:
133  return "PCAP_DEV";
134  case RUNMODE_PCAP_FILE:
135  return "PCAP_FILE";
136  case RUNMODE_PFRING:
137 #ifdef HAVE_PFRING
138  return "PFRING";
139 #else
140  return "PFRING(DISABLED)";
141 #endif
142  case RUNMODE_PLUGIN:
143  return "PLUGIN";
144  case RUNMODE_NFQ:
145  return "NFQ";
146  case RUNMODE_NFLOG:
147  return "NFLOG";
148  case RUNMODE_IPFW:
149  return "IPFW";
150  case RUNMODE_ERF_FILE:
151  return "ERF_FILE";
152  case RUNMODE_DAG:
153  return "ERF_DAG";
154  case RUNMODE_NAPATECH:
155  return "NAPATECH";
156  case RUNMODE_UNITTEST:
157  return "UNITTEST";
158  case RUNMODE_AFP_DEV:
159  return "AF_PACKET_DEV";
160  case RUNMODE_NETMAP:
161 #ifdef HAVE_NETMAP
162  return "NETMAP";
163 #else
164  return "NETMAP(DISABLED)";
165 #endif
166  case RUNMODE_UNIX_SOCKET:
167  return "UNIX_SOCKET";
168  case RUNMODE_WINDIVERT:
169 #ifdef WINDIVERT
170  return "WINDIVERT";
171 #else
172  return "WINDIVERT(DISABLED)";
173 #endif
174  case RUNMODE_DPDK:
175 #ifdef HAVE_DPDK
176  return "DPDK";
177 #else
178  return "DPDK(DISABLED)";
179 #endif
180 
181  default:
182  FatalError(SC_ERR_UNKNOWN_RUN_MODE, "Unknown runtime mode. Aborting");
183  }
184 }
185 
186 /**
187  * \internal
188  * \brief Dispatcher function for runmodes. Calls the required runmode function
189  * based on runmode + runmode_custom_id.
190  *
191  * \param runmode The runmode type.
192  * \param runmode_customd_id The runmode custom id.
193  */
194 static RunMode *RunModeGetCustomMode(enum RunModes runmode, const char *custom_mode)
195 {
196  if (runmode < RUNMODE_USER_MAX) {
197  for (int i = 0; i < runmodes[runmode].cnt; i++) {
198  if (strcmp(runmodes[runmode].runmodes[i].name, custom_mode) == 0)
199  return &runmodes[runmode].runmodes[i];
200  }
201  }
202  return NULL;
203 }
204 
205 
206 /**
207  * Return the running mode
208  *
209  * The returned string must not be freed.
210  *
211  * \return a string containing the current running mode
212  */
213 char *RunmodeGetActive(void)
214 {
215  return active_runmode;
216 }
217 
218 /**
219  * Return the running mode
220  *
221  * The returned string must not be freed.
222  *
223  * \return a string containing the current running mode
224  */
225 const char *RunModeGetMainMode(void)
226 {
227  int mainmode = RunmodeGetCurrent();
228 
229  return RunModeTranslateModeToName(mainmode);
230 }
231 
232 /**
233  * \brief Register all runmodes in the engine.
234  */
236 {
237  memset(runmodes, 0, sizeof(runmodes));
238 
253 #ifdef UNITTESTS
255 #endif
256  return;
257 }
258 
259 /**
260  * \brief Lists all registered runmodes.
261  */
263 {
264  printf("------------------------------------- Runmodes -------------------"
265  "-----------------------\n");
266 
267  printf("| %-17s | %-17s | %-10s \n",
268  "RunMode Type", "Custom Mode ", "Description");
269  printf("|-----------------------------------------------------------------"
270  "-----------------------\n");
271  int i = RUNMODE_UNKNOWN + 1;
272  int j = 0;
273  for ( ; i < RUNMODE_USER_MAX; i++) {
274  int mode_displayed = 0;
275  for (j = 0; j < runmodes[i].cnt; j++) {
276  if (mode_displayed == 1) {
277  printf("| ----------------------------------------------"
278  "-----------------------\n");
279  RunMode *runmode = &runmodes[i].runmodes[j];
280  printf("| %-17s | %-17s | %-27s \n",
281  "",
282  runmode->name,
283  runmode->description);
284  } else {
285  RunMode *runmode = &runmodes[i].runmodes[j];
286  printf("| %-17s | %-17s | %-27s \n",
287  RunModeTranslateModeToName(runmode->runmode),
288  runmode->name,
289  runmode->description);
290  }
291  if (mode_displayed == 0)
292  mode_displayed = 1;
293  }
294  if (mode_displayed == 1) {
295  printf("|-----------------------------------------------------------------"
296  "-----------------------\n");
297  }
298  }
299 
300  return;
301 }
302 
303 /**
304  */
305 void RunModeDispatch(int runmode, const char *custom_mode,
306  const char *capture_plugin_name, const char *capture_plugin_args)
307 {
308  char *local_custom_mode = NULL;
309 
310  if (custom_mode == NULL) {
311  const char *val = NULL;
312  if (ConfGet("runmode", &val) != 1) {
313  custom_mode = NULL;
314  } else {
315  custom_mode = val;
316  }
317  }
318 
319  if (custom_mode == NULL || strcmp(custom_mode, "auto") == 0) {
320  switch (runmode) {
321  case RUNMODE_PCAP_DEV:
322  custom_mode = RunModeIdsGetDefaultMode();
323  break;
324  case RUNMODE_PCAP_FILE:
325  custom_mode = RunModeFilePcapGetDefaultMode();
326  break;
327 #ifdef HAVE_PFRING
328  case RUNMODE_PFRING:
329  custom_mode = RunModeIdsPfringGetDefaultMode();
330  break;
331 #endif
332  case RUNMODE_PLUGIN: {
333 #ifdef HAVE_PLUGINS
334  SCCapturePlugin *plugin = SCPluginFindCaptureByName(capture_plugin_name);
335  if (plugin == NULL) {
336  FatalError(SC_ERR_PLUGIN, "No capture plugin found with name %s",
337  capture_plugin_name);
338  }
339  custom_mode = (const char *)plugin->GetDefaultMode();
340 #endif
341  break;
342  }
343  case RUNMODE_NFQ:
344  custom_mode = RunModeIpsNFQGetDefaultMode();
345  break;
346  case RUNMODE_IPFW:
347  custom_mode = RunModeIpsIPFWGetDefaultMode();
348  break;
349  case RUNMODE_ERF_FILE:
350  custom_mode = RunModeErfFileGetDefaultMode();
351  break;
352  case RUNMODE_DAG:
353  custom_mode = RunModeErfDagGetDefaultMode();
354  break;
355  case RUNMODE_NAPATECH:
356  custom_mode = RunModeNapatechGetDefaultMode();
357  break;
358  case RUNMODE_AFP_DEV:
359  custom_mode = RunModeAFPGetDefaultMode();
360  break;
361  case RUNMODE_NETMAP:
362  custom_mode = RunModeNetmapGetDefaultMode();
363  break;
364  case RUNMODE_UNIX_SOCKET:
365  custom_mode = RunModeUnixSocketGetDefaultMode();
366  break;
367  case RUNMODE_NFLOG:
368  custom_mode = RunModeIdsNflogGetDefaultMode();
369  break;
370 #ifdef WINDIVERT
371  case RUNMODE_WINDIVERT:
372  custom_mode = RunModeIpsWinDivertGetDefaultMode();
373  break;
374 #endif
375 #ifdef HAVE_DPDK
376  case RUNMODE_DPDK:
377  custom_mode = RunModeDpdkGetDefaultMode();
378  break;
379 #endif
380  default:
381  FatalError(SC_ERR_FATAL, "Unknown runtime mode. Aborting");
382  }
383  } else { /* if (custom_mode == NULL) */
384  /* Add compability with old 'worker' name */
385  if (!strcmp("worker", custom_mode)) {
386  SCLogWarning(SC_ERR_RUNMODE, "'worker' mode have been renamed "
387  "to 'workers', please modify your setup.");
388  local_custom_mode = SCStrdup("workers");
389  if (unlikely(local_custom_mode == NULL)) {
390  FatalError(SC_ERR_FATAL, "Unable to dup custom mode");
391  }
392  custom_mode = local_custom_mode;
393  }
394  }
395 
396  RunMode *mode = RunModeGetCustomMode(runmode, custom_mode);
397  if (mode == NULL) {
398  SCLogError(SC_ERR_RUNMODE, "The custom type \"%s\" doesn't exist "
399  "for this runmode type \"%s\". Please use --list-runmodes to "
400  "see available custom types for this runmode",
401  custom_mode, RunModeTranslateModeToName(runmode));
402  exit(EXIT_FAILURE);
403  }
404 
405  /* Export the custom mode */
406  if (active_runmode) {
407  SCFree(active_runmode);
408  }
409  active_runmode = SCStrdup(custom_mode);
410  if (unlikely(active_runmode == NULL)) {
411  FatalError(SC_ERR_FATAL, "Unable to dup active mode");
412  }
413 
414  if (strcasecmp(active_runmode, "autofp") == 0) {
416  }
417 
418  mode->RunModeFunc();
419 
420  if (local_custom_mode != NULL)
421  SCFree(local_custom_mode);
422 
423  /* Check if the alloted queues have at least 1 reader and writer */
425 
426  if (runmode != RUNMODE_UNIX_SOCKET) {
427  /* spawn management threads */
432  }
434  }
435 }
436 
437 static int g_runmode_needs_bypass = 0;
438 
440 {
441  g_runmode_needs_bypass = 1;
442 }
443 
445 {
446  return g_runmode_needs_bypass;
447 }
448 
449 
450 
451 /**
452  * \brief Registers a new runmode.
453  *
454  * \param runmode Runmode type.
455  * \param name Custom mode for this specific runmode type. Within each
456  * runmode type, each custom name is a primary key.
457  * \param description Description for this runmode.
458  * \param RunModeFunc The function to be run for this runmode.
459  */
461  const char *name,
462  const char *description,
463  int (*RunModeFunc)(void))
464 {
465  if (RunModeGetCustomMode(runmode, name) != NULL) {
466  FatalError(SC_ERR_RUNMODE, "runmode '%s' has already "
467  "been registered. Please use an unique name.", name);
468  }
469 
470  void *ptmp = SCRealloc(runmodes[runmode].runmodes,
471  (runmodes[runmode].cnt + 1) * sizeof(RunMode));
472  if (ptmp == NULL) {
473  SCFree(runmodes[runmode].runmodes);
474  runmodes[runmode].runmodes = NULL;
475  exit(EXIT_FAILURE);
476  }
477  runmodes[runmode].runmodes = ptmp;
478 
479  RunMode *mode = &runmodes[runmode].runmodes[runmodes[runmode].cnt];
480  runmodes[runmode].cnt++;
481  memset(mode, 0x00, sizeof(*mode));
482 
483  mode->runmode = runmode;
484  mode->name = SCStrdup(name);
485  if (unlikely(mode->name == NULL)) {
486  FatalError(SC_ERR_MEM_ALLOC, "Failed to allocate string");
487  }
488  mode->description = SCStrdup(description);
489  if (unlikely(mode->description == NULL)) {
490  FatalError(SC_ERR_MEM_ALLOC, "Failed to allocate string");
491  }
492  mode->RunModeFunc = RunModeFunc;
493 
494  return;
495 }
496 
497 /**
498  * Setup the outputs for this run mode.
499  *
500  * \param tv The ThreadVars for the thread the outputs will be
501  * appended to.
502  */
503 static void RunOutputFreeList(void)
504 {
505  OutputFreeList *output;
506  while ((output = TAILQ_FIRST(&output_free_list))) {
507  SCLogDebug("output %s %p %p", output->output_module->name, output,
508  output->output_ctx);
509 
510  if (output->output_ctx != NULL && output->output_ctx->DeInit != NULL)
511  output->output_ctx->DeInit(output->output_ctx);
512 
513  TAILQ_REMOVE(&output_free_list, output, entries);
514  SCFree(output);
515  }
516 }
517 
518 static int file_logger_count = 0;
519 static int filedata_logger_count = 0;
520 static LoggerId logger_bits[ALPROTO_MAX];
521 
523 {
524  return file_logger_count > 0;
525 }
526 
528 {
529  return filedata_logger_count > 0;
530 }
531 
532 bool IsRunModeSystem(enum RunModes run_mode_to_check)
533 {
534  switch (run_mode_to_check) {
535  case RUNMODE_PCAP_FILE:
536  case RUNMODE_ERF_FILE:
538  return false;
539  break;
540  default:
541  return true;
542  }
543 }
544 
545 bool IsRunModeOffline(enum RunModes run_mode_to_check)
546 {
547  switch(run_mode_to_check) {
548  case RUNMODE_CONF_TEST:
549  case RUNMODE_PCAP_FILE:
550  case RUNMODE_ERF_FILE:
552  case RUNMODE_UNIX_SOCKET:
553  return true;
554  break;
555  default:
556  return false;
557  }
558 }
559 
560 /**
561  * Cleanup the run mode.
562  */
563 void RunModeShutDown(void)
564 {
565  RunOutputFreeList();
566 
574 
576 
577  /* Reset logger counts. */
578  file_logger_count = 0;
579  filedata_logger_count = 0;
580 }
581 
582 /** \internal
583  * \brief add Sub RunModeOutput to list for Submodule so we can free
584  * the output ctx at shutdown and unix socket reload */
585 static void AddOutputToFreeList(OutputModule *module, OutputCtx *output_ctx)
586 {
587  OutputFreeList *fl_output = SCCalloc(1, sizeof(OutputFreeList));
588  if (unlikely(fl_output == NULL))
589  return;
590  fl_output->output_module = module;
591  fl_output->output_ctx = output_ctx;
592  TAILQ_INSERT_TAIL(&output_free_list, fl_output, entries);
593 }
594 
595 /** \brief Turn output into thread module */
596 static void SetupOutput(const char *name, OutputModule *module, OutputCtx *output_ctx)
597 {
598  /* flow logger doesn't run in the packet path */
599  if (module->FlowLogFunc) {
600  OutputRegisterFlowLogger(module->name, module->FlowLogFunc,
601  output_ctx, module->ThreadInit, module->ThreadDeinit,
602  module->ThreadExitPrintStats);
603  return;
604  }
605  /* stats logger doesn't run in the packet path */
606  if (module->StatsLogFunc) {
608  output_ctx,module->ThreadInit, module->ThreadDeinit,
609  module->ThreadExitPrintStats);
610  return;
611  }
612 
613  if (module->logger_id == LOGGER_ALERT_DEBUG) {
614  debuglog_enabled = 1;
615  }
616 
617  if (module->PacketLogFunc) {
618  SCLogDebug("%s is a packet logger", module->name);
619  OutputRegisterPacketLogger(module->logger_id, module->name,
620  module->PacketLogFunc, module->PacketConditionFunc, output_ctx,
621  module->ThreadInit, module->ThreadDeinit,
622  module->ThreadExitPrintStats);
623  } else if (module->TxLogFunc) {
624  SCLogDebug("%s is a tx logger", module->name);
625  OutputRegisterTxLogger(module->logger_id, module->name, module->alproto,
626  module->TxLogFunc, output_ctx, module->tc_log_progress,
627  module->ts_log_progress, module->TxLogCondition,
628  module->ThreadInit, module->ThreadDeinit,
629  module->ThreadExitPrintStats);
630  /* Not used with wild card loggers */
631  if (module->alproto != ALPROTO_UNKNOWN) {
632  logger_bits[module->alproto] |= (1<<module->logger_id);
633  }
634  } else if (module->FiledataLogFunc) {
635  SCLogDebug("%s is a filedata logger", module->name);
637  module->FiledataLogFunc, output_ctx, module->ThreadInit,
638  module->ThreadDeinit, module->ThreadExitPrintStats);
639  filedata_logger_count++;
640  } else if (module->FileLogFunc) {
641  SCLogDebug("%s is a file logger", module->name);
642  OutputRegisterFileLogger(module->logger_id, module->name,
643  module->FileLogFunc, output_ctx, module->ThreadInit,
644  module->ThreadDeinit, module->ThreadExitPrintStats);
645  file_logger_count++;
646  } else if (module->StreamingLogFunc) {
647  SCLogDebug("%s is a streaming logger", module->name);
649  module->StreamingLogFunc, output_ctx, module->stream_type,
650  module->ThreadInit, module->ThreadDeinit,
651  module->ThreadExitPrintStats);
652  } else {
653  SCLogError(SC_ERR_INVALID_ARGUMENT, "Unknown logger type: name=%s",
654  module->name);
655  }
656 }
657 
658 static void RunModeInitializeEveOutput(ConfNode *conf, OutputCtx *parent_ctx)
659 {
660  ConfNode *types = ConfNodeLookupChild(conf, "types");
661  SCLogDebug("types %p", types);
662  if (types == NULL) {
663  return;
664  }
665 
666  ConfNode *type = NULL;
667  TAILQ_FOREACH(type, &types->head, next) {
668  int sub_count = 0;
669  char subname[256];
670 
671  if (strcmp(type->val, "ikev2") == 0) {
672  SCLogWarning(SC_ERR_INVALID_ARGUMENT, "eve module 'ikev2' has been replaced by 'ike'");
673  strlcpy(subname, "eve-log.ike", sizeof(subname));
674  } else {
675  snprintf(subname, sizeof(subname), "eve-log.%s", type->val);
676  }
677 
678  SCLogConfig("enabling 'eve-log' module '%s'", type->val);
679 
680  ConfNode *sub_output_config = ConfNodeLookupChild(type, type->val);
681  if (sub_output_config != NULL) {
682  const char *enabled = ConfNodeLookupChildValue(
683  sub_output_config, "enabled");
684  if (enabled != NULL && !ConfValIsTrue(enabled)) {
685  continue;
686  }
687  }
688 
689  /* Now setup all registers logger of this name. */
690  OutputModule *sub_module;
691  TAILQ_FOREACH(sub_module, &output_modules, entries) {
692  if (strcmp(subname, sub_module->conf_name) == 0) {
693  sub_count++;
694 
695  if (sub_module->parent_name == NULL ||
696  strcmp(sub_module->parent_name, "eve-log") != 0) {
698  "bad parent for %s", subname);
699  }
700  if (sub_module->InitSubFunc == NULL) {
702  "bad sub-module for %s", subname);
703  }
704 
705  /* pass on parent output_ctx */
706  OutputInitResult result =
707  sub_module->InitSubFunc(sub_output_config, parent_ctx);
708  if (!result.ok || result.ctx == NULL) {
709  continue;
710  }
711 
712  AddOutputToFreeList(sub_module, result.ctx);
713  SetupOutput(sub_module->name, sub_module,
714  result.ctx);
715  }
716  }
717 
718  /* Error is no registered loggers with this name
719  * were found .*/
720  if (!sub_count) {
722  "No output module named %s", subname);
723  continue;
724  }
725  }
726 }
727 
728 static void RunModeInitializeLuaOutput(ConfNode *conf, OutputCtx *parent_ctx)
729 {
730  OutputModule *lua_module = OutputGetModuleByConfName("lua");
731  BUG_ON(lua_module == NULL);
732 
733  ConfNode *scripts = ConfNodeLookupChild(conf, "scripts");
734  BUG_ON(scripts == NULL); //TODO
735 
736  OutputModule *m;
737  TAILQ_FOREACH(m, &parent_ctx->submodules, entries) {
738  SCLogDebug("m %p %s:%s", m, m->name, m->conf_name);
739 
740  ConfNode *script = NULL;
741  TAILQ_FOREACH(script, &scripts->head, next) {
742  SCLogDebug("script %s", script->val);
743  if (strcmp(script->val, m->conf_name) == 0) {
744  break;
745  }
746  }
747  BUG_ON(script == NULL);
748 
749  /* pass on parent output_ctx */
750  OutputInitResult result = m->InitSubFunc(script, parent_ctx);
751  if (!result.ok || result.ctx == NULL) {
752  continue;
753  }
754 
755  AddOutputToFreeList(m, result.ctx);
756  SetupOutput(m->name, m, result.ctx);
757  }
758 }
759 
760 /**
761  * Initialize the output modules.
762  */
764 {
765  ConfNode *outputs = ConfGetNode("outputs");
766  if (outputs == NULL) {
767  /* No "outputs" section in the configuration. */
768  return;
769  }
770 
771  ConfNode *output, *output_config;
772  const char *enabled;
773  char tls_log_enabled = 0;
774  char tls_store_present = 0;
775 
776  memset(&logger_bits, 0, sizeof(logger_bits));
777 
778  TAILQ_FOREACH(output, &outputs->head, next) {
779 
780  output_config = ConfNodeLookupChild(output, output->val);
781  if (output_config == NULL) {
782  /* Shouldn't happen. */
784  "Failed to lookup configuration child node: %s", output->val);
785  }
786 
787  if (strcmp(output->val, "tls-store") == 0) {
788  tls_store_present = 1;
789  }
790 
791  enabled = ConfNodeLookupChildValue(output_config, "enabled");
792  if (enabled == NULL || !ConfValIsTrue(enabled)) {
793  continue;
794  }
795 
796  if (strcmp(output->val, "file-log") == 0) {
798  "file-log is no longer supported,"
799  " use eve.files instead "
800  "(see https://redmine.openinfosecfoundation.org/issues/2376"
801  " for an explanation)");
802  continue;
803  } else if (strncmp(output->val, "unified-", sizeof("unified-") - 1) == 0) {
805  "Unified1 is no longer supported,"
806  " use Unified2 instead "
807  "(see https://redmine.openinfosecfoundation.org/issues/353"
808  " for an explanation)");
809  continue;
810  } else if (strncmp(output->val, "unified2-", sizeof("unified2-") - 1) == 0) {
812  "Unified2 is no longer supported.");
813  continue;
814  } else if (strcmp(output->val, "lua") == 0) {
815 #ifndef HAVE_LUA
817  "lua support not compiled in. Reconfigure/"
818  "recompile with lua(jit) and its development "
819  "files installed to add lua support.");
820  continue;
821 #endif
822  } else if (strcmp(output->val, "dns-log") == 0) {
824  "dns-log is not longer available as of Suricata 5.0");
825  continue;
826  } else if (strcmp(output->val, "tls-log") == 0) {
827  tls_log_enabled = 1;
828  }
829 
830  OutputModule *module;
831  int count = 0;
832  TAILQ_FOREACH(module, &output_modules, entries) {
833  if (strcmp(module->conf_name, output->val) != 0) {
834  continue;
835  }
836 
837  count++;
838 
839  OutputCtx *output_ctx = NULL;
840  if (module->InitFunc != NULL) {
841  OutputInitResult r = module->InitFunc(output_config);
842  if (!r.ok) {
844  "output module \"%s\": setup failed", output->val);
845  continue;
846  } else if (r.ctx == NULL) {
847  continue;
848  }
849  output_ctx = r.ctx;
850  } else if (module->InitSubFunc != NULL) {
851  SCLogInfo("skipping submodule");
852  continue;
853  }
854 
855  // TODO if module == parent, find it's children
856  if (strcmp(output->val, "eve-log") == 0) {
857  RunModeInitializeEveOutput(output_config, output_ctx);
858 
859  /* add 'eve-log' to free list as it's the owner of the
860  * main output ctx from which the sub-modules share the
861  * LogFileCtx */
862  AddOutputToFreeList(module, output_ctx);
863  } else if (strcmp(output->val, "lua") == 0) {
864  SCLogDebug("handle lua");
865  if (output_ctx == NULL)
866  continue;
867  RunModeInitializeLuaOutput(output_config, output_ctx);
868  AddOutputToFreeList(module, output_ctx);
869  } else {
870  AddOutputToFreeList(module, output_ctx);
871  SetupOutput(module->name, module, output_ctx);
872  }
873  }
874  if (count == 0) {
876  "No output module named %s", output->val);
877  continue;
878  }
879  }
880 
881  /* Backward compatibility code */
882  if (!tls_store_present && tls_log_enabled) {
883  /* old YAML with no "tls-store" in outputs. "tls-log" value needs
884  * to be started using 'tls-log' config as own config */
886  "Please use 'tls-store' in YAML to configure TLS storage");
887 
888  TAILQ_FOREACH(output, &outputs->head, next) {
889  output_config = ConfNodeLookupChild(output, output->val);
890 
891  if (strcmp(output->val, "tls-log") == 0) {
892 
893  OutputModule *module = OutputGetModuleByConfName("tls-store");
894  if (module == NULL) {
896  "No output module named %s, ignoring", "tls-store");
897  continue;
898  }
899 
900  OutputCtx *output_ctx = NULL;
901  if (module->InitFunc != NULL) {
902  OutputInitResult r = module->InitFunc(output_config);
903  if (!r.ok) {
905  "output module setup failed");
906  continue;
907  } else if (r.ctx == NULL) {
908  continue;
909  }
910  output_ctx = r.ctx;
911  }
912 
913  AddOutputToFreeList(module, output_ctx);
914  SetupOutput(module->name, module, output_ctx);
915  }
916  }
917  }
918 
919  /* register the logger bits to the app-layer */
920  AppProto a;
921  for (a = 0; a < ALPROTO_MAX; a++) {
922  if (logger_bits[a] == 0)
923  continue;
924 
925  const int tcp = AppLayerParserProtocolHasLogger(IPPROTO_TCP, a);
926  const int udp = AppLayerParserProtocolHasLogger(IPPROTO_UDP, a);
927 
928  SCLogDebug("logger for %s: %s %s", AppProtoToString(a),
929  tcp ? "true" : "false", udp ? "true" : "false");
930 
931  SCLogDebug("logger bits for %s: %08x", AppProtoToString(a), logger_bits[a]);
932  if (tcp)
933  AppLayerParserRegisterLoggerBits(IPPROTO_TCP, a, logger_bits[a]);
934  if (udp)
935  AppLayerParserRegisterLoggerBits(IPPROTO_UDP, a, logger_bits[a]);
936 
937  }
939 }
940 
942 
943 /**
944  * Initialize multithreading settings.
945  */
947 {
949  if ((ConfGetBool("threading.set-cpu-affinity", &threading_set_cpu_affinity)) == 0) {
951  }
952  /* try to get custom cpu mask value if needed */
955  }
956  if ((ConfGetFloat("threading.detect-thread-ratio", &threading_detect_ratio)) != 1) {
957  if (ConfGetNode("threading.detect-thread-ratio") != NULL)
958  WarnInvalidConfEntry("threading.detect-thread-ratio", "%s", "1");
960  }
961 
962  SCLogDebug("threading.detect-thread-ratio %f", threading_detect_ratio);
963 
964  /*
965  * Check if there's a configuration setting for the per-thread stack size
966  * in case the default per-thread stack size is to be adjusted
967  */
968  const char *ss = NULL;
969  if ((ConfGet("threading.stack-size", &ss)) == 1) {
970  if (ss != NULL) {
973  "Failed to initialize thread_stack_size output, invalid limit: %s", ss);
974  }
975  }
976  }
977 
978  SCLogDebug("threading.stack-size %" PRIu64, threading_set_stack_size);
979 }
thread_name_workers
const char * thread_name_workers
Definition: runmodes.c:80
RunModeIpsIPFWGetDefaultMode
const char * RunModeIpsIPFWGetDefaultMode(void)
Definition: runmode-ipfw.c:44
OutputRegisterStreamingLogger
int OutputRegisterStreamingLogger(LoggerId id, const char *name, StreamingLogger LogFunc, OutputCtx *output_ctx, enum OutputStreamingType type, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-streaming.c:65
suricata-plugin.h
util-byte.h
OutputModule_::parent_name
const char * parent_name
Definition: output.h:58
tm-threads.h
thread_name_counter_wakeup
const char * thread_name_counter_wakeup
Definition: runmodes.c:88
flow-bypass.h
RunMode_::description
const char * description
Definition: runmodes.c:97
detect-engine.h
RUNMODE_UNIX_SOCKET
@ RUNMODE_UNIX_SOCKET
Definition: runmodes.h:42
RunModeErfFileRegister
void RunModeErfFileRegister(void)
Definition: runmode-erf-file.c:39
OutputStreamingShutdown
void OutputStreamingShutdown(void)
Definition: output-streaming.c:463
AppLayerParserProtocolHasLogger
int AppLayerParserProtocolHasLogger(uint8_t ipproto, AppProto alproto)
Definition: app-layer-parser.c:1483
thread_name_flow_mgr
const char * thread_name_flow_mgr
Definition: runmodes.c:82
RUNMODE_UNITTEST
@ RUNMODE_UNITTEST
Definition: runmodes.h:40
alert-debuglog.h
FatalErrorOnInit
#define FatalErrorOnInit(x,...)
Fatal error IF we're starting up, and configured to consider errors to be fatal errors.
Definition: util-debug.h:538
RunModeErfFileGetDefaultMode
const char * RunModeErfFileGetDefaultMode(void)
Definition: runmode-erf-file.c:34
ConfNode_::val
char * val
Definition: conf.h:34
ConfGetBool
int ConfGetBool(const char *name, int *val)
Retrieve a configuration value as an boolen.
Definition: conf.c:472
RUNMODE_DPDK
@ RUNMODE_DPDK
Definition: runmodes.h:39
runmode-af-packet.h
RUNMODE_UNKNOWN
@ RUNMODE_UNKNOWN
Definition: runmodes.h:28
unlikely
#define unlikely(expr)
Definition: util-optimize.h:35
OutputTxShutdown
void OutputTxShutdown(void)
Definition: output-tx.c:446
TmqhFlowPrintAutofpHandler
void TmqhFlowPrintAutofpHandler(void)
Definition: tmqh-flow.c:82
RunModeIdsAFPRegister
void RunModeIdsAFPRegister(void)
Definition: runmode-af-packet.c:66
SCLogDebug
#define SCLogDebug(...)
Definition: util-debug.h:296
ParseSizeStringU64
int ParseSizeStringU64(const char *size, uint64_t *res)
Definition: util-misc.c:200
next
struct HtpBodyChunk_ * next
Definition: app-layer-htp.h:0
OutputRegisterFileLogger
int OutputRegisterFileLogger(LoggerId id, const char *name, FileLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-file.c:64
AppProto
uint16_t AppProto
Definition: app-layer-protos.h:80
RunModeShutDown
void RunModeShutDown(void)
Definition: runmodes.c:563
OutputRegisterStatsLogger
int OutputRegisterStatsLogger(const char *name, StatsLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-stats.c:57
RunModeDispatch
void RunModeDispatch(int runmode, const char *custom_mode, const char *capture_plugin_name, const char *capture_plugin_args)
Definition: runmodes.c:305
SC_ERR_NOT_SUPPORTED
@ SC_ERR_NOT_SUPPORTED
Definition: util-error.h:257
ConfGetNode
ConfNode * ConfGetNode(const char *name)
Get a ConfNode by name.
Definition: conf.c:175
OutputModule_::name
const char * name
Definition: output.h:56
thread_name_counter_stats
const char * thread_name_counter_stats
Definition: runmodes.c:87
OutputModule_::StreamingLogFunc
StreamingLogger StreamingLogFunc
Definition: output.h:73
OutputModule_::FileLogFunc
FileLogger FileLogFunc
Definition: output.h:70
OutputModule_::logger_id
LoggerId logger_id
Definition: output.h:55
LoggerId
LoggerId
Definition: suricata-common.h:441
AppProtoToString
const char * AppProtoToString(AppProto alproto)
Maps the ALPROTO_*, to its string equivalent.
Definition: app-layer-protos.c:30
runmode-pcap.h
RunModeAFPGetDefaultMode
const char * RunModeAFPGetDefaultMode(void)
Definition: runmode-af-packet.c:61
thread_name_flow_rec
const char * thread_name_flow_rec
Definition: runmodes.c:83
OutputFiledataShutdown
void OutputFiledataShutdown(void)
Definition: output-filedata.c:366
RunModeInitialize
void RunModeInitialize(void)
Definition: runmodes.c:946
RUNMODE_ERF_FILE
@ RUNMODE_ERF_FILE
Definition: runmodes.h:35
RunModeIdsPfringRegister
void RunModeIdsPfringRegister(void)
Definition: runmode-pfring.c:51
OutputModule_::ts_log_progress
int ts_log_progress
Definition: output.h:78
runmode-erf-file.h
runmode-windivert.h
RunModeFilePcapGetDefaultMode
const char * RunModeFilePcapGetDefaultMode(void)
Definition: runmode-pcap-file.c:35
TAILQ_FOREACH
#define TAILQ_FOREACH(var, head, field)
Definition: queue.h:252
thread_name_autofp
const char * thread_name_autofp
Definition: runmodes.c:78
RUNMODE_NFLOG
@ RUNMODE_NFLOG
Definition: runmodes.h:33
OutputGetModuleByConfName
OutputModule * OutputGetModuleByConfName(const char *conf_name)
Get an output module by name.
Definition: output.c:786
OutputSetupActiveLoggers
void OutputSetupActiveLoggers(void)
Definition: output.c:998
OutputModule_::StatsLogFunc
StatsLogger StatsLogFunc
Definition: output.h:74
RunModeIdsNflogGetDefaultMode
const char * RunModeIdsNflogGetDefaultMode(void)
Definition: runmode-nflog.c:211
RUNMODE_PCAP_DEV
@ RUNMODE_PCAP_DEV
Definition: runmodes.h:29
RunMode_::RunModeFunc
int(* RunModeFunc)(void)
Definition: runmodes.c:99
OutputStatsShutdown
void OutputStatsShutdown(void)
Definition: output-stats.c:213
TAILQ_INSERT_TAIL
#define TAILQ_INSERT_TAIL(head, elm, field)
Definition: queue.h:294
RunmodeGetActive
char * RunmodeGetActive(void)
Definition: runmodes.c:213
m
SCMutex m
Definition: flow-hash.h:6
OutputModule_::InitSubFunc
OutputInitSubFunc InitSubFunc
Definition: output.h:60
RUNMODE_NAPATECH
@ RUNMODE_NAPATECH
Definition: runmodes.h:41
RunModes
struct RunModes_ RunModes
OutputModule_::PacketLogFunc
PacketLogger PacketLogFunc
Definition: output.h:66
TmValidateQueueState
void TmValidateQueueState(void)
Checks if all the queues allocated so far have at least one reader and writer.
Definition: tm-queues.c:101
ALPROTO_MAX
@ ALPROTO_MAX
Definition: app-layer-protos.h:75
IsRunModeOffline
bool IsRunModeOffline(enum RunModes run_mode_to_check)
Definition: runmodes.c:545
RunModeInitializeOutputs
void RunModeInitializeOutputs(void)
Definition: runmodes.c:763
debuglog_enabled
int debuglog_enabled
Definition: runmodes.c:73
SC_ERR_RUNMODE
@ SC_ERR_RUNMODE
Definition: util-error.h:219
thread_name_single
const char * thread_name_single
Definition: runmodes.c:79
OutputModule_::alproto
AppProto alproto
Definition: output.h:75
RUNMODE_DAG
@ RUNMODE_DAG
Definition: runmodes.h:36
RunModes_
Definition: runmodes.c:102
runmode-unix-socket.h
util-unittest.h
RUNMODE_NETMAP
@ RUNMODE_NETMAP
Definition: runmodes.h:38
SCCapturePlugin_::GetDefaultMode
const char *(* GetDefaultMode)(void)
Definition: suricata-plugin.h:72
ConfValIsTrue
int ConfValIsTrue(const char *val)
Check if a value is true.
Definition: conf.c:521
OutputClearActiveLoggers
void OutputClearActiveLoggers(void)
Definition: output.c:1011
OutputCtx_
Definition: tm-modules.h:78
RunModeIdsPfringGetDefaultMode
const char * RunModeIdsPfringGetDefaultMode(void)
Definition: runmode-pfring.c:42
OutputModule_::stream_type
enum OutputStreamingType stream_type
Definition: output.h:76
strlcpy
size_t strlcpy(char *dst, const char *src, size_t siz)
Definition: util-strlcpyu.c:43
OutputRegisterFiledataLogger
int OutputRegisterFiledataLogger(LoggerId id, const char *name, FiledataLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-filedata.c:65
TAILQ_ENTRY
#define TAILQ_ENTRY(type)
Definition: queue.h:239
RunModeUnixSocketGetDefaultMode
const char * RunModeUnixSocketGetDefaultMode(void)
Definition: runmode-unix-socket.c:82
OutputRegisterFlowLogger
int OutputRegisterFlowLogger(const char *name, FlowLogger LogFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-flow.c:54
ConfGet
int ConfGet(const char *name, const char **vptr)
Retrieve the value of a configuration node.
Definition: conf.c:330
RUNMODE_USER_MAX
@ RUNMODE_USER_MAX
Definition: runmodes.h:45
RunModeIpsNFQRegister
void RunModeIpsNFQRegister(void)
Definition: runmode-nfq.c:47
counters.h
OutputRegisterTxLogger
int OutputRegisterTxLogger(LoggerId id, const char *name, AppProto alproto, TxLogger LogFunc, OutputCtx *output_ctx, int tc_log_progress, int ts_log_progress, TxLoggerCondition LogCondition, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, void(*ThreadExitPrintStats)(ThreadVars *, void *))
Definition: output-tx.c:62
OutputModule_::ThreadInit
ThreadInitFunc ThreadInit
Definition: output.h:62
RunModeDpdkGetDefaultMode
const char * RunModeDpdkGetDefaultMode(void)
Definition: runmode-dpdk.c:1313
TAILQ_HEAD_INITIALIZER
#define TAILQ_HEAD_INITIALIZER(head)
Definition: queue.h:236
IsRunModeSystem
bool IsRunModeSystem(enum RunModes run_mode_to_check)
Definition: runmodes.c:532
output_modules
OutputModuleList output_modules
RunModes
RunModes
Definition: runmodes.h:27
TAILQ_REMOVE
#define TAILQ_REMOVE(head, elm, field)
Definition: queue.h:312
OutputModule_::FiledataLogFunc
FiledataLogger FiledataLogFunc
Definition: output.h:71
util-debug.h
RunModes_::runmodes
RunMode * runmodes
Definition: runmodes.c:104
TAILQ_FIRST
#define TAILQ_FIRST(head)
Definition: queue.h:250
type
uint8_t type
Definition: decode-icmpv4.h:0
thread_name_flow_bypass
const char * thread_name_flow_bypass
Definition: runmodes.c:84
SC_ERR_CONF_YAML_ERROR
@ SC_ERR_CONF_YAML_ERROR
Definition: util-error.h:274
BypassedFlowManagerThreadSpawn
void BypassedFlowManagerThreadSpawn()
spawn the flow bypass manager thread
Definition: flow-bypass.c:184
SC_ERR_PLUGIN
@ SC_ERR_PLUGIN
Definition: util-error.h:367
OutputInitResult_::ctx
OutputCtx * ctx
Definition: output.h:45
RUNMODE_CONF_TEST
@ RUNMODE_CONF_TEST
Definition: runmodes.h:53
OutputModule_::ThreadDeinit
ThreadDeinitFunc ThreadDeinit
Definition: output.h:63
RunModeListRunmodes
void RunModeListRunmodes(void)
Lists all registered runmodes.
Definition: runmodes.c:262
runmode-pfring.h
util-cpu.h
threading_set_stack_size
uint64_t threading_set_stack_size
Definition: runmodes.c:75
RunModeEnablesBypassManager
void RunModeEnablesBypassManager(void)
Definition: runmodes.c:439
OutputPacketShutdown
void OutputPacketShutdown(void)
Definition: output-packet.c:224
RunModeIdsNflogRegister
void RunModeIdsNflogRegister(void)
Definition: runmode-nflog.c:216
detect-engine-mpm.h
detect.h
util-affinity.h
RunMode_
Holds description for a runmode.
Definition: runmodes.c:93
SCCapturePlugin_
Definition: suricata-plugin.h:67
AppLayerParserRegisterLoggerBits
void AppLayerParserRegisterLoggerBits(uint8_t ipproto, AppProto alproto, LoggerId bits)
Definition: app-layer-parser.c:482
RunModeIpsIPFWRegister
void RunModeIpsIPFWRegister(void)
Definition: runmode-ipfw.c:49
util-time.h
OutputInitResult_::ok
bool ok
Definition: output.h:46
RunModeErfDagGetDefaultMode
const char * RunModeErfDagGetDefaultMode(void)
Definition: runmode-erf-dag.c:43
threading_set_cpu_affinity
int threading_set_cpu_affinity
Definition: runmodes.c:74
SC_ERR_INVALID_ARGUMENT
@ SC_ERR_INVALID_ARGUMENT
Definition: util-error.h:43
app-layer-parser.h
TRUE
#define TRUE
Definition: suricata-common.h:33
source-pfring.h
BUG_ON
#define BUG_ON(x)
Definition: suricata-common.h:281
runmode-netmap.h
runmode-erf-dag.h
FALSE
#define FALSE
Definition: suricata-common.h:34
thread_name_detect_loader
const char * thread_name_detect_loader
Definition: runmodes.c:86
OutputModule_::conf_name
const char * conf_name
Definition: output.h:57
OutputModule_::FlowLogFunc
FlowLogger FlowLogFunc
Definition: output.h:72
FlowManagerThreadSpawn
void FlowManagerThreadSpawn()
spawn the flow manager thread
Definition: flow-manager.c:951
conf.h
OutputFileShutdown
void OutputFileShutdown(void)
Definition: output-file.c:313
runmode-pcap-file.h
util-plugin.h
queue.h
RunModeErfDagRegister
void RunModeErfDagRegister(void)
Definition: runmode-erf-dag.c:48
OutputModule_::ThreadExitPrintStats
ThreadExitPrintStatsFunc ThreadExitPrintStats
Definition: output.h:64
RunMode
struct RunMode_ RunMode
Holds description for a runmode.
FlowRecyclerThreadSpawn
void FlowRecyclerThreadSpawn()
spawn the flow recycler thread
Definition: flow-manager.c:1143
runmodes.h
SCLogInfo
#define SCLogInfo(...)
Macro used to log INFORMATIONAL messages.
Definition: util-debug.h:215
WarnInvalidConfEntry
#define WarnInvalidConfEntry(param_name, format, value)
Generic API that can be used by all to log an invalid conf entry.
Definition: util-misc.h:36
RunModes_::cnt
int cnt
Definition: runmodes.c:103
RunModeIpsWinDivertRegister
void RunModeIpsWinDivertRegister(void)
Definition: runmode-windivert.c:45
SCRealloc
#define SCRealloc(ptr, sz)
Definition: util-mem.h:50
RunModeNapatechGetDefaultMode
const char * RunModeNapatechGetDefaultMode(void)
Definition: runmode-napatech.c:82
alert-fastlog.h
ConfNodeLookupChild
ConfNode * ConfNodeLookupChild(const ConfNode *node, const char *name)
Lookup a child configuration node by name.
Definition: conf.c:770
OutputFreeList_::output_ctx
OutputCtx * output_ctx
Definition: runmodes.c:114
runmode-nfq.h
SC_ERR_UNKNOWN_RUN_MODE
@ SC_ERR_UNKNOWN_RUN_MODE
Definition: util-error.h:155
OutputInitResult_
Definition: output.h:44
ConfGetFloat
int ConfGetFloat(const char *name, float *val)
Retrieve a configuration value as a float.
Definition: conf.c:600
OutputModule_::TxLogCondition
TxLoggerCondition TxLogCondition
Definition: output.h:69
RUNMODE_PFRING
@ RUNMODE_PFRING
Definition: runmodes.h:31
RunModeUnixSocketRegister
void RunModeUnixSocketRegister(void)
Definition: runmode-unix-socket.c:605
flow-manager.h
suricata-common.h
OutputCtx_::DeInit
void(* DeInit)(struct OutputCtx_ *)
Definition: tm-modules.h:84
RunModeRegisterNewRunMode
void RunModeRegisterNewRunMode(enum RunModes runmode, const char *name, const char *description, int(*RunModeFunc)(void))
Registers a new runmode.
Definition: runmodes.c:460
StatsSpawnThreads
void StatsSpawnThreads(void)
Spawns the wakeup, and the management thread used by the stats api.
Definition: counters.c:907
RunModeNeedsBypassManager
int RunModeNeedsBypassManager(void)
Definition: runmodes.c:444
SCLogError
#define SCLogError(err_code,...)
Macro used to log ERROR messages.
Definition: util-debug.h:255
LOGGER_ALERT_DEBUG
@ LOGGER_ALERT_DEBUG
Definition: suricata-common.h:480
RunModeIdsPcapRegister
void RunModeIdsPcapRegister(void)
Definition: runmode-pcap.c:43
RunModeRegisterRunModes
void RunModeRegisterRunModes(void)
Register all runmodes in the engine.
Definition: runmodes.c:235
SCStrdup
#define SCStrdup(s)
Definition: util-mem.h:56
RunModeFilePcapRegister
void RunModeFilePcapRegister(void)
Definition: runmode-pcap-file.c:40
FatalError
#define FatalError(x,...)
Definition: util-debug.h:530
AffinitySetupLoadFromConfig
void AffinitySetupLoadFromConfig()
Extract cpu affinity configuration from current config file.
Definition: util-affinity.c:180
log-httplog.h
OutputModule_::PacketConditionFunc
PacketLogCondition PacketConditionFunc
Definition: output.h:67
RunmodeGetCurrent
int RunmodeGetCurrent(void)
Definition: suricata.c:288
RUNMODE_NFQ
@ RUNMODE_NFQ
Definition: runmodes.h:32
SCLogConfig
struct SCLogConfig_ SCLogConfig
Holds the config state used by the logging api.
RunModeNetmapGetDefaultMode
const char * RunModeNetmapGetDefaultMode(void)
Definition: runmode-netmap.c:51
RunModeIpsNFQGetDefaultMode
const char * RunModeIpsNFQGetDefaultMode(void)
Definition: runmode-nfq.c:42
RUNMODE_ENGINE_ANALYSIS
@ RUNMODE_ENGINE_ANALYSIS
Definition: runmodes.h:55
RunMode_::runmode
enum RunModes runmode
Definition: runmodes.c:95
SCLogWarning
#define SCLogWarning(err_code,...)
Macro used to log WARNING messages.
Definition: util-debug.h:242
SCFree
#define SCFree(p)
Definition: util-mem.h:61
RunModeIdsNetmapRegister
void RunModeIdsNetmapRegister(void)
Definition: runmode-netmap.c:56
ConfNode_
Definition: conf.h:32
OutputFreeList
struct OutputFreeList_ OutputFreeList
SC_ERR_FATAL
@ SC_ERR_FATAL
Definition: util-error.h:203
thread_name_verdict
const char * thread_name_verdict
Definition: runmodes.c:81
runmode-napatech.h
RunModeDpdkRegister
void RunModeDpdkRegister(void)
Definition: runmode-dpdk.c:1318
OutputModule_::TxLogFunc
TxLogger TxLogFunc
Definition: output.h:68
OutputModule_::tc_log_progress
int tc_log_progress
Definition: output.h:77
TAILQ_HEAD
#define TAILQ_HEAD(name, type)
Definition: queue.h:230
OutputFlowShutdown
void OutputFlowShutdown(void)
Definition: output-flow.c:207
ALPROTO_UNKNOWN
@ ALPROTO_UNKNOWN
Definition: app-layer-protos.h:29
OutputFreeList_
Definition: runmodes.c:112
tmqh-flow.h
RUNMODE_WINDIVERT
@ RUNMODE_WINDIVERT
Definition: runmodes.h:43
SC_ERR_MEM_ALLOC
@ SC_ERR_MEM_ALLOC
Definition: util-error.h:31
runmode-dpdk.h
runmode-ipfw.h
thread_name_unix_socket
const char * thread_name_unix_socket
Definition: runmodes.c:85
RunModeNapatechRegister
void RunModeNapatechRegister(void)
Definition: runmode-napatech.c:87
OutputFreeList_::output_module
OutputModule * output_module
Definition: runmodes.c:113
runmode-nflog.h
RunModeGetMainMode
const char * RunModeGetMainMode(void)
Definition: runmodes.c:225
RunModeOutputFiledataEnabled
int RunModeOutputFiledataEnabled(void)
Definition: runmodes.c:527
util-misc.h
RunMode_::name
const char * name
Definition: runmodes.c:96
OutputModule_
Definition: output.h:54
UtRunModeRegister
void UtRunModeRegister(void)
Definition: util-unittest.c:284
SCCalloc
#define SCCalloc(nm, sz)
Definition: util-mem.h:53
RUNMODE_AFP_DEV
@ RUNMODE_AFP_DEV
Definition: runmodes.h:37
RUNMODE_PCAP_FILE
@ RUNMODE_PCAP_FILE
Definition: runmodes.h:30
RunModeIpsWinDivertGetDefaultMode
const char * RunModeIpsWinDivertGetDefaultMode(void)
Definition: runmode-windivert.c:40
RUNMODE_PLUGIN
@ RUNMODE_PLUGIN
Definition: runmodes.h:44
RUNMODE_IPFW
@ RUNMODE_IPFW
Definition: runmodes.h:34
SCPluginFindCaptureByName
SCCapturePlugin * SCPluginFindCaptureByName(const char *name)
threading_detect_ratio
float threading_detect_ratio
Definition: runmodes.c:941
output.h
RunModeOutputFileEnabled
int RunModeOutputFileEnabled(void)
Definition: runmodes.c:522
OutputModule_::InitFunc
OutputInitFunc InitFunc
Definition: output.h:59
OutputRegisterPacketLogger
int OutputRegisterPacketLogger(LoggerId logger_id, const char *name, PacketLogger LogFunc, PacketLogCondition ConditionFunc, OutputCtx *output_ctx, ThreadInitFunc ThreadInit, ThreadDeinitFunc ThreadDeinit, ThreadExitPrintStatsFunc ThreadExitPrintStats)
Definition: output-packet.c:56
RunModeIdsGetDefaultMode
const char * RunModeIdsGetDefaultMode(void)
Definition: runmode-pcap.c:36
ConfNodeLookupChildValue
const char * ConfNodeLookupChildValue(const ConfNode *node, const char *name)
Lookup the value of a child configuration node by name.
Definition: conf.c:798