]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow: fix global variable use
authorVictor Julien <victor@inliniac.net>
Wed, 29 Jan 2020 12:23:36 +0000 (13:23 +0100)
committerVictor Julien <victor@inliniac.net>
Tue, 11 Feb 2020 19:38:50 +0000 (20:38 +0100)
src/flow-hash.c
src/flow-manager.c
src/flow-manager.h
src/flow-private.h
src/flow.c

index aa434ec69f07ed9a7cfba61d284f84efb3be2a2f..26aa7efd7476c730d6120798e497e46accd80998 100644 (file)
@@ -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);
 
index 720a63998346174b97ae4abee0d9a35b27b6bc19..328e973519f6e7a45b863d41fa293c846d533718 100644 (file)
@@ -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);
index 117c98df6d0c8f38abbc26506f51dc8691ac7c26..8ce882c59126fe1b9f7cb98574babf3fcdff6e2e 100644 (file)
@@ -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)
 
index 2e712367ec92387f2d2950ef57962ce239325f20..45315eda9b378fcfc2f4f1ed96cdf06c445bdf4d 100644 (file)
@@ -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__ */
 
index adde85464234aa1dd85ccd299b4b4eb81de13014..0d3a187ef4eb315a4f4d6cf15583a9e0307ef798 100644 (file)
@@ -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 *));