]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: fix unittest broken by new flags handling.
authorVictor Julien <victor@inliniac.net>
Wed, 15 Aug 2012 15:13:33 +0000 (17:13 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 15 Aug 2012 15:13:33 +0000 (17:13 +0200)
src/stream-tcp.c

index 6686649886f91bd6cee65e33cd49cc5aae3e96a6..4ea3d4823ba18cd803fe4033af653c1467bd6eb1 100644 (file)
@@ -5066,18 +5066,28 @@ static int StreamTcpTest06 (void) {
     tcph.th_flags = TH_FIN;
     p->tcph = &tcph;
 
-    if (StreamTcpPacket(&tv, p, &stt, &pq) == -1)
+    /* StreamTcpPacket returns -1 on unsolicited FIN */
+    if (StreamTcpPacket(&tv, p, &stt, &pq) != -1) {
+        printf("StreamTcpPacket failed: ");
         goto end;
+    }
 
-    if (((TcpSession *)(p->flow->protoctx)) != NULL)
+    if (((TcpSession *)(p->flow->protoctx)) != NULL) {
+        printf("we have a ssn while we shouldn't: ");
         goto end;
+    }
 
     p->tcph->th_flags = TH_RST;
-    if (StreamTcpPacket(&tv, p, &stt, &pq) == -1)
+    /* StreamTcpPacket returns -1 on unsolicited RST */
+    if (StreamTcpPacket(&tv, p, &stt, &pq) != -1) {
+        printf("StreamTcpPacket failed (2): ");
         goto end;
+    }
 
-    if (((TcpSession *)(p->flow->protoctx)) != NULL)
+    if (((TcpSession *)(p->flow->protoctx)) != NULL) {
+        printf("we have a ssn while we shouldn't (2): ");
         goto end;
+    }
 
     ret = 1;
 end: