Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mpm cleanups/v2 #9913

Closed
wants to merge 10 commits into from
12 changes: 3 additions & 9 deletions src/util-mpm-ac-ks.c
Original file line number Diff line number Diff line change
Expand Up @@ -1132,7 +1132,6 @@ static int CheckMatch(const SCACTileSearchCtx *ctx, PrefilterRuleStore *pmq,
* pattern is "Foo" and the string is "Foo bar foo", matches would be reported
* as 2, when it should really be 1, since "foo" is not a true match.
*/
matches++;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you've removed the increment here, did you move it elsewhere outside this file? To me it would seem like it doesn't increment currently or it is somehow connected with the changes in the prior commit

But I guess likely the "SCACSearch" counts that for you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the real unique matches were already counted elsewhere, but I realize I should remove the comment

continue;
}
const SCACTilePatternList *pat = &pattern_list[pindex];
Expand Down Expand Up @@ -1613,7 +1612,6 @@ static int SCACTileTest06(void)

static int SCACTileTest07(void)
{
int result = 0;
MpmCtx mpm_ctx;
MpmThreadCtx mpm_thread_ctx;
PrefilterRuleStore pmq;
Expand All @@ -1636,22 +1634,18 @@ static int SCACTileTest07(void)
MpmAddPatternCS(&mpm_ctx, (uint8_t *)"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA",
30, 0, 0, 5, 0, 0);
PmqSetup(&pmq);
/* total matches: 135 */
/* total matches: 135: 6 unique */

SCACTilePreparePatterns(&mpm_ctx);

const char *buf = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";
uint32_t cnt = SCACTileSearch(&mpm_ctx, &mpm_thread_ctx, &pmq,
(uint8_t *)buf, strlen(buf));

if (cnt == 135)
result = 1;
else
printf("135 != %" PRIu32 " ",cnt);
FAIL_IF_NOT(cnt == 6);

SCACTileDestroyCtx(&mpm_ctx);
PmqFree(&pmq);
return result;
PASS;
}

static int SCACTileTest08(void)
Expand Down