Merge in SNORT/snort3 from ~MASHASAN/snort3:sticky_verdict to master
Squashed commit of the following:
commit
3bac1487b51334c6ed6caf9549d3efb991f03f68
Author: Masud Hasan <mashasan@cisco.com>
Date: Fri Mar 11 12:53:49 2022 -0500
analyzer: avoid distilling sticky verdicts
// state. Inspector state is stored in FlowData, and Flow manages a list
// of FlowData items.
+#include <daq_common.h>
#include <sys/time.h>
#include "detection/ips_context_chain.h"
FilteringState filtering_state;
+ DAQ_Verdict last_verdict = MAX_DAQ_VERDICT;
+
private:
void clean();
};
return true;
}
+static inline bool is_sticky_verdict(const DAQ_Verdict verdict)
+{
+ return verdict == DAQ_VERDICT_WHITELIST or verdict == DAQ_VERDICT_BLACKLIST
+ or verdict == DAQ_VERDICT_IGNORE;
+}
+
// Finalize DAQ message verdict
static DAQ_Verdict distill_verdict(Packet* p)
{
+ if ( p->flow and is_sticky_verdict(p->flow->last_verdict) )
+ return p->flow->last_verdict;
+
DAQ_Verdict verdict = DAQ_VERDICT_PASS;
Active* act = p->active;
daq_stats.internal_whitelist++;
}
}
+
+ if ( p->flow )
+ p->flow->last_verdict = verdict;
+
return verdict;
}