Skip to content

Commit

Permalink
detect/port: remove the port cut/insertion stage
Browse files Browse the repository at this point in the history
As this is already taken care of and a list of ports is available for
use by the next stage.

Ticket 6792
Bug 6414
  • Loading branch information
inashivb authored and victorjulien committed Mar 4, 2024
1 parent 4ac2382 commit 83aba93
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions src/detect-engine-build.c
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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)
Expand Down

0 comments on commit 83aba93

Please sign in to comment.