]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unittests/enip: Register ENIP unittests
authorJeff Lucovsky <jeff@lucovsky.org>
Thu, 29 Apr 2021 12:49:50 +0000 (08:49 -0400)
committerVictor Julien <victor@inliniac.net>
Sat, 2 Oct 2021 08:46:08 +0000 (10:46 +0200)
src/detect-engine-enip.c
src/runmode-unittests.c

index 49bffa786a81d7fdb533aee67f5611780a7602c5..167cd6573528cffcaa541fa6ebe341eb6ba72b45 100644 (file)
@@ -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);
index 79be365f5d18c809c649bd5dbc80023d720a9f2d..66eccfcb6f936be04c79bd815f604a8a471febbc 100644 (file)
@@ -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();