Go to the documentation of this file.
37 static int initialized = 0;
50 char errbuf[PCAP_ERRBUF_SIZE];
52 struct pcap_pkthdr *header;
58 if (initialized == 0) {
60 setenv(
"SC_LOG_OP_IFACE",
"file", 0);
61 setenv(
"SC_LOG_FILE",
"/dev/null", 0);
74 remove(
"/tmp/fuzz.rules");
84 memset(&
tv, 0,
sizeof(
tv));
116 for (pos=0; pos < size; pos++) {
117 if (data[pos] == 0) {
121 if (pos > 0 && pos < size) {
157 pkts = pcap_open_offline(
"/tmp/fuzz.pcap", errbuf);
163 r = pcap_next_ex(pkts, &header, &pkt);
165 if (r <= 0 || header->
ts.tv_sec >= INT_MAX - 3600 || header->ts.tv_usec < 0) {
179 while (extra_p != NULL) {
185 while (extra_p != NULL) {
190 r = pcap_next_ex(pkts, &header, &pkt);
191 if (r <= 0 || header->
ts.tv_sec >= INT_MAX - 3600 || header->ts.tv_usec < 0) {
struct FlowQueue_ * flow_queue
DetectEngineThreadCtx * DetectEngineThreadCtxInitForReload(ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt)
int SCRunmodeGet(void)
Get the current run mode.
void PacketFreeOrRelease(Packet *p)
Return a packet to where it was allocated.
int PacketCopyData(Packet *p, const uint8_t *pktdata, uint32_t pktlen)
Copy data to Packet payload and set packet length.
#define SC_ATOMIC_SET(name, val)
Set the value for the atomic variable.
void PacketRecycle(Packet *p)
void SCRunmodeSet(int run_mode)
Set the current run mode.
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
main detection engine ctx
DetectEngineCtx * DetectEngineGetCurrent(void)
int StatsSetupPrivate(ThreadVars *tv)
SC_ATOMIC_EXTERN(unsigned int, engine_stage)
void GlobalsInitPreConfig(void)
void PacketPoolInit(void)
void DecodeRegisterPerfCounters(DecodeThreadVars *dtv, ThreadVars *tv)
void PreRunPostPrivsDropInit(const int runmode)
Packet * PacketDequeueNoLock(PacketQueueNoLock *qnl)
Per thread variable structure.
#define SCTIME_FROM_TIMEVAL(tv)
TmEcode(* Func)(ThreadVars *, Packet *, void *)
void PacketFree(Packet *p)
Return a malloced packet.
FlowQueue * FlowQueueNew(void)
int TestHelperBufferToFile(const char *name, const uint8_t *data, size_t size)
writes the contents of a buffer into a file
int ConfYamlLoadString(const char *string, size_t len)
Load configuration from a YAML string.
int PostConfLoadedSetup(SCInstance *suri)
void PostConfLoadedDetectSetup(SCInstance *suri)
TmModule tmm_modules[TMM_SIZE]
void setenv(const char *name, const char *value, int overwrite)
uint32_t max_pending_packets
void * FlowWorkerGetDetectCtxPtr(void *flow_worker)
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *tv, void *data)
TmEcode(* ThreadInit)(ThreadVars *, const void *, void **)
TmEcode ConfigSetLogDirectory(const char *name)
Packet * PacketGetFromAlloc(void)
Get a malloced packet.
Structure to hold thread specific data for all decode modules.
DecodeThreadVars * DecodeThreadVarsAlloc(ThreadVars *tv)
Alloc and setup DecodeThreadVars.
PacketQueueNoLock decode_pq
int DetectEngineReload(const SCInstance *suri)
Reload the detection engine.
int InitGlobal(void)
Global initialization common to all runmodes.
const char * configNoChecksum
void FlowWorkerReplaceDetectCtx(void *flow_worker, void *detect_ctx)