output/ipv6: Add configuration option to shorten IPv6 IP addresses #14636
output/ipv6: Add configuration option to shorten IPv6 IP addresses #14636
Conversation
Issue: 7399 Use shortened IPv6 addresses in all output when configured. IPv6 addresses are shortened per RFC5952 By default, IPv6 addresses are never shortened; set logging.ipv6-addr-shorten=yes to shorten. Added Rust utility function to create shortened IPv6 address.
Document the configuration variable logging.ipv6-addr-shorten Issue: 7399
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #14636 +/- ##
==========================================
+ Coverage 82.10% 82.11% +0.01%
==========================================
Files 1015 1016 +1
Lines 262771 262888 +117
==========================================
+ Hits 215752 215881 +129
+ Misses 47019 47007 -12
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Information: QA ran without warnings. Pipeline = 29157 |
catenacyber
left a comment
There was a problem hiding this comment.
Thanks for the work,
CI : ✅
Code : looking
Commits segmentation : I would squash them, but ok...
Commit messages : 🟡 it is not logging.ipv6-addr-shorten anymore but the commit message says it is
Git ID set : looks fine for me
CLA : you already contributed
Doc update : good
Redmine ticket : ok
Rustfmt : good
Tests : 🟡 there are some unanswered questions/comments on the SV PR
Dependencies added: none
| let bytes = std::slice::from_raw_parts(addr, 16); | ||
|
|
||
| let mut fixed = [0u8; 16]; | ||
| fixed.copy_from_slice(bytes); |
There was a problem hiding this comment.
@jasonish do we need the copy ? Can we not use the addr pointer and cast it to a 16-byte array ? (instead of a slice)
| return 0; | ||
| } | ||
|
|
||
| // Copy string + NULL termination |
There was a problem hiding this comment.
This does not do NULL-termination, does it ?
It relies on the caller having nulled the buffer before, right ?
|
|
||
| // Sufficient room? | ||
| if ipv6_str.len() + 1 > out_len { | ||
| return 0; |
There was a problem hiding this comment.
add a debug valdation as this should never happen ?
|
Continued in #14770 |
Continuation of #14458
Add a configuration option for outputting shortened IPv6 addresses per RFC-5952
The configuration option:
logging.ipv6-addr-shortenhas a default value ofno.When set to
yes, IPv6 addresses will be shortened everywhere they are output. E.g., the IPv6 addressfe80:0000:0000:0000:020c:29ff:faf2:ab42will be output asfe80::20c:29ff:faf2:ab42Link to ticket: https://redmine.openinfosecfoundation.org/issues/7399
Describe changes:
Updates:
min-versionrustfmtfromProvide values to any of the below to override the defaults.
link to the pull request in the respective
_BRANCHvariable.SV_REPO=
SV_BRANCH=OISF/suricata-verify#2789
SU_REPO=
SU_BRANCH=