Completes commit
e2370d6861990e9aba7b551e51cfa04d945f4510
for all the fuzz targets processing pcaps
using a generic function.
FlowShutdown is not used because it uses the loop to destroy
mutexes, which we want to reuse for fuzzing
return;
}
+void FlowReset(void)
+{
+ // resets the flows (for reuse by fuzzing)
+ for (uint32_t u = 0; u < flow_config.hash_size; u++) {
+ Flow *f = flow_hash[u].head;
+ while (f) {
+ Flow *n = f->next;
+ uint8_t proto_map = FlowGetProtoMapping(f->proto);
+ FlowClearMemory(f, proto_map);
+ FlowFree(f);
+ f = n;
+ }
+ flow_hash[u].head = NULL;
+ }
+}
+
/** \brief shutdown the flow engine
* \warning Not thread safe */
void FlowShutdown(void)
void FlowHandlePacket (ThreadVars *, FlowLookupStruct *, Packet *);
void FlowInitConfig(bool);
void FlowPrintQueueInfo (void);
+void FlowReset(void);
void FlowShutdown(void);
void FlowSetIPOnlyFlag(Flow *, int);
void FlowSetHasAlertsFlag(Flow *);
p->pcap_cnt = pcap_cnt;
}
PacketFree(p);
- for (uint32_t u = 0; u < flow_config.hash_size; u++) {
- Flow *f = flow_hash[u].head;
- while (f) {
- Flow *n = f->next;
- uint8_t proto_map = FlowGetProtoMapping(f->proto);
- FlowClearMemory(f, proto_map);
- FlowFree(f);
- f = n;
- }
- flow_hash[u].head = NULL;
- }
+ FlowReset();
return 0;
}
#include "util-unittest-helper.h"
#include "conf-yaml-loader.h"
#include "pkt-var.h"
+#include "flow-util.h"
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size);
//close structure
pcap_close(pkts);
PacketFree(p);
+ FlowReset();
return 0;
}
#include "util-unittest-helper.h"
#include "conf-yaml-loader.h"
#include "pkt-var.h"
+#include "flow-util.h"
#include <fuzz_pcap.h>
p->pcap_cnt = pcap_cnt;
}
PacketFree(p);
+ FlowReset();
return 0;
}