]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
flow worker: move UDP app-layer into main function 2118/head
authorVictor Julien <victor@inliniac.net>
Sun, 29 May 2016 09:29:30 +0000 (11:29 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 30 May 2016 08:56:30 +0000 (10:56 +0200)
This way it's more clean what happens and we can profile it.

src/flow-worker.c
src/flow-worker.h

index 21a210fee72b27becc7dcec9bb21e1f436ed9f02..4f96ac1f63e6ccdcd08f89805e175de7e77d8937 100644 (file)
@@ -73,11 +73,6 @@ typedef struct FlowWorkerThreadData_ {
 static void FlowUpdate(ThreadVars *tv, StreamTcpThread *stt, Packet *p)
 {
     FlowHandlePacketUpdate(p->flow, p);
-
-    /* handle the app layer part of the UDP packet payload */
-    if (p->proto == IPPROTO_UDP) {
-        AppLayerHandleUdp(tv, stt->ra_ctx->app_tctx, p, p->flow);
-    }
 }
 
 static TmEcode FlowWorkerThreadInit(ThreadVars *tv, void *initdata, void **data)
@@ -206,6 +201,12 @@ TmEcode FlowWorker(ThreadVars *tv, Packet *p, void *data, PacketQueue *preq, Pac
              * by the other thread modules before packet 'p'. */
             PacketEnqueue(preq, x);
         }
+
+    /* handle the app layer part of the UDP packet payload */
+    } else if (p->flow && p->proto == IPPROTO_UDP) {
+        FLOWWORKER_PROFILING_START(p, PROFILE_FLOWWORKER_APPLAYERUDP);
+        AppLayerHandleUdp(tv, fw->stream_thread->ra_ctx->app_tctx, p, p->flow);
+        FLOWWORKER_PROFILING_END(p, PROFILE_FLOWWORKER_APPLAYERUDP);
     }
 
     /* handle Detect */
@@ -252,6 +253,8 @@ const char *ProfileFlowWorkerIdToString(enum ProfileFlowWorkerId fwi)
             return "flow";
         case PROFILE_FLOWWORKER_STREAM:
             return "stream";
+        case PROFILE_FLOWWORKER_APPLAYERUDP:
+            return "app-layer";
         case PROFILE_FLOWWORKER_DETECT:
             return "detect";
         case PROFILE_FLOWWORKER_SIZE:
index bda621063c66f88f4583e3e336e505c6b4933a9a..418ea05d6ca864c609f337212067166a34de7e9f 100644 (file)
@@ -21,6 +21,7 @@
 enum ProfileFlowWorkerId {
     PROFILE_FLOWWORKER_FLOW = 0,
     PROFILE_FLOWWORKER_STREAM,
+    PROFILE_FLOWWORKER_APPLAYERUDP,
     PROFILE_FLOWWORKER_DETECT,
     PROFILE_FLOWWORKER_SIZE
 };