|
suricata
|
#include "suricata-common.h"#include "conf.h"#include "defrag-hash.h"#include "defrag-stack.h"#include "defrag-config.h"#include "defrag-timeout.h"#include "util-random.h"#include "util-byte.h"#include "util-misc.h"#include "util-hash-lookup3.h"#include "util-validate.h"
Go to the source code of this file.
Data Structures | |
| struct | DefragHashKey4_ |
| struct | DefragHashKey6_ |
Macros | |
| #define | DefragTrackerIncrUsecnt(dt) SC_ATOMIC_ADD((dt)->use_cnt, 1) |
| #define | DefragTrackerDecrUsecnt(dt) SC_ATOMIC_SUB((dt)->use_cnt, 1) |
| #define | DEFRAG_DEFAULT_HASHSIZE 4096 |
| #define | DEFRAG_DEFAULT_MEMCAP 16777216 |
| #define | DEFRAG_DEFAULT_PREALLOC 1000 |
| #define | CMP_DEFRAGTRACKER(d1, d2, id) |
Typedefs | |
| typedef struct DefragHashKey4_ | DefragHashKey4 |
| typedef struct DefragHashKey6_ | DefragHashKey6 |
Functions | |
| SC_ATOMIC_DECLARE (uint64_t, defrag_memuse) | |
| SC_ATOMIC_DECLARE (unsigned int, defragtracker_counter) | |
| SC_ATOMIC_DECLARE (unsigned int, defragtracker_prune_idx) | |
| int | DefragTrackerSetMemcap (uint64_t size) |
| Update memcap value. | |
| uint64_t | DefragTrackerGetMemcap (void) |
| Return memcap value. | |
| uint64_t | DefragTrackerGetMemuse (void) |
| Return memuse value. | |
| enum ExceptionPolicy | DefragGetMemcapExceptionPolicy (void) |
| void | DefragTrackerMoveToSpare (DefragTracker *h) |
| void | DefragTrackerRelease (DefragTracker *t) |
| void | DefragTrackerClearMemory (DefragTracker *dt) |
| void | DefragInitConfig (bool quiet) |
| initialize the configuration | |
| void | DefragHashShutdown (void) |
| shutdown the flow engine | |
| DefragTracker * | DefragGetTrackerFromHash (ThreadVars *tv, DecodeThreadVars *dtv, Packet *p) |
| DefragTracker * | DefragLookupTrackerFromHash (Packet *p) |
| look up a tracker in the hash | |
Variables | |
| DefragTrackerHashRow * | defragtracker_hash |
| DefragConfig | defrag_config |
| #define CMP_DEFRAGTRACKER | ( | d1, | |
| d2, | |||
| id | |||
| ) |
Definition at line 432 of file defrag-hash.c.
| #define DEFRAG_DEFAULT_HASHSIZE 4096 |
Definition at line 163 of file defrag-hash.c.
| #define DEFRAG_DEFAULT_MEMCAP 16777216 |
Definition at line 164 of file defrag-hash.c.
| #define DEFRAG_DEFAULT_PREALLOC 1000 |
Definition at line 165 of file defrag-hash.c.
| #define DefragTrackerDecrUsecnt | ( | dt | ) | SC_ATOMIC_SUB((dt)->use_cnt, 1) |
Definition at line 124 of file defrag-hash.c.
| #define DefragTrackerIncrUsecnt | ( | dt | ) | SC_ATOMIC_ADD((dt)->use_cnt, 1) |
Definition at line 122 of file defrag-hash.c.
| typedef struct DefragHashKey4_ DefragHashKey4 |
| typedef struct DefragHashKey6_ DefragHashKey6 |
| enum ExceptionPolicy DefragGetMemcapExceptionPolicy | ( | void | ) |
Definition at line 80 of file defrag-hash.c.
References defrag_config, and DefragConfig_::memcap_policy.
Referenced by DecodeRegisterPerfCounters(), and ExceptionPolicyTargetPolicy().

| DefragTracker * DefragGetTrackerFromHash | ( | ThreadVars * | tv, |
| DecodeThreadVars * | dtv, | ||
| Packet * | p | ||
| ) |
Definition at line 525 of file defrag-hash.c.
References BUG_ON, DecodeThreadVars_::counter_defrag_tracker_timeout, defragtracker_hash, DefragTrackerClearMemory(), DefragTrackerIncrUsecnt, DefragTrackerMoveToSpare(), DefragTrackerTimedOut(), DRLOCK_LOCK, DRLOCK_UNLOCK, dtv, DefragTrackerHashRow_::head, DefragTracker_::hnext, DefragTracker_::lock, DefragTracker_::remove, SCMutexLock, SCMutexUnlock, StatsIncr(), Packet_::ts, and tv.

| void DefragHashShutdown | ( | void | ) |
shutdown the flow engine
Definition at line 292 of file defrag-hash.c.
References BUG_ON, defrag_config, defragtracker_hash, DefragTrackerClearMemory(), DefragTrackerDequeue(), DefragTrackerStackDestroy(), DRLOCK_DESTROY, DefragConfig_::hash_size, DefragTrackerHashRow_::head, DefragTracker_::hnext, SC_ATOMIC_GET, SC_ATOMIC_SUB, and SCFree.
Referenced by DefragDestroy().


| void DefragInitConfig | ( | bool | quiet | ) |
initialize the configuration
set config values for memcap, prealloc and hash_size
Definition at line 169 of file defrag-hash.c.
References DEFRAG_CHECK_MEMCAP, defrag_config, DEFRAG_DEFAULT_HASHSIZE, DEFRAG_DEFAULT_MEMCAP, DEFRAG_DEFAULT_PREALLOC, defragtracker_hash, DefragTrackerEnqueue(), DefragTrackerStackInit(), DefragTrackerStackSize(), DRLOCK_INIT, ExceptionPolicyParse(), FatalError, DefragConfig_::hash_rand, DefragConfig_::hash_size, DefragConfig_::memcap_policy, ParseSizeStringU64(), DefragConfig_::prealloc, RandomGet(), SC_ATOMIC_ADD, SC_ATOMIC_GET, SC_ATOMIC_INIT, SC_ATOMIC_SET, SCCalloc, SCConfGet(), SCConfValIsTrue(), SCLogConfig, SCLogDebug, SCLogError, StringParseUint32(), unlikely, and WarnInvalidConfEntry.
Referenced by DefragInit().


| DefragTracker * DefragLookupTrackerFromHash | ( | Packet * | p | ) |
look up a tracker in the hash
| a | address to look up |
| h | LOCKED tracker or NULL |
Definition at line 620 of file defrag-hash.c.
References BUG_ON, defragtracker_hash, DefragTrackerIncrUsecnt, DRLOCK_LOCK, DRLOCK_UNLOCK, DefragTrackerHashRow_::head, DefragTracker_::hnext, DefragTracker_::lock, DefragTracker_::remove, and SCMutexLock.
| void DefragTrackerClearMemory | ( | DefragTracker * | dt | ) |
Definition at line 158 of file defrag-hash.c.
References DefragTrackerFreeFrags().
Referenced by DefragGetTrackerFromHash(), and DefragHashShutdown().


| uint64_t DefragTrackerGetMemcap | ( | void | ) |
Return memcap value.
| memcap | value |
Definition at line 63 of file defrag-hash.c.
References defrag_config, and SC_ATOMIC_GET.
| uint64_t DefragTrackerGetMemuse | ( | void | ) |
Return memuse value.
| memuse | value |
Definition at line 74 of file defrag-hash.c.
References SC_ATOMIC_GET.
| void DefragTrackerMoveToSpare | ( | DefragTracker * | h | ) |
Definition at line 85 of file defrag-hash.c.
References DefragTrackerEnqueue(), and SC_ATOMIC_SUB.
Referenced by DefragGetTrackerFromHash().


| void DefragTrackerRelease | ( | DefragTracker * | t | ) |
Definition at line 152 of file defrag-hash.c.
References DefragTrackerDecrUsecnt, DefragTracker_::lock, and SCMutexUnlock.
Referenced by Defrag().

| int DefragTrackerSetMemcap | ( | uint64_t | size | ) |
Update memcap value.
| size | new memcap value |
Definition at line 48 of file defrag-hash.c.
References defrag_config, SC_ATOMIC_GET, and SC_ATOMIC_SET.
| SC_ATOMIC_DECLARE | ( | uint64_t | , |
| defrag_memuse | |||
| ) |
| SC_ATOMIC_DECLARE | ( | unsigned int | , |
| defragtracker_counter | |||
| ) |
| SC_ATOMIC_DECLARE | ( | unsigned int | , |
| defragtracker_prune_idx | |||
| ) |
| DefragConfig defrag_config |
Definition at line 32 of file defrag-hash.c.
Referenced by DefragGetMemcapExceptionPolicy(), DefragHashShutdown(), DefragInitConfig(), DefragTimeoutHash(), DefragTrackerGetMemcap(), and DefragTrackerSetMemcap().
| DefragTrackerHashRow* defragtracker_hash |
defrag tracker hash table
Definition at line 31 of file defrag-hash.c.
Referenced by DefragGetTrackerFromHash(), DefragHashShutdown(), DefragInitConfig(), DefragLookupTrackerFromHash(), and DefragTimeoutHash().