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 v4 #12414

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 (update SC_PLUGIN_API_VERSION)

#12408 with removing duplicate definitions between C and rust, just moving to rust see commit 1f75d01

Already quite a few things going on here, so stopping here before adding the example of a template plugin

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 from C to rust
and cast

and also remove unneeded mut

and rustfmt
Copy link

codecov bot commented Jan 17, 2025

Codecov Report

Attention: Patch coverage is 80.30303% with 13 lines in your changes missing coverage. Please review.

Project coverage is 80.77%. Comparing base (8f6795d) to head (eb69ab5).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12414      +/-   ##
==========================================
+ Coverage   80.63%   80.77%   +0.14%     
==========================================
  Files         918      918              
  Lines      258696   258734      +38     
==========================================
+ Hits       208598   208992     +394     
+ Misses      50098    49742     -356     
Flag Coverage Δ
fuzzcorpus 57.22% <76.92%> (+0.41%) ⬆️
livemode 19.44% <70.76%> (+0.03%) ⬆️
pcap 44.31% <80.00%> (+0.01%) ⬆️
suricata-verify 63.29% <81.25%> (+0.05%) ⬆️
unittests 58.53% <70.76%> (+0.01%) ⬆️

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

@catenacyber catenacyber changed the title Applayer plugin 5053 v4.4 Dynamic alprotos : make SNMP totally dynamic v4 Jan 17, 2025
@suricata-qa
Copy link

Information: QA ran without warnings.

Pipeline 24248

LOG_DIR_FLOW_TOSERVER = 3,
}

// Also defined in output.h
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can the definition just be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to remove the comment, the definition is now just in rust

@catenacyber
Copy link
Contributor Author

Next in #12420

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.

3 participants