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

dns: add dns.rcode keyword v7 #10249

Closed

Conversation

hadiqaalamdar
Copy link
Contributor

@hadiqaalamdar hadiqaalamdar commented Jan 25, 2024

Feature #6621

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

Previous PR: #10233

Describe changes:

  • made the suggested changes from the previous PR
  • modified the code to implement DetectUintData<u8> instead of simple u8
  • SV tests are running successfully
  • Added documentation for rcode in doc/userguide/rules/dns-keywords.rst file.
  • successfully ran the following tests:
  • from rust dir: make check
  • from rust dir: cargo test
  • from rust dir: cargo clippy --all-features
  • from rust dir: rustfmt src/dns/*
  • from suricata dir: ./scripts/clang-format.sh check-branch
  • from suricata dir: ./scripts/clang-format.sh branch
  • from suricata dir running ./src/suricata -u showed that one unit test had failed.
  • from suricata dir running ./src/suricata -u -U dns showed 7 tests passed.

SV_BRANCH=OISF/suricata-verify#1578

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
Comment on lines +131 to +135
} else if let Some(response) = &tx.response {
response.header.flags
} else {
return 0;
};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

When I ran the tests mentioned in the description of the PR they all came back successful. This is the a major change I made from the last PR. Please let me know if this is correct or if it is causing the check failures?

Copy link
Contributor

Choose a reason for hiding this comment

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

The test that is failing is requires https://github.com/OISF/suricata/actions/runs/7655557469/job/20861980818#step:19:85
As you pointed out in a chat, I think that the failures are due to the fact that your SV PR has tests that are outdated, since your Suri PR is current to Suri master.
My guess is that if you rebase and submit a new SV PR, ci checks will go green again :)

Copy link
Contributor

Choose a reason for hiding this comment

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

To answer your question directly: overall, this looks correct to me :)

Comment on lines +286 to +295
4u8,
));

assert!(!detect_match_uint(
&DetectUintData {
mode: DetectUintMode::DetectUintModeNe,
arg1: 4,
arg2: 0,
},
4u8,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also made the change to 4u8 which is different from the previous PR. I'm just highlighting the changes so it's easier to troubleshoot the reason for check failures.

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.

The changes look mostly good to me, left a comment answer your question about the CI failures.

One inline question that was left answered from the previous commit. I will add a follow-up comment on the SV PR that relates to it :)

Comment on lines +131 to +135
} else if let Some(response) = &tx.response {
response.header.flags
} else {
return 0;
};
Copy link
Contributor

Choose a reason for hiding this comment

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

To answer your question directly: overall, this looks correct to me :)

return 0;
};

let rcode = (header_flags & 0xf) as u8;
Copy link
Contributor

Choose a reason for hiding this comment

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

As Philippe asked herehttps://github.com//pull/10233/files/a122126f2541f3e09c703de68444f39683e7848c#r1464948794 - could this be 23, in the end, as we know from the specifications that it can?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not really sure if I understand what you mean.

Copy link
Contributor

Choose a reason for hiding this comment

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

Although this needed to be addressed, I introduced some noise with my question.
But we've discussed this in our weekly call, conclusion was that:

  • commit message should be updated
  • documentation should indicate that current version covers the RFC specification for rcodes up to 15, and share redmine ticket link as well as related RFC.

@jufajardini
Copy link
Contributor

Followed by #10438

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