From: Victor Julien Date: Sat, 16 Mar 2019 14:01:37 +0000 (+0100) Subject: app-layer/udp: micro optimization X-Git-Tag: suricata-5.0.0-beta1~144 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f44bbd71f56581cfc326b0142a26f51ab65f1db0;p=thirdparty%2Fsuricata.git app-layer/udp: micro optimization --- diff --git a/src/app-layer.c b/src/app-layer.c index 6958de17ee..280151c584 100644 --- a/src/app-layer.c +++ b/src/app-layer.c @@ -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);