From b970273163a43ef55725687ab8f81075c79c36db Mon Sep 17 00:00:00 2001 From: Anoop Saldanha Date: Wed, 7 Dec 2011 12:01:54 +0530 Subject: [PATCH] fix broken unittest --- src/detect.c | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/detect.c b/src/detect.c index 0c4a6dbb56..799f4d2eee 100644 --- a/src/detect.c +++ b/src/detect.c @@ -10520,11 +10520,23 @@ static int SigTestDropFlow04(void) goto end; } + if (PacketAlertCheck(p1, 2)) { + printf("sig 2 alerted on p1, but it should not: "); + goto end; + } + if ( !(p1->flow->flags & FLOW_ACTION_DROP)) { printf("sig 1 alerted but flow was not flagged correctly: "); goto end; } + if (!(p1->action & ACTION_DROP)) { + printf("A \"drop\" action was set from the flow to the packet " + "which is right, but setting the flag shouldn't disable " + "inspection on the packet in IDS mode"); + goto end; + } + /* Second part.. Let's feed with another packet */ if (StreamTcpCheckFlowDrops(p2) == 1) { FlowSetNoPacketInspectionFlag(p2->flow); @@ -10550,7 +10562,7 @@ static int SigTestDropFlow04(void) SigMatchSignatures(&tv, de_ctx, det_ctx, p2); if (PacketAlertCheck(p2, 1)) { - printf("sig 1 alerted, but it should not since the no pkt inspection should be set: "); + printf("sig 1 alerted, but it should not: "); goto end; } @@ -10559,8 +10571,10 @@ static int SigTestDropFlow04(void) goto end; } - if (p2->action & ACTION_DROP) { - printf("A \"drop\" action was set from the flow to the packet, but on IDS mode it whould not (it should be inspected as usual: "); + if (!(p2->action & ACTION_DROP)) { + printf("A \"drop\" action was set from the flow to the packet " + "which is right, but setting the flag shouldn't disable " + "inspection on the packet in IDS mode"); goto end; }