FlowInit() will only be called on a newly allocated, or a fully cleaned
up flow, so no existing storage will exist.
The only caller of `FLOW_RECYCLE` first calls `FlowFreeStorage()`, so
the reset logic in `FLOW_RECYCLE` can never trigger.
Remove now unused MacSetReset logic.
f->timeout_at = timeout_at;
if (MacSetFlowStorageEnabled()) {
- MacSet *ms = FlowGetStorageById(f, MacSetGetFlowStorageID());
- if (ms != NULL) {
- MacSetReset(ms);
- } else {
- ms = MacSetInit(10);
- FlowSetStorageById(f, MacSetGetFlowStorageID(), ms);
- }
+ DEBUG_VALIDATE_BUG_ON(FlowGetStorageById(f, MacSetGetFlowStorageID()) != NULL);
+ MacSet *ms = MacSetInit(10);
+ FlowSetStorageById(f, MacSetGetFlowStorageID(), ms);
}
SCReturn;
(f)->sgh_toclient = NULL; \
GenericVarFree((f)->flowvar); \
(f)->flowvar = NULL; \
- if (MacSetFlowStorageEnabled()) { \
- MacSet *ms = FlowGetStorageById((f), MacSetGetFlowStorageID()); \
- if (ms != NULL) { \
- MacSetReset(ms); \
- } \
- } \
RESET_COUNTERS((f)); \
} while (0)
return size;
}
-void MacSetReset(MacSet *ms)
-{
- if (ms == NULL)
- return;
- ms->state[MAC_SET_SRC] = ms->state[MAC_SET_DST] = EMPTY_SET;
- ms->last[MAC_SET_SRC] = ms->last[MAC_SET_DST] = 0;
-}
-
void MacSetFree(MacSet *ms)
{
size_t total_free = 0;
ret = MacSetForEach(ms, CheckTest1Membership, &i);
FAIL_IF_NOT(ret == 0);
- MacSetReset(ms);
- FAIL_IF_NOT(MacSetSize(ms) == 0);
-
- MacSetAdd(ms, addr2, addr3);
- FAIL_IF_NOT(MacSetSize(ms) == 2);
-
- i = 1;
- ret = MacSetForEach(ms, CheckTest1Membership, &i);
- FAIL_IF_NOT(ret == 0);
-
MacSetFree(ms);
PASS;
}