]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect-engine-enip: remove unittests
authorModupe Falodun <falodunmodupeola@gmail.com>
Tue, 1 Feb 2022 22:24:05 +0000 (23:24 +0100)
committerVictor Julien <vjulien@oisf.net>
Thu, 3 Feb 2022 19:18:23 +0000 (20:18 +0100)
These test is reimplemented in Suricata-Verify

Task: 4911

src/detect-engine-enip.c
src/detect-engine-enip.h
src/runmode-unittests.c

index 167cd6573528cffcaa541fa6ebe341eb6ba72b45..c6f5d570ea8cf755cf9e8797b809c1a8277a518a 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2015-2021 Open Information Security Foundation
+/* Copyright (C) 2015-2022 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
@@ -281,115 +281,3 @@ int DetectEngineInspectENIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_
 
     SCReturnInt(0);
 }
-
-#ifdef UNITTESTS /* UNITTESTS */
-#include "app-layer-parser.h"
-#include "detect-parse.h"
-#include "detect-engine.h"
-#include "flow-util.h"
-#include "stream-tcp.h"
-#include "util-unittest.h"
-#include "util-unittest-helper.h"
-
-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)
-{
-    AppLayerParserThreadCtx *alp_tctx = AppLayerParserThreadCtxAlloc();
-    DetectEngineThreadCtx *det_ctx = NULL;
-    DetectEngineCtx *de_ctx = NULL;
-    Flow f;
-    Packet *p = NULL;
-    Signature *s = NULL;
-    TcpSession ssn;
-    ThreadVars tv;
-
-    memset(&tv, 0, sizeof(ThreadVars));
-    memset(&f, 0, sizeof(Flow));
-    memset(&ssn, 0, sizeof(TcpSession));
-
-    p = UTHBuildPacket(listIdentity, sizeof(listIdentity), IPPROTO_TCP);
-    FAIL_IF_NULL(p);
-
-    FLOW_INITIALIZE(&f);
-    f.alproto   = ALPROTO_ENIP;
-    f.protoctx  = (void *)&ssn;
-    f.proto     = IPPROTO_TCP;
-    f.flags     |= FLOW_IPV4;
-
-    p->flow         = &f;
-    p->flags        |= PKT_HAS_FLOW | PKT_STREAM_EST;
-    p->flowflags    |= FLOW_PKT_TOSERVER | FLOW_PKT_ESTABLISHED;
-
-    StreamTcpInitConfig(true);
-
-    de_ctx = DetectEngineCtxInit();
-    FAIL_IF_NULL(de_ctx);
-
-    de_ctx->flags |= DE_QUIET;
-    s = de_ctx->sig_list = SigInit(de_ctx, "alert enip any any -> any any "
-                                           "(msg:\"Testing enip command\"; "
-                                           "enip_command:99 ; sid:1;)");
-    FAIL_IF_NULL(s);
-
-    SigGroupBuild(de_ctx);
-    DetectEngineThreadCtxInit(&tv, (void *)de_ctx, (void *)&det_ctx);
-
-    int r = AppLayerParserParse(NULL, alp_tctx, &f, ALPROTO_ENIP, STREAM_TOSERVER,
-            listIdentity, sizeof(listIdentity));
-    FAIL_IF(r != 0);
-
-    ENIPState    *enip_state = f.alstate;
-    FAIL_IF_NULL(enip_state);
-
-    /* do detect */
-    SigMatchSignatures(&tv, de_ctx, det_ctx, p);
-
-    FAIL_IF(!(PacketAlertCheck(p, 1)));
-
-    AppLayerParserThreadCtxFree(alp_tctx);
-    DetectEngineThreadCtxDeinit(&tv, det_ctx);
-    DetectEngineCtxFree(de_ctx);
-
-    StreamTcpFreeConfig(true);
-    FLOW_DESTROY(&f);
-    UTHFreePacket(p);
-
-    PASS;
-}
-
-#endif /* UNITTESTS */
-
-void DetectEngineInspectENIPRegisterTests(void)
-{
-#ifdef UNITTESTS
-    UtRegisterTest("DetectEngineInspectENIPTest01", DetectEngineInspectENIPTest01);
-#endif /* UNITTESTS */
-    return;
-}
index 37dbb8e1c7b11ff66223d939e2a3957451d6167a..4ef333b200d4ae4bc142355e0f0ed9f13e6342f9 100644 (file)
@@ -31,5 +31,4 @@ int DetectEngineInspectENIP(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *,
         const struct DetectEngineAppInspectionEngine_ *, const Signature *, Flow *, uint8_t, void *,
         void *, uint64_t);
 
-void DetectEngineInspectENIPRegisterTests(void);
 #endif /* __DETECT_ENGINE_ENIP_H__ */
index 66eccfcb6f936be04c79bd815f604a8a471febbc..a0aa2c3233ba0197d79b6152a0d166158c48d12c 100644 (file)
@@ -182,7 +182,6 @@ static void RegisterUnittests(void)
 #endif
     DeStateRegisterTests();
     MemcmpRegisterTests();
-    DetectEngineInspectENIPRegisterTests();
     DetectEngineRegisterTests();
     SCLogRegisterTests();
     MagicRegisterTests();