return alproto;
}
+void AppLayerExpectationClean(Flow *f)
+{
+ IPPair *ipp = NULL;
+ Expectation *exp = NULL;
+ Expectation *pexp = NULL;
+
+ int x = SC_ATOMIC_GET(expectation_count);
+ if (x == 0) {
+ return;
+ }
+
+ /* Call will take reference of the ip pair in 'ipp' */
+ ExpectationList *exp_list = AppLayerExpectationLookup(f, &ipp);
+ if (exp_list == NULL)
+ goto out;
+
+ CIRCLEQ_FOREACH_SAFE(exp, &exp_list->list, entries, pexp) {
+ /* Cleaning remove old entries */
+ if (exp->orig_f == (void *)f) {
+ exp_list = AppLayerExpectationRemove(ipp, exp_list, exp);
+ if (exp_list == NULL)
+ goto out;
+ }
+ }
+
+out:
+ if (ipp)
+ IPPairRelease(ipp);
+ return;
+}
+
/**
* @}
*/
AppProto AppLayerExpectationHandle(Flow *f, int direction);
int AppLayerExpectationGetDataId(void);
+void AppLayerExpectationClean(Flow *f);
+
uint64_t ExpectationGetCounter(void);
#endif /* __APP_LAYER_EXPECTATION__H__ */
#include "stream.h"
#include "app-layer-parser.h"
+#include "app-layer-expectation.h"
#define FLOW_DEFAULT_EMERGENCY_RECOVERY 30
FlowFreeStorage(f);
+ if (f->flags & FLOW_HAS_EXPECTATION)
+ AppLayerExpectationClean(f);
+
FLOW_RECYCLE(f);
SCReturnInt(1);
#define FLOW_WRONG_THREAD BIT_U32(25)
/** Protocol detection told us flow is picked up in wrong direction (midstream) */
#define FLOW_DIR_REVERSED BIT_U32(26)
+/** Indicate that the flow did trigger an expectation creation */
+#define FLOW_HAS_EXPECTATION BIT_U32(27)
/* File flags */