From: Jeff Lucovsky Date: Thu, 29 Apr 2021 12:49:50 +0000 (-0400) Subject: unittests/enip: Register ENIP unittests X-Git-Tag: suricata-7.0.0-beta1~1310 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6e149cdec3aa287c9117feaac6a3d0407ba95853;p=thirdparty%2Fsuricata.git unittests/enip: Register ENIP unittests --- diff --git a/src/detect-engine-enip.c b/src/detect-engine-enip.c index 49bffa786a..167cd65735 100644 --- a/src/detect-engine-enip.c +++ b/src/detect-engine-enip.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2015 Open Information Security Foundation +/* Copyright (C) 2015-2021 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free @@ -291,13 +291,32 @@ int DetectEngineInspectENIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ #include "util-unittest.h" #include "util-unittest-helper.h" -static uint8_t listIdentity[] = {/* List ID */ 0x00, 0x63, - /* Length */ 0x00, 0x00, - /* Session */ 0x00, 0x00, 0x00, 0x00, - /* Status */ 0x00, 0x00, 0x00, 0x00, - /* Delay*/ 0x00, - /* Context */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - /* Quantity of coils */ 0x00, 0x00, 0x00, 0x00,}; +static uint8_t listIdentity[] = { + /* List ID */ 0x63, + 0x00, + /* Length */ 0x00, + 0x00, + /* Session */ 0x00, + 0x00, + 0x00, + 0x00, + /* Status */ 0x00, + 0x00, + 0x00, + 0x00, + /* Delay*/ 0x00, + /* Context */ 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + 0x00, + /* Quantity of coils */ 0x00, + 0x00, + 0x00, + 0x00, + 0x00, +}; /** \test Test code function. */ static int DetectEngineInspectENIPTest01(void) @@ -335,8 +354,8 @@ static int DetectEngineInspectENIPTest01(void) de_ctx->flags |= DE_QUIET; s = de_ctx->sig_list = SigInit(de_ctx, "alert enip any any -> any any " - "(msg:\"Testing enip command\"; " - "enipcommand:99 ; sid:1;)"); + "(msg:\"Testing enip command\"; " + "enip_command:99 ; sid:1;)"); FAIL_IF_NULL(s); SigGroupBuild(de_ctx); diff --git a/src/runmode-unittests.c b/src/runmode-unittests.c index 79be365f5d..66eccfcb6f 100644 --- a/src/runmode-unittests.c +++ b/src/runmode-unittests.c @@ -37,6 +37,7 @@ #include "detect-engine-dcepayload.h" #include "detect-engine-state.h" #include "detect-engine-tag.h" +#include "detect-engine-enip.h" #include "detect-fast-pattern.h" #include "flow.h" #include "flow-timeout.h" @@ -181,6 +182,7 @@ static void RegisterUnittests(void) #endif DeStateRegisterTests(); MemcmpRegisterTests(); + DetectEngineInspectENIPRegisterTests(); DetectEngineRegisterTests(); SCLogRegisterTests(); MagicRegisterTests();