]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
Only set SIG_FLAG_REQUIRE_STREAM if signature inspects TCP.
authorVictor Julien <victor@inliniac.net>
Fri, 17 Aug 2012 09:07:48 +0000 (11:07 +0200)
committerVictor Julien <victor@inliniac.net>
Fri, 17 Aug 2012 09:07:48 +0000 (11:07 +0200)
src/detect-parse.c

index bd766b8fffb1e6d182af4bb36cb810c5ccec49ab..0165fcf39c42d15758f287737d557eb4cbba4e08 100644 (file)
@@ -1121,17 +1121,20 @@ static int SigValidate(Signature *s) {
         }
     }
 
-    if (!(s->flags & (SIG_FLAG_REQUIRE_PACKET | SIG_FLAG_REQUIRE_STREAM))) {
-        s->flags |= SIG_FLAG_REQUIRE_STREAM;
-        SigMatch *sm = s->sm_lists[DETECT_SM_LIST_PMATCH];
-        while (sm != NULL) {
-            if (sm->type == DETECT_CONTENT &&
-                (((DetectContentData *)(sm->ctx))->flags &
-                 (DETECT_CONTENT_DEPTH | DETECT_CONTENT_OFFSET))) {
-                s->flags |= SIG_FLAG_REQUIRE_PACKET;
-                break;
+    /* TCP: pkt vs stream vs depth/offset */
+    if (s->proto.proto[IPPROTO_TCP / 8] & (1 << (IPPROTO_TCP % 8))) {
+        if (!(s->flags & (SIG_FLAG_REQUIRE_PACKET | SIG_FLAG_REQUIRE_STREAM))) {
+            s->flags |= SIG_FLAG_REQUIRE_STREAM;
+            SigMatch *sm = s->sm_lists[DETECT_SM_LIST_PMATCH];
+            while (sm != NULL) {
+                if (sm->type == DETECT_CONTENT &&
+                        (((DetectContentData *)(sm->ctx))->flags &
+                         (DETECT_CONTENT_DEPTH | DETECT_CONTENT_OFFSET))) {
+                    s->flags |= SIG_FLAG_REQUIRE_PACKET;
+                    break;
+                }
+                sm = sm->next;
             }
-            sm = sm->next;
         }
     }