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