]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
app-layer/udp: micro optimization
authorVictor Julien <victor@inliniac.net>
Sat, 16 Mar 2019 14:01:37 +0000 (15:01 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 18 Mar 2019 12:02:08 +0000 (13:02 +0100)
src/app-layer.c

index 6958de17ee42fbc09f60acbe6e4bbd7656a06f2c..280151c5846da3ba3054a7d02f02e9c514eb6c43 100644 (file)
@@ -661,8 +661,11 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
 {
     SCEnter();
 
-    int r = 0;
+    if (f->alproto == ALPROTO_FAILED) {
+        SCReturnInt(0);
+    }
 
+    int r = 0;
     uint8_t flags = 0;
     if (p->flowflags & FLOW_PKT_TOSERVER) {
         flags |= STREAM_TOSERVER;
@@ -670,11 +673,8 @@ int AppLayerHandleUdp(ThreadVars *tv, AppLayerThreadCtx *tctx, Packet *p, Flow *
         flags |= STREAM_TOCLIENT;
     }
 
-    if (f->alproto == ALPROTO_FAILED) {
-        SCReturnInt(0);
-
     /* if the protocol is still unknown, run detection */
-    } else if (f->alproto == ALPROTO_UNKNOWN) {
+    if (f->alproto == ALPROTO_UNKNOWN) {
         SCLogDebug("Detecting AL proto on udp mesg (len %" PRIu32 ")",
                    p->payload_len);