Project

General

Profile

Actions

Task #3334

open

Cleanup registration of C function pointers in SuricataContext in main()

Added by Jason Ish over 4 years ago. Updated almost 3 years ago.

Status:
New
Priority:
High
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.

Actions #1

Updated by Jason Ish over 4 years ago

  • Project changed from Suricata-Update to Suricata
Actions #2

Updated by Victor Julien about 4 years ago

  • Priority changed from Normal to High
Actions #3

Updated by Victor Julien over 3 years ago

  • Target version set to 7.0.0-beta1
Actions #4

Updated by Jason Ish almost 3 years ago

  • Target version changed from 7.0.0-beta1 to 8.0.0-beta1

Retargeting to 8. I don't think we can get rid of this as long as we have C that calls Rust, and Rust that calls C.

Actions

Also available in: Atom PDF