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

Dynamic alprotos : make SNMP totally dynamic v12 #12732

Closed

Conversation

catenacyber
Copy link
Contributor

Link to ticket: https://redmine.openinfosecfoundation.org/issues/
https://redmine.openinfosecfoundation.org/issues/5053

Describe changes:

  • detect: fix overflow for files protocol as reported by coverity
  • snmp: register protocol dynamically, to do so :
    • make some arrays even more dynamic
    • add an helper function AppProtoNewProtoFromString
    • have plugins be able to log flow or packet direction

#12724 without moving things from C to rust, but using bindgen

CID 1640392

Would happen only if we reached 15 protocols handling files
Ticket: 5053

Do not asume that we know the number of alprotos at the end
of AppLayerNamesSetup, but make arrays allocated by later
AppLayerProtoDetectSetup dynamic so that it can be reallocated
from AppLayerParserRegisterProtocolParsers

This helps have a single entry point for a protocol like SNMP
So that we do not have to know g_alproto_max to register
dynamically a new protocol from its name
Ticket: 5053

Move enum OutputJsonLogDirection and struct
EveJsonTxLoggerRegistrationData to a public header user by rust
thanks to bindgen

Rename to use SC prefix on the way
and cast

and also remove unneeded mut

and rustfmt
@catenacyber catenacyber force-pushed the applayer-plugin-5053-v4.12 branch from cc01025 to 80cf36f Compare March 7, 2025 11:04
@catenacyber catenacyber requested a review from a team as a code owner March 7, 2025 11:04
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 89.09091% with 12 lines in your changes missing coverage. Please review.

Project coverage is 80.93%. Comparing base (6477b31) to head (80cf36f).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12732      +/-   ##
==========================================
+ Coverage   80.76%   80.93%   +0.17%     
==========================================
  Files         936      936              
  Lines      259724   259769      +45     
==========================================
+ Hits       209765   210256     +491     
+ Misses      49959    49513     -446     
Flag Coverage Δ
fuzzcorpus 57.26% <84.40%> (+0.38%) ⬆️
livemode 19.45% <66.05%> (+0.04%) ⬆️
pcap 44.23% <82.56%> (+0.09%) ⬆️
suricata-verify 63.69% <88.99%> (+0.06%) ⬆️
unittests 58.18% <66.05%> (+0.01%) ⬆️

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@catenacyber
Copy link
Contributor Author

Clean in #12736

@catenacyber catenacyber closed this Mar 7, 2025
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.

1 participant