]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
stream: remove flow reference from StreamMsg
authorVictor Julien <victor@inliniac.net>
Tue, 17 Dec 2013 15:33:26 +0000 (16:33 +0100)
committerVictor Julien <victor@inliniac.net>
Fri, 10 Jan 2014 15:21:55 +0000 (16:21 +0100)
StreamMsg' flow reference was used mostly to make sure a flow would
not get removed from the hash before inspection. For this it needed
to reference the flow use_cnt reference counter. Nowadays we have
more advanced flow timeout handling. This will make sure that if
there still are pending smsgs' in a flow, these will still be
processed.

src/app-layer.c
src/stream-tcp-reassemble.c
src/stream-tcp.c
src/stream.c
src/stream.h

index 490df796dcae2870090a9287e938ac0699e127b7..e88f966581dc9c94850452a585d4d5c6b7ee60a6 100644 (file)
@@ -375,7 +375,6 @@ int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn)
     printf("=> Stream Data -- end\n");
 #endif
     SCLogDebug("smsg %p", smsg);
-    BUG_ON(smsg->flow == NULL);
 
     if (ssn != NULL) {
         SCLogDebug("storing smsg %p in the tcp session", smsg);
@@ -415,14 +414,11 @@ int AppLayerHandleTCPMsg(StreamMsg *smsg, TcpSession *ssn)
             }
         }
 
-        FlowDeReference(&smsg->flow);
     } else { /* no ssn ptr */
         /* if there is no ssn ptr we won't
          * be inspecting this msg in detect
          * so return it to the pool. */
 
-        FlowDeReference(&smsg->flow);
-
         /* return the used message to the queue */
         StreamMsgReturnToPool(smsg);
     }
index b942281f6a28934258d9fc86665bbf2e9030044f..28e0b31fb5e492d3face53838f03f2b061a7ee0d 100644 (file)
@@ -1751,8 +1751,6 @@ static void StreamTcpSetupMsg(TcpSession *ssn, TcpStream *stream, Packet *p,
     }
 
     smsg->data_len = 0;
-    FlowReference(&smsg->flow, p->flow);
-    BUG_ON(smsg->flow == NULL);
 
     SCLogDebug("smsg %p", smsg);
     SCReturn;
@@ -3403,15 +3401,13 @@ int StreamTcpReassembleProcessAppLayer(TcpReassemblyThreadCtx *ra_ctx, TcpSessio
         do {
             smsg = StreamMsgGetFromQueue(ra_ctx->stream_q);
             if (smsg != NULL) {
-                SCLogDebug("smsg %p, next %p, prev %p, flow %p, q->len %u, "
+                SCLogDebug("smsg %p, next %p, prev %p, q->len %u, "
                         "smsg->datalen %u, direction %s%s",
-                        smsg, smsg->next, smsg->prev, smsg->flow,
+                        smsg, smsg->next, smsg->prev,
                         ra_ctx->stream_q->len, smsg->data_len,
                         smsg->flags & STREAM_TOSERVER ? "toserver":"",
                         smsg->flags & STREAM_TOCLIENT ? "toclient":"");
 
-                BUG_ON(smsg->flow == NULL);
-
                 //PrintRawDataFp(stderr, smsg->data, smsg->data_len);
 
                 /* Handle the stream msg. No need to use locking, flow is
index 03d61c1d32b0ba7a776216cfafb97949bcf75e44..26eb59cc1021edddf1e62fb68b17a53915c49767 100644 (file)
@@ -196,7 +196,6 @@ void StreamTcpSessionClear(void *ssnptr)
         SCLogDebug("returning smsg %p to pool", smsg);
         smsg->next = NULL;
         smsg->prev = NULL;
-        FlowDeReference(&smsg->flow);
         StreamMsgReturnToPool(smsg);
         smsg = smsg_next;
     }
@@ -208,7 +207,6 @@ void StreamTcpSessionClear(void *ssnptr)
         SCLogDebug("returning smsg %p to pool", smsg);
         smsg->next = NULL;
         smsg->prev = NULL;
-        FlowDeReference(&smsg->flow);
         StreamMsgReturnToPool(smsg);
         smsg = smsg_next;
     }
@@ -306,7 +304,6 @@ void StreamTcpSessionPoolCleanup(void *s)
         SCLogDebug("returning smsg %p to pool", smsg);
         smsg->next = NULL;
         smsg->prev = NULL;
-        FlowDeReference(&smsg->flow);
         StreamMsgReturnToPool(smsg);
         smsg = smsg_next;
     }
@@ -318,7 +315,6 @@ void StreamTcpSessionPoolCleanup(void *s)
         SCLogDebug("returning smsg %p to pool", smsg);
         smsg->next = NULL;
         smsg->prev = NULL;
-        FlowDeReference(&smsg->flow);
         StreamMsgReturnToPool(smsg);
         smsg = smsg_next;
     }
index 4c9354ae1ce85a8996603385d2f1cba839243e03..3acda3a085e47677160624b42edd51458a22c385 100644 (file)
@@ -216,7 +216,6 @@ void StreamMsgReturnListToPool(void *list) {
         SCLogDebug("returning smsg %p to pool", smsg);
         smsg->next = NULL;
         smsg->prev = NULL;
-        FlowDeReference(&smsg->flow);
         StreamMsgReturnToPool(smsg);
         smsg = smsg_next;
     }
index 764170c03c4236dd653c080127e41098d5e641a7..4d4ccbaa590553c9b26fc9b49124b0bec5bf2271 100644 (file)
@@ -38,7 +38,6 @@
 
 typedef struct StreamMsg_ {
     uint8_t flags;  /**< msg flags */
-    Flow *flow;     /**< parent flow */
 
     struct StreamMsg_ *next;
     struct StreamMsg_ *prev;