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

detect-id: convert unittests to FAIL/PASS APIs #6621

Closed

Conversation

TheKharleeci
Copy link
Contributor

@TheKharleeci TheKharleeci commented Nov 19, 2021

Make sure these boxes are signed before submitting your Pull Request -- thank you.

Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4046

Ticket: #4046

Previous PR: #6619

Describe changes:

  • Update detect-id unit tests to use FAIL/PASS APIs
  • Update Copyright Year

@codecov
Copy link

codecov bot commented Nov 19, 2021

Codecov Report

Merging #6621 (6584ff9) into master (6cb6225) will increase coverage by 0.02%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #6621      +/-   ##
==========================================
+ Coverage   77.05%   77.08%   +0.02%     
==========================================
  Files         613      613              
  Lines      186203   186179      -24     
==========================================
+ Hits       143482   143512      +30     
+ Misses      42721    42667      -54     
Flag Coverage Δ
fuzzcorpus 52.99% <ø> (+0.07%) ⬆️
suricata-verify 52.14% <ø> (-0.02%) ⬇️
unittests 63.07% <100.00%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link
Contributor

@jufajardini jufajardini left a comment

Choose a reason for hiding this comment

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

Looking good, except for DetectIdTestMatch01 which needs some adjustment :)

Comment on lines -373 to -389
const char *sigs[3];
sigs[0]= "alert ip any any -> any any (msg:\"Testing id 1\"; id:1234; sid:1;)";
sigs[1]= "alert ip any any -> any any (msg:\"Testing id 2\"; id:5678; sid:2;)";
sigs[2]= "alert ip any any -> any any (msg:\"Testing id 3\"; id:5101; sid:3;)";

uint32_t sid[3] = {1, 2, 3};

uint32_t results[3][3] = {
/* packet 0 match sid 1 but should not match sid 2 */
{1, 0, 0},
/* packet 1 should not match */
{0, 1, 0},
/* packet 2 should not match */
{0, 0, 1} };

result = UTHGenericTest(p, 3, sigs, sid, (uint32_t *) results, 3);

Copy link
Contributor

Choose a reason for hiding this comment

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

If we deleted these, we would be deleting the core of this test ;)

/* packet 2 should not match */
{0, 0, 1} };

result = UTHGenericTest(p, 3, sigs, sid, (uint32_t *) results, 3);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think a check like

FAIL_IF_NOT(UTHGenericTest(p, 3, sigs, sid, (uint32_t *) results, 3));

here would work :)

@TheKharleeci
Copy link
Contributor Author

Followed by: #6626

hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Dec 21, 2023
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Dec 26, 2023
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 5, 2024
@hadiqaalamdar hadiqaalamdar mentioned this pull request Jan 5, 2024
3 tasks
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 11, 2024
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 19, 2024
hadiqaalamdar pushed a commit to hadiqaalamdar/suricata that referenced this pull request Jan 19, 2024
dns: add dns.rcode keyword

Feature OISF#6621
It matches the rcode field in DNS
It's an integer match
valid ranges = 0-23
Does not support prefilter
Supports flow in client direction
hadiqaalamdar pushed a commit to hadiqaalamdar/suricata that referenced this pull request Jan 19, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an integer match
valid ranges = 0-23
Does not support prefilter
Supports flow in client direction
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 24, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-23]
Does not support prefilter
Supports flow in client direction
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 24, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-23]
Does not support prefilter
Supports flow in client direction
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 24, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-23]
Does not support prefilter
Supports flow in client direction
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Jan 25, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-23]
Does not support prefilter
Supports flow in both directions
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Feb 15, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-15]
Does not support prefilter
Supports flow in both directions
hadiqaalamdar added a commit to hadiqaalamdar/suricata that referenced this pull request Feb 19, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-15]
Does not support prefilter
Supports flow in both directions
jufajardini pushed a commit to jufajardini/suricata that referenced this pull request Mar 5, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-15]
Does not support prefilter
Supports flow in both directions
jufajardini pushed a commit to jufajardini/suricata that referenced this pull request Mar 5, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-15]
Does not support prefilter
Supports flow in both directions
jufajardini pushed a commit to jufajardini/suricata that referenced this pull request Mar 5, 2024
Feature OISF#6621
It matches the rcode field in DNS
It's an unsigned integer match
valid ranges = [0-15]
Does not support prefilter
Supports flow in both directions
jufajardini pushed a commit to jufajardini/suricata that referenced this pull request Mar 5, 2024
dns.rcode matches the rcode header field in DNS messages
It's an unsigned integer
valid ranges = [0-15]
Does not support prefilter
Supports matches in both flow directions

Task OISF#6621
victorjulien pushed a commit to victorjulien/suricata that referenced this pull request Mar 9, 2024
dns.rcode matches the rcode header field in DNS messages
It's an unsigned integer
valid ranges = [0-15]
Does not support prefilter
Supports matches in both flow directions

Task OISF#6621
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants