Go to the documentation of this file.
30 static int initialized = 0;
42 char errbuf[PCAP_ERRBUF_SIZE];
44 struct pcap_pkthdr *header;
50 if (initialized == 0) {
52 setenv(
"SC_LOG_OP_IFACE",
"file", 0);
53 setenv(
"SC_LOG_FILE",
"/dev/null", 0);
66 remove(
"/tmp/fuzz.rules");
76 memset(&
tv, 0,
sizeof(
tv));
107 for (pos=0; pos < size; pos++) {
108 if (data[pos] == 0) {
112 if (pos > 0 && pos < size) {
148 pkts = pcap_open_offline(
"/tmp/fuzz.pcap", errbuf);
154 r = pcap_next_ex(pkts, &header, &pkt);
156 p->
ts.tv_sec = header->ts.tv_sec;
157 p->
ts.tv_usec = header->ts.tv_usec % 1000000;
167 while (extra_p != NULL) {
173 while (extra_p != NULL) {
178 r = pcap_next_ex(pkts, &header, &pkt);
180 p->
ts.tv_sec = header->ts.tv_sec;
181 p->
ts.tv_usec = header->ts.tv_usec % 1000000;
struct FlowQueue_ * flow_queue
DetectEngineThreadCtx * DetectEngineThreadCtxInitForReload(ThreadVars *tv, DetectEngineCtx *new_de_ctx, int mt)
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.
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
main detection engine ctx
DetectEngineCtx * DetectEngineGetCurrent(void)
int StatsSetupPrivate(ThreadVars *tv)
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.
TmEcode(* Func)(ThreadVars *, Packet *, void *)
void PacketFree(Packet *p)
Return a malloced packet.
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)
void * FlowWorkerGetDetectCtxPtr(void *flow_worker)
TmEcode DetectEngineThreadCtxDeinit(ThreadVars *, void *)
const char configNoChecksum[]
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
FlowQueue * FlowQueueNew()
int DetectEngineReload(const SCInstance *suri)
Reload the detection engine.
int InitGlobal(void)
Global initialization common to all runmodes.
#define PACKET_RECYCLE(p)
void FlowWorkerReplaceDetectCtx(void *flow_worker, void *detect_ctx)