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

rust ffi ints/v1 #12009

Merged
merged 2 commits into from
Oct 23, 2024
Merged

rust ffi ints/v1 #12009

merged 2 commits into from
Oct 23, 2024

Conversation

jasonish
Copy link
Member

  • eve/schema: add missing field "code" anomaly events
  • rust/applayer: use c_int as return type for get_info_by_id

Rust was using i8 as the return type, while C uses int. As of Rust
1.82, the return value is turned to garbage over the FFI boundary.

Ticket: OISF#7338
@jasonish jasonish requested review from victorjulien and a team as code owners October 22, 2024 17:12
Copy link

codecov bot commented Oct 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.22%. Comparing base (30806ce) to head (45384ef).
Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12009      +/-   ##
==========================================
- Coverage   83.22%   83.22%   -0.01%     
==========================================
  Files         910      910              
  Lines      258136   258136              
==========================================
- Hits       214831   214825       -6     
- Misses      43305    43311       +6     
Flag Coverage Δ
fuzzcorpus 61.44% <100.00%> (+0.03%) ⬆️
livemode 19.38% <0.00%> (-0.01%) ⬇️
pcap 44.47% <100.00%> (+0.01%) ⬆️
suricata-verify 62.74% <100.00%> (-0.01%) ⬇️
unittests 59.29% <0.00%> (-0.01%) ⬇️

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

@@ -445,7 +445,7 @@ pub type StateGetTxFn = unsafe extern "C" fn (*mut c_void, u64) -> *m
pub type StateGetTxCntFn = unsafe extern "C" fn (*mut c_void) -> u64;
pub type StateGetProgressFn = unsafe extern "C" fn (*mut c_void, u8) -> c_int;
pub type GetEventInfoFn = unsafe extern "C" fn (*const c_char, *mut c_int, *mut AppLayerEventType) -> c_int;
pub type GetEventInfoByIdFn = unsafe extern "C" fn (c_int, *mut *const c_char, *mut AppLayerEventType) -> i8;
pub type GetEventInfoByIdFn = unsafe extern "C" fn (c_int, *mut *const c_char, *mut AppLayerEventType) -> c_int;
Copy link
Member Author

@jasonish jasonish Oct 22, 2024

Choose a reason for hiding this comment

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

That we also use uint8_t and int for the event_type (first argument) in C, while not breaking anything right now, could be a source for error.

@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 23161

@victorjulien victorjulien added this to the 8.0 milestone Oct 23, 2024
@victorjulien victorjulien merged commit 45384ef into OISF:master Oct 23, 2024
61 checks passed
@victorjulien
Copy link
Member

Merged in #12013, thanks!

@jasonish jasonish deleted the rust-ffi-ints/v1 branch October 24, 2024 15:13
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