Detect dynamic register keywords 4683 v1#10966
Detect dynamic register keywords 4683 v1#10966catenacyber wants to merge 2 commits intoOISF:masterfrom
Conversation
5758705 to
3ccb310
Compare
|
WARNING:
Pipeline 20365 |
3ccb310 to
5192d3f
Compare
|
WARNING:
Pipeline 20366 |
|
WARNING:
Pipeline 20367 |
|
Set to draft to avoid the force pushes monopolizing qalab runtime. |
rust/src/snmp/detect.rs
Outdated
| #[no_mangle] | ||
| unsafe extern "C" fn snmp_detect_version_setup( |
There was a problem hiding this comment.
naming: no_mangle and extern C should follow C naming conventions.
There was a problem hiding this comment.
As this isn't pub, and just a function pointer, you could drop the no_mangle and use Rust conventions. Meaning you could drop the prefixes in the function name as well, as the visibility is just this module.
There was a problem hiding this comment.
What does the no_mangle do ?
I thought I needed it for the ABI
There was a problem hiding this comment.
No mangle just keeps the name as-is in the symbol table so linkers can find it. If you just point to it using a function pointer its not needed and best let Rust do its name mangling.
The extern is for the ABI.
There was a problem hiding this comment.
Thanks Jason, makes sense
5192d3f to
2c51ce6
Compare
|
WARNING:
Pipeline 20385 |
663ea50 to
c3e5d62
Compare
|
So, problem statement. I tried in code :
in compilation :
By the way, I do not understand how unused |
aa63d93 to
8c036fd
Compare
I don't think the linker is removing the code, So portable doing the start-group type stuff is probably the way to resolve this. |
|
One thought... Can you move those functions over to Rust, even if very C like, then just call more primitives on the C that are for sure used? |
If I recall correctly, |
Good idea |
8c036fd to
bc840e1
Compare
But does not seem possible for |
Yes, but that does not look so portable... |
detect: make number of keywords dynamic Ticket: 4683
Ticket: 4863 On the way, convert unit test DetectSNMPCommunityTest to a SV test. And also, make snmp.pdu_type use a generic uint32 for detection, allowing operators, instead of just equality.
bc840e1 to
745955b
Compare
|
Continued in #10992 |
Possibly. It is required for plugins, but we only test that on Linux. I know they're broken on Windows. Possibly Mac as well. |
Function point in the context object? |
Possible, but I am not a big fan of this context object... I see that for frames, you have set up empty stubs for cfg test :-) |
Is anyone? I've prototyped re-working the build to this order:
It works, and makes the C code available to Rust unit tests. Essentially eliminating the need for the context object. Doesn't work with ASAN -- builds fail. So a bit unfortunate on that front. |
|
Looks nice. How does it fail with ASAN ? |
At link time.. Scenario is:
Built the Rust "test" apps require manual linking with |
|
In any case, I think that the functionality of having C functions only called by rust could be useful. But if it gets too painful for this PR, I will resort to use them in C also... |
if |
Link to redmine ticket:
https://redmine.openinfosecfoundation.org/issues/4683
Describe changes:
>2and suchSV_BRANCH=OISF/suricata-verify#1804
Continuation of #9871 after merge of #10819
After the merge of loggers, pure rust plugins will need pure rust keywords.
The plan is to do this for all rust app-layers, now only done for SNMP, which has both integers and buffers as keywords.