Project

General

Profile

Actions

Task #3334

closed
JI OD

rust: cleanup registration of C function pointers in SuricataContext

Task #3334: rust: cleanup registration of C function pointers in SuricataContext

Added by Jason Ish over 6 years ago. Updated 1 day ago.

Status:
Closed
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 (0 open1 closed)

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

JI Updated by Jason Ish over 6 years ago Actions #1

  • Project changed from Suricata-Update to Suricata

VJ Updated by Victor Julien about 6 years ago Actions #2

  • Priority changed from Normal to High

VJ Updated by Victor Julien over 5 years ago Actions #3

  • Target version set to 7.0.0-beta1

JI Updated by Jason Ish almost 5 years ago Actions #4

  • 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.

VJ Updated by Victor Julien almost 2 years ago Actions #5

  • Subject changed from Cleanup registration of C function pointers in SuricataContext in main() to rust: cleanup registration of C function pointers in SuricataContext
  • Priority changed from High to Normal

VJ Updated by Victor Julien almost 2 years ago Actions #6

  • Related to Story #7141: misc: general improvements and cleanups added

VJ Updated by Victor Julien over 1 year ago Actions #7

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

Looks like a number of them, like the File* API wrappers can be removed.

VJ Updated by Victor Julien 11 months ago Actions #8

  • Target version changed from 8.0.0-rc1 to 9.0.0-beta1

PA Updated by Philippe Antoine 1 day ago Actions #9

  • Status changed from New to Closed

Completed by 24503b0ead4831adb6cd919c2ef41e783a11f928

Actions

Also available in: PDF Atom