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 v2 #12406

Closed

Conversation

catenacyber
Copy link
Contributor

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

Describe changes:

  • 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
  • rust : remove unneeded mut tx in loggers
  • detect: fix overflow for files protocol as reported by coverity

#12402 with CI failures fixed (memset 0 after realloc)
@jasonish my questions there still hold

Already quite a few things going on here, so stopping here before adding the example of a template plugin
Let me know if this should be split into multiple PRs

CID 1640392

Would happen only if we reached 15 protocols handling files
@catenacyber catenacyber changed the title Applayer plugin 5053 v4.2 Dynamic alprotos : make SNMP totally dynamic v2 Jan 16, 2025
@catenacyber catenacyber force-pushed the applayer-plugin-5053-v4.2 branch from 7c5bed3 to fadf29c Compare January 16, 2025 10:15
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
and cast

and also remove unneeded mut
Loggers do not change transactions, they read only.
@catenacyber catenacyber force-pushed the applayer-plugin-5053-v4.2 branch from fadf29c to 208f2e0 Compare January 16, 2025 10:36
Copy link

codecov bot commented Jan 16, 2025

Codecov Report

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

Project coverage is 80.77%. Comparing base (078c646) to head (208f2e0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #12406      +/-   ##
==========================================
+ Coverage   80.63%   80.77%   +0.14%     
==========================================
  Files         917      917              
  Lines      258687   258724      +37     
==========================================
+ Hits       208601   208994     +393     
+ Misses      50086    49730     -356     
Flag Coverage Δ
fuzzcorpus 57.23% <71.60%> (+0.41%) ⬆️
livemode 19.43% <54.32%> (+0.04%) ⬆️
pcap 44.32% <72.83%> (+0.05%) ⬆️
suricata-verify 63.29% <87.05%> (+0.06%) ⬆️
unittests 58.53% <54.32%> (+0.01%) ⬆️

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

@catenacyber
Copy link
Contributor Author

Clean in #12408

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