flow: fix global variable use

pull/4537/head
Victor Julien 6 years ago
parent 29f54a34ae
commit 5e583f3a12

@ -49,6 +49,7 @@
#define FLOW_DEFAULT_FLOW_PRUNE 5
FlowBucket *flow_hash;
SC_ATOMIC_EXTERN(unsigned int, flow_prune_idx);
SC_ATOMIC_EXTERN(unsigned int, flow_flags);

@ -71,6 +71,9 @@
/* Run mode selected at suricata.c */
extern int run_mode;
/** queue to pass flows to cleanup/log thread(s) */
FlowQueue flow_recycle_q;
/* multi flow mananger support */
static uint32_t flowmgr_number = 1;
/* atomic counter for flow managers, to assign instance id */
@ -83,6 +86,11 @@ SC_ATOMIC_DECLARE(uint32_t, flowrec_cnt);
SC_ATOMIC_EXTERN(unsigned int, flow_flags);
SCCtrlCondT flow_manager_ctrl_cond;
SCCtrlMutex flow_manager_ctrl_mutex;
SCCtrlCondT flow_recycler_ctrl_cond;
SCCtrlMutex flow_recycler_ctrl_mutex;
typedef FlowProtoTimeout *FlowProtoTimeoutPtr;
SC_ATOMIC_DECLARE(FlowProtoTimeoutPtr, flow_timeouts);

@ -29,8 +29,8 @@ void FlowTimeoutsInit(void);
void FlowTimeoutsEmergency(void);
/** flow manager scheduling condition */
SCCtrlCondT flow_manager_ctrl_cond;
SCCtrlMutex flow_manager_ctrl_mutex;
extern SCCtrlCondT flow_manager_ctrl_cond;
extern SCCtrlMutex flow_manager_ctrl_mutex;
#define FlowWakeupFlowManagerThread() SCCtrlCondSignal(&flow_manager_ctrl_cond)
void FlowManagerThreadSpawn(void);
@ -38,8 +38,8 @@ void FlowDisableFlowManagerThread(void);
void FlowMgrRegisterTests (void);
/** flow recycler scheduling condition */
SCCtrlCondT flow_recycler_ctrl_cond;
SCCtrlMutex flow_recycler_ctrl_mutex;
extern SCCtrlCondT flow_recycler_ctrl_cond;
extern SCCtrlMutex flow_recycler_ctrl_mutex;
#define FlowWakeupFlowRecyclerThread() \
SCCtrlCondSignal(&flow_recycler_ctrl_cond)

@ -83,21 +83,21 @@ enum {
/** FlowProto specific timeouts and free/state functions */
FlowProtoTimeout flow_timeouts_normal[FLOW_PROTO_MAX];
FlowProtoTimeout flow_timeouts_emerg[FLOW_PROTO_MAX];
FlowProtoFreeFunc flow_freefuncs[FLOW_PROTO_MAX];
extern FlowProtoTimeout flow_timeouts_normal[FLOW_PROTO_MAX];
extern FlowProtoTimeout flow_timeouts_emerg[FLOW_PROTO_MAX];
extern FlowProtoFreeFunc flow_freefuncs[FLOW_PROTO_MAX];
/** spare/unused/prealloced flows live here */
FlowQueue flow_spare_q;
extern FlowQueue flow_spare_q;
/** queue to pass flows to cleanup/log thread(s) */
FlowQueue flow_recycle_q;
extern FlowQueue flow_recycle_q;
FlowBucket *flow_hash;
FlowConfig flow_config;
extern FlowBucket *flow_hash;
extern FlowConfig flow_config;
/** flow memuse counter (atomic), for enforcing memcap limit */
SC_ATOMIC_DECLARE(uint64_t, flow_memuse);
SC_ATOMIC_EXTERN(uint64_t, flow_memuse);
#endif /* __FLOW_PRIVATE_H__ */

@ -83,6 +83,20 @@ SC_ATOMIC_DECLARE(unsigned int, flow_prune_idx);
/** atomic flags */
SC_ATOMIC_DECLARE(unsigned int, flow_flags);
/** FlowProto specific timeouts and free/state functions */
FlowProtoTimeout flow_timeouts_normal[FLOW_PROTO_MAX];
FlowProtoTimeout flow_timeouts_emerg[FLOW_PROTO_MAX];
FlowProtoFreeFunc flow_freefuncs[FLOW_PROTO_MAX];
/** spare/unused/prealloced flows live here */
FlowQueue flow_spare_q;
FlowConfig flow_config;
/** flow memuse counter (atomic), for enforcing memcap limit */
SC_ATOMIC_DECLARE(uint64_t, flow_memuse);
void FlowRegisterTests(void);
void FlowInitFlowProto(void);
int FlowSetProtoFreeFunc(uint8_t, void (*Free)(void *));

Loading…
Cancel
Save