]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
detect/port: remove the port cut/insertion stage
authorShivani Bhardwaj <shivani@oisf.net>
Tue, 20 Feb 2024 16:23:14 +0000 (21:53 +0530)
committerVictor Julien <victor@inliniac.net>
Mon, 4 Mar 2024 10:50:30 +0000 (11:50 +0100)
As this is already taken care of and a list of ports is available for
use by the next stage.

Ticket 6792
Bug 6414

src/detect-engine-build.c

index b9e283bcc4a783938ee8be68001309e30d5703d0..bc399f2e507de9f0b254d01c67e40bdd2df7d55a 100644 (file)
@@ -1354,6 +1354,9 @@ static DetectPort *RulesGroupByPorts(DetectEngineCtx *de_ctx, uint8_t ipproto, u
         s = s->next;
     }
 
+    /* step 2: create a list of the smallest port ranges with
+     * appropriate SGHs */
+
     /* Create an interval tree of all the given ports to make the search
      * for overlaps later on easier */
     SCPortIntervalTree *it = SCPortIntervalTreeInit();
@@ -1370,17 +1373,6 @@ static DetectPort *RulesGroupByPorts(DetectEngineCtx *de_ctx, uint8_t ipproto, u
         }
     }
 
-    /* step 2: create a list of DetectPort objects */
-    for (htb = HashListTableGetListHead(de_ctx->dport_hash_table);
-            htb != NULL;
-            htb = HashListTableGetListNext(htb))
-    {
-        DetectPort *p = HashListTableGetListData(htb);
-        DetectPort *tmp = DetectPortCopySingle(de_ctx, p);
-        BUG_ON(tmp == NULL);
-        int r = DetectPortInsert(de_ctx, &list , tmp);
-        BUG_ON(r == -1);
-    }
     /* Create a sorted list of ports in ascending order after resolving overlaps
      * and corresponding SGHs */
     if (CreatePortList(de_ctx, unique_port_points, size_unique_port_arr, it, &list) < 0)