-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
community-id: Fix IPv6 address sorting not respecting byte order #9399
community-id: Fix IPv6 address sorting not respecting byte order #9399
Conversation
When comparing IPv6 addresses based on uint32_t chunks, one needs to apply ntohl() conversion to the individual parts, otherwise on little endian systems individual bytes are compared in the wrong order. Avoid this all and leverage memcmp(), it'll short circuit on the first differing byte and its return values tells us which address sorts lower.
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #9399 +/- ##
==========================================
- Coverage 82.17% 82.16% -0.02%
==========================================
Files 968 968
Lines 274198 274190 -8
==========================================
- Hits 225331 225285 -46
- Misses 48867 48905 +38
Flags with carried forward coverage won't be shown. Click here to find out more. |
Suricata-Verify tests added here: OISF/suricata-verify#1360 Re-running CI to pick up SV PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this fix
Could you just reword the commit to include the redmine ticket reference ?
cf https://docs.suricata.io/en/latest/devguide/codebase/contributing/code-submission-process.html#commits
Here is my feedback :
CI : green
Code : looks good (negative number of lines :-) )
Commits segmentation : ok
Commit messages : Could you put the redmine ticket reference in the commit ?
Git ID set : looks fine for me
CLA : I do not have access, but you say to have signed it
Doc update : not needed
Redmine ticket : ok
Rustfmt : no rust
Tests : S-V looks ok
Dependencies added: none
Already did in a staging branch. |
@jasonish Can you make sure the updated commit is not lost now that the staging branch is closed? |
Done in #9442 |
Make sure these boxes are signed before submitting your Pull Request -- thank you.
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/6276
Describe changes:
When comparing IPv6 addresses based on uint32_t chunks, one needs to apply ntohl() conversion to the individual parts, otherwise on little endian systems individual bytes are compared in the wrong order. Avoid this all and leverage memcmp(), it'll short circuit on the first differing byte and its return values tells us which address sorts lower.
Provide values to any of the below to override the defaults.
To use a pull request use a branch name like
pr/N
whereN
is thepull request number.
Alternatively,
SV_BRANCH
may also be a link to anOISF/suricata-verify pull-request.