suricata
flow-manager.c File Reference
#include "suricata-common.h"
#include "suricata.h"
#include "decode.h"
#include "conf.h"
#include "threadvars.h"
#include "tm-threads.h"
#include "runmodes.h"
#include "util-random.h"
#include "util-time.h"
#include "flow.h"
#include "flow-queue.h"
#include "flow-hash.h"
#include "flow-util.h"
#include "flow-var.h"
#include "flow-private.h"
#include "flow-timeout.h"
#include "flow-manager.h"
#include "flow-storage.h"
#include "stream-tcp-private.h"
#include "stream-tcp-reassemble.h"
#include "stream-tcp.h"
#include "util-unittest.h"
#include "util-unittest-helper.h"
#include "util-byte.h"
#include "util-debug.h"
#include "util-privs.h"
#include "util-signal.h"
#include "threads.h"
#include "detect.h"
#include "detect-engine-state.h"
#include "stream.h"
#include "app-layer-parser.h"
#include "host-timeout.h"
#include "defrag-timeout.h"
#include "ippair-timeout.h"
#include "output-flow.h"
Include dependency graph for flow-manager.c:

Go to the source code of this file.

Data Structures

struct  FlowTimeoutCounters_
 
struct  FlowManagerThreadData_
 
struct  FlowRecyclerThreadData_
 

Macros

#define FLOW_NORMAL_MODE_UPDATE_DELAY_SEC   1
 
#define FLOW_NORMAL_MODE_UPDATE_DELAY_NSEC   0
 
#define FLOW_EMERG_MODE_UPDATE_DELAY_SEC   0
 
#define FLOW_EMERG_MODE_UPDATE_DELAY_NSEC   100000
 
#define NEW_FLOW_COUNT_COND   10
 

Typedefs

typedef FlowProtoTimeoutFlowProtoTimeoutPtr
 
typedef struct FlowTimeoutCounters_ FlowTimeoutCounters
 
typedef struct FlowManagerThreadData_ FlowManagerThreadData
 
typedef struct FlowRecyclerThreadData_ FlowRecyclerThreadData
 

Functions

 SC_ATOMIC_DECLARE (uint32_t, flowmgr_cnt)
 
 SC_ATOMIC_DECLARE (uint32_t, flowrec_cnt)
 
 SC_ATOMIC_EXTERN (unsigned int, flow_flags)
 
 SC_ATOMIC_DECLARE (FlowProtoTimeoutPtr, flow_timeouts)
 
void FlowTimeoutsInit (void)
 
void FlowTimeoutsEmergency (void)
 
void FlowDisableFlowManagerThread (void)
 Used to disable flow manager thread(s). More...
 
void FlowManagerThreadSpawn ()
 spawn the flow manager thread More...
 
void FlowRecyclerThreadSpawn ()
 spawn the flow recycler thread More...
 
void FlowDisableFlowRecyclerThread (void)
 Used to disable flow recycler thread(s). More...
 
void TmModuleFlowManagerRegister (void)
 
void TmModuleFlowRecyclerRegister (void)
 
void FlowMgrRegisterTests (void)
 Function to register the Flow Unitests. More...
 

Variables

int run_mode
 
FlowQueue flow_recycle_q
 
SCCtrlCondT flow_manager_ctrl_cond
 
SCCtrlMutex flow_manager_ctrl_mutex
 
SCCtrlCondT flow_recycler_ctrl_cond
 
SCCtrlMutex flow_recycler_ctrl_mutex
 
int g_detect_disabled
 

Detailed Description

Macro Definition Documentation

◆ FLOW_EMERG_MODE_UPDATE_DELAY_NSEC

#define FLOW_EMERG_MODE_UPDATE_DELAY_NSEC   100000

Definition at line 114 of file flow-manager.c.

◆ FLOW_EMERG_MODE_UPDATE_DELAY_SEC

#define FLOW_EMERG_MODE_UPDATE_DELAY_SEC   0

Definition at line 113 of file flow-manager.c.

◆ FLOW_NORMAL_MODE_UPDATE_DELAY_NSEC

#define FLOW_NORMAL_MODE_UPDATE_DELAY_NSEC   0

Definition at line 111 of file flow-manager.c.

◆ FLOW_NORMAL_MODE_UPDATE_DELAY_SEC

#define FLOW_NORMAL_MODE_UPDATE_DELAY_SEC   1

Definition at line 110 of file flow-manager.c.

◆ NEW_FLOW_COUNT_COND

#define NEW_FLOW_COUNT_COND   10

Definition at line 115 of file flow-manager.c.

Typedef Documentation

◆ FlowManagerThreadData

◆ FlowProtoTimeoutPtr

Definition at line 95 of file flow-manager.c.

◆ FlowRecyclerThreadData

◆ FlowTimeoutCounters

Function Documentation

◆ FlowDisableFlowManagerThread()

void FlowDisableFlowManagerThread ( void  )

Used to disable flow manager thread(s).

Todo:
Kinda hackish since it uses the tv name to identify flow manager thread. We need an all weather identification scheme.

Definition at line 146 of file flow-manager.c.

Referenced by PostRunDeinit().

Here is the caller graph for this function:

◆ FlowDisableFlowRecyclerThread()

void FlowDisableFlowRecyclerThread ( void  )

Used to disable flow recycler thread(s).

Note
this should only be called when the flow manager is already gone
Todo:
Kinda hackish since it uses the tv name to identify flow recycler thread. We need an all weather identification scheme.

Definition at line 1069 of file flow-manager.c.

◆ FlowManagerThreadSpawn()

void FlowManagerThreadSpawn ( )

spawn the flow manager thread

Definition at line 877 of file flow-manager.c.

References ConfGetInt(), FatalError, and SC_ERR_INVALID_ARGUMENTS.

Here is the call graph for this function:

◆ FlowMgrRegisterTests()

void FlowMgrRegisterTests ( void  )

Function to register the Flow Unitests.

Definition at line 1427 of file flow-manager.c.

References UtRegisterTest().

Here is the call graph for this function:

◆ FlowRecyclerThreadSpawn()

void FlowRecyclerThreadSpawn ( )

spawn the flow recycler thread

Definition at line 1028 of file flow-manager.c.

References ConfGetInt(), FatalError, and SC_ERR_INVALID_ARGUMENTS.

Here is the call graph for this function:

◆ FlowTimeoutsEmergency()

void FlowTimeoutsEmergency ( void  )

Definition at line 103 of file flow-manager.c.

References flow_timeouts_emerg, and SC_ATOMIC_SET.

◆ FlowTimeoutsInit()

void FlowTimeoutsInit ( void  )

Definition at line 98 of file flow-manager.c.

References flow_timeouts_normal, and SC_ATOMIC_SET.

Referenced by FlowInitFlowProto().

Here is the caller graph for this function:

◆ SC_ATOMIC_DECLARE() [1/3]

SC_ATOMIC_DECLARE ( FlowProtoTimeoutPtr  ,
flow_timeouts   
)

◆ SC_ATOMIC_DECLARE() [2/3]

SC_ATOMIC_DECLARE ( uint32_t  ,
flowmgr_cnt   
)

◆ SC_ATOMIC_DECLARE() [3/3]

SC_ATOMIC_DECLARE ( uint32_t  ,
flowrec_cnt   
)

◆ SC_ATOMIC_EXTERN()

SC_ATOMIC_EXTERN ( unsigned int  ,
flow_flags   
)

◆ TmModuleFlowManagerRegister()

void TmModuleFlowManagerRegister ( void  )

Definition at line 1130 of file flow-manager.c.

References TmModule_::name, TmModule_::ThreadInit, TMM_FLOWMANAGER, and tmm_modules.

Referenced by RegisterAllModules().

Here is the caller graph for this function:

◆ TmModuleFlowRecyclerRegister()

void TmModuleFlowRecyclerRegister ( void  )

Definition at line 1144 of file flow-manager.c.

References TmModule_::name, TmModule_::ThreadInit, TMM_FLOWRECYCLER, and tmm_modules.

Referenced by RegisterAllModules().

Here is the caller graph for this function:

Variable Documentation

◆ flow_manager_ctrl_cond

SCCtrlCondT flow_manager_ctrl_cond

flow manager scheduling condition

Definition at line 89 of file flow-manager.c.

◆ flow_manager_ctrl_mutex

SCCtrlMutex flow_manager_ctrl_mutex

Definition at line 90 of file flow-manager.c.

◆ flow_recycle_q

FlowQueue flow_recycle_q

queue to pass flows to cleanup/log thread(s)

Definition at line 75 of file flow-manager.c.

Referenced by FlowInitConfig().

◆ flow_recycler_ctrl_cond

SCCtrlCondT flow_recycler_ctrl_cond

flow recycler scheduling condition

Definition at line 92 of file flow-manager.c.

◆ flow_recycler_ctrl_mutex

SCCtrlMutex flow_recycler_ctrl_mutex

Definition at line 93 of file flow-manager.c.

◆ g_detect_disabled

int g_detect_disabled

global indicating if detection is enabled

Definition at line 214 of file suricata.c.

◆ run_mode

int run_mode

Run mode selected

Definition at line 200 of file suricata.c.