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

output: Add linktype name #12772

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

output: Add linktype name #12772

wants to merge 3 commits into from

Conversation

jlucovsky
Copy link
Contributor

Continuation of #12497

Issue: 6954

This commit adds the linktype name to the output stream. The name is determined from a Rust linktype-to-name function.

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

Describe changes:

  • Include the linktype name alongside linktype
  • Update the schema with linktype_name
  • Custom linktype to name function in Rust.

Updates:

Provide values to any of the below to override the defaults.

SV_BRANCH=OISF/suricata-verify#2023

Issue: 6954

Add Rust based logic that maintains a hash map of link type values and
their associated output names.
Use the hasmap to gather linktype display names.

Issue: 6954
Issue: 6954

This commit adds the linktype name to the output stream. The name is
determined from the pcap utility function pcap_datalink_val_to_name
Copy link

codecov bot commented Mar 15, 2025

Codecov Report

Attention: Patch coverage is 89.70588% with 7 lines in your changes missing coverage. Please review.

Project coverage is 80.86%. Comparing base (66e47a1) to head (f61c7c9).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12772      +/-   ##
==========================================
- Coverage   80.87%   80.86%   -0.01%     
==========================================
  Files         936      938       +2     
  Lines      259748   259802      +54     
==========================================
+ Hits       210061   210098      +37     
- Misses      49687    49704      +17     
Flag Coverage Δ
fuzzcorpus 57.25% <79.10%> (+<0.01%) ⬆️
livemode 19.43% <68.65%> (-0.01%) ⬇️
pcap 44.17% <67.16%> (+0.06%) ⬆️
suricata-verify 63.65% <88.23%> (-0.06%) ⬇️
unittests 58.16% <58.20%> (+0.01%) ⬆️

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 25140


#[no_mangle]
pub extern "C" fn SCDatalinkInit() -> *mut HashMap<i32, CString> {
let map: HashMap<i32, CString> = HashMap::new();
Copy link
Member

Choose a reason for hiding this comment

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

Q: How many datalink values can we expect to insert in the HashMap?
Or rather, what encouraged the use of a HashMap here?

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 chose a hash map to store the mappings between linktype values and the name as the link type values are established values that are non-sequential. With the small number of entries (12-15), access should be o(1).

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.

3 participants