]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer: fix args to state progress calls
authorVictor Julien <victor@inliniac.net>
Wed, 15 Jul 2015 11:08:22 +0000 (13:08 +0200)
committerVictor Julien <victor@inliniac.net>
Wed, 22 Jul 2015 10:13:43 +0000 (12:13 +0200)
src/output-streaming.c
src/output-tx.c

index 35e40d0c62442012b0ea4adfef1d8ccb7a3fb620..bc2a7d4be03d74b582d335c5969de6e4e239efef 100644 (file)
@@ -147,9 +147,11 @@ int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags)
     HtpState *s = f->alstate;
     if (s != NULL && s->conn != NULL) {
         int tx_progress_done_value_ts =
-            AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP, ALPROTO_HTTP, 0);
+            AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP,
+                                                           ALPROTO_HTTP, STREAM_TOSERVER);
         int tx_progress_done_value_tc =
-            AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP, ALPROTO_HTTP, 1);
+            AppLayerParserGetStateProgressCompletionStatus(IPPROTO_TCP,
+                                                           ALPROTO_HTTP, STREAM_TOCLIENT);
 
         // for each tx
         uint64_t tx_id = 0;
@@ -161,9 +163,11 @@ int HttpBodyIterator(Flow *f, int close, void *cbdata, uint8_t iflags)
                 int tx_done = 0;
                 int tx_logged = 0;
 
-                int tx_progress_ts = AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP, tx, 0);
+                int tx_progress_ts = AppLayerParserGetStateProgress(
+                        IPPROTO_TCP, ALPROTO_HTTP, tx, STREAM_TOSERVER);
                 if (tx_progress_ts >= tx_progress_done_value_ts) {
-                    int tx_progress_tc = AppLayerParserGetStateProgress(IPPROTO_TCP, ALPROTO_HTTP, tx, 1);
+                    int tx_progress_tc = AppLayerParserGetStateProgress(
+                            IPPROTO_TCP, ALPROTO_HTTP, tx, STREAM_TOCLIENT);
                     if (tx_progress_tc >= tx_progress_done_value_tc) {
                         tx_done = 1;
                     }
index 9bb7c277db6b453720d8baee521a12c755bb0228..aa48d9e121c6bd00ab77ed94c344c2822a934883 100644 (file)
@@ -104,14 +104,14 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ
     Flow * const f = p->flow;
 
     FLOWLOCK_WRLOCK(f); /* WRITE lock before we updated flow logged id */
-    AppProto alproto = f->alproto;//AppLayerGetProtoFromPacket(p);
+    AppProto alproto = f->alproto;
 
     if (AppLayerParserProtocolIsTxAware(p->proto, alproto) == 0)
         goto end;
     if (AppLayerParserProtocolHasLogger(p->proto, alproto) == 0)
         goto end;
 
-    void *alstate = f->alstate;//AppLayerGetProtoStateFromPacket((const Packet *)p);
+    void *alstate = f->alstate;
     if (alstate == NULL) {
         SCLogDebug("no alstate");
         goto end;
@@ -120,9 +120,11 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ
     uint64_t total_txs = AppLayerParserGetTxCnt(p->proto, alproto, alstate);
     uint64_t tx_id = AppLayerParserGetTransactionLogId(f->alparser);
     int tx_progress_done_value_ts =
-        AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto, 0);
+        AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto,
+                                                       STREAM_TOSERVER);
     int tx_progress_done_value_tc =
-        AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto, 1);
+        AppLayerParserGetStateProgressCompletionStatus(p->proto, alproto,
+                                                       STREAM_TOCLIENT);
     int proto_logged = 0;
 
     for (; tx_id < total_txs; tx_id++)
@@ -135,13 +137,15 @@ static TmEcode OutputTxLog(ThreadVars *tv, Packet *p, void *thread_data, PacketQ
 
         if (!(AppLayerParserStateIssetFlag(f->alparser, APP_LAYER_PARSER_EOF)))
         {
-            int tx_progress = AppLayerParserGetStateProgress(p->proto, alproto, tx, 0);
+            int tx_progress = AppLayerParserGetStateProgress(p->proto, alproto,
+                                                             tx, STREAM_TOSERVER);
             if (tx_progress < tx_progress_done_value_ts) {
                 SCLogDebug("progress not far enough, not logging");
                 break;
             }
 
-            tx_progress = AppLayerParserGetStateProgress(p->proto, alproto, tx, 1);
+            tx_progress = AppLayerParserGetStateProgress(p->proto, alproto,
+                                                         tx, STREAM_TOCLIENT);
             if (tx_progress < tx_progress_done_value_tc) {
                 SCLogDebug("progress not far enough, not logging");
                 break;