Project

General

Profile

Actions

Task #3334

open

rust: cleanup registration of C function pointers in SuricataContext

Added by Jason Ish about 5 years ago. Updated 5 months ago.

Status:
New
Priority:
Normal
Assignee:
Target version:
Effort:
Difficulty:
Label:

Description

In Suricata's main() a SuricataContext is setup with no comments on what it is for. This is used to send some C functions as function pointers inside Rust.

This solves a chicken and egg problem when running the Rust unit tests. When the Rust code is simply compiled we can reference any of the C functions, they will get resolved when the resulting Rust library is linked into the C executable. However, when running the Rust unit tests (via cargo test), these C functions don't exist, so the tests fail to compile. To get around this we pass some functions to Rust as pointers wrapped in an Option and resolve it. This process is at best a hack.

At a minimum just clean this up behind some more explicit Rust initialization, but it may be worth researching alternatives.


Related issues 1 (1 open0 closed)

Related to Suricata - Story #7141: misc: general improvements and cleanupsNewVictor JulienActions
Actions

Also available in: Atom PDF