suricata
|
#include "suricata-common.h"
#include "threads.h"
#include "decode.h"
#include "detect-engine-state.h"
#include "flow.h"
#include "flow-hash.h"
#include "flow-util.h"
#include "flow-private.h"
#include "flow-manager.h"
#include "flow-storage.h"
#include "flow-timeout.h"
#include "flow-spare-pool.h"
#include "app-layer-parser.h"
#include "util-time.h"
#include "util-debug.h"
#include "util-device.h"
#include "util-hash-lookup3.h"
#include "conf.h"
#include "output.h"
#include "output-flow.h"
#include "stream-tcp.h"
#include "util-exception-policy.h"
Go to the source code of this file.
Data Structures | |
struct | FlowHashKey4_ |
struct | FlowHashKey6_ |
Macros | |
#define | FLOW_GET_NEW_TRIES 5 |
#define | STATSADDUI64(cnt, value) |
Typedefs | |
typedef struct FlowHashKey4_ | FlowHashKey4 |
typedef struct FlowHashKey6_ | FlowHashKey6 |
Functions | |
SC_ATOMIC_EXTERN (unsigned int, flow_prune_idx) | |
SC_ATOMIC_EXTERN (unsigned int, flow_flags) | |
uint32_t | FlowGetIpPairProtoHash (const Packet *p) |
uint32_t | FlowKeyGetHash (FlowKey *fk) |
void | FlowSetupPacket (Packet *p) |
prepare packet for a life with flow Set PKT_WANTS_FLOW flag to indicate workers should do a flow lookup and calc the hash value to be used in the lookup and autofp flow balancing. More... | |
Flow * | FlowGetFlowFromHash (ThreadVars *tv, FlowLookupStruct *fls, Packet *p, Flow **dest) |
Get Flow for packet. More... | |
Flow * | FlowGetExistingFlowFromFlowId (int64_t flow_id) |
Look for existing Flow using a flow id value. More... | |
Flow * | FlowGetFromFlowKey (FlowKey *key, struct timespec *ttime, const uint32_t hash) |
Get or create a Flow using a FlowKey. More... | |
Variables | |
TcpStreamCnf | stream_config |
FlowBucket * | flow_hash |
Flow Hashing functions.
Definition in file flow-hash.c.
#define FLOW_GET_NEW_TRIES 5 |
Definition at line 1107 of file flow-hash.c.
#define STATSADDUI64 | ( | cnt, | |
value | |||
) |
typedef struct FlowHashKey4_ FlowHashKey4 |
typedef struct FlowHashKey6_ FlowHashKey6 |
Flow* FlowGetExistingFlowFromFlowId | ( | int64_t | flow_id | ) |
Look for existing Flow using a flow id value.
Hash retrieval function for flows. Looks up the hash bucket containing the flow pointer. Then compares the flow_id with the found flow's flow_id to see if it is the flow we need.
flow_id | Flow ID of the flow to look for |
f | LOCKED flow or NULL |
Definition at line 991 of file flow-hash.c.
References FBLOCK_LOCK, flow_config, flow_hash, FlowCnf_::hash_size, Flow_::next, and SCLogDebug.
Flow* FlowGetFlowFromHash | ( | ThreadVars * | tv, |
FlowLookupStruct * | fls, | ||
Packet * | p, | ||
Flow ** | dest | ||
) |
Get Flow for packet.
Hash retrieval function for flows. Looks up the hash bucket containing the flow pointer. Then compares the packet with the found flow to see if it is the flow we need. If it isn't, walk the list until the right flow is found.
If the flow is not found or the bucket was empty, a new flow is taken from the spare pool. The pool will alloc new flows as long as we stay within our memcap limit.
The p->flow pointer is updated to point to the flow.
tv | thread vars |
dtv | decode thread vars (for flow log api thread data) |
f | LOCKED flow or NULL |
Definition at line 866 of file flow-hash.c.
References FBLOCK_LOCK, flow_config, flow_hash, Packet_::flow_hash, FlowCnf_::hash_size, and SCLogDebug.
Referenced by FlowHandlePacket().
Get or create a Flow using a FlowKey.
Hash retrieval function for flows. Looks up the hash bucket containing the flow pointer. Then compares the packet with the found flow to see if it is the flow we need. If it isn't, walk the list until the right flow is found. Return a new Flow if ever no Flow was found.
key | Pointer to FlowKey build using flow to look for |
ttime | time to use for flow creation |
hash | Value of the flow hash |
f | LOCKED flow or NULL |
Definition at line 1055 of file flow-hash.c.
uint32_t FlowGetIpPairProtoHash | ( | const Packet * | p | ) |
Definition at line 116 of file flow-hash.c.
uint32_t FlowKeyGetHash | ( | FlowKey * | fk | ) |
Basic hashing function for FlowKey
Definition at line 307 of file flow-hash.c.
References Address_::address, Address_::address_un_data32, FlowHashKey4_::addrs, ARRAY_SIZE, FlowKey_::dp, FlowKey_::dst, Address_::family, flow_config, g_livedev_mask, g_vlan_mask, FlowCnf_::hash_rand, hashword(), FlowHashKey4_::livedev, FlowKey_::livedev_id, FlowHashKey6_::pad, FlowHashKey4_::ports, FlowHashKey4_::proto, FlowKey_::proto, FlowHashKey4_::recur, FlowKey_::recursion_level, FlowKey_::sp, FlowKey_::src, FlowHashKey4_::u32, FlowHashKey4_::vlan_id, and FlowKey_::vlan_id.
void FlowSetupPacket | ( | Packet * | p | ) |
prepare packet for a life with flow Set PKT_WANTS_FLOW flag to indicate workers should do a flow lookup and calc the hash value to be used in the lookup and autofp flow balancing.
Definition at line 521 of file flow-hash.c.
References Packet_::flags, Packet_::flow_hash, and PKT_WANTS_FLOW.
SC_ATOMIC_EXTERN | ( | unsigned int | , |
flow_flags | |||
) |
SC_ATOMIC_EXTERN | ( | unsigned int | , |
flow_prune_idx | |||
) |
FlowBucket* flow_hash |
Definition at line 58 of file flow-hash.c.
Referenced by FlowGetExistingFlowFromFlowId(), FlowGetFlowFromHash(), FlowInitConfig(), FlowReset(), and FlowShutdown().
TcpStreamCnf stream_config |
Definition at line 219 of file stream-tcp.c.
Referenced by NapatechGetStreamConfig(), StreamTcpPruneSession(), StreamTcpReassembleCheckMemcap(), StreamTcpReassembleGetMemcap(), StreamTcpReassembleRealloc(), StreamTcpReassembleSetMemcap(), StreamTcpUTDeinit(), StreamTcpUTInitInline(), and UTHAddStreamToFlow().