-
Notifications
You must be signed in to change notification settings - Fork 1.6k
snmp: can not be set to detection-only #14045
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
Open
liheng562653799
wants to merge
3
commits into
OISF:main
Choose a base branch
from
liheng562653799:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,20 +437,6 @@ void AppLayerParserRegisterStateFuncs(uint8_t ipproto, AppProto alproto, | |
{ | ||
SCEnter(); | ||
|
||
if (alp_ctx.ctxs_len <= alproto && alproto < g_alproto_max) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am not sure about the moving of this code to be called in Could you explain it in the commit message ? |
||
// Realloc now as AppLayerParserRegisterStateFuncs is called first | ||
void *tmp = SCRealloc( | ||
alp_ctx.ctxs, sizeof(AppLayerParserProtoCtx[FLOW_PROTO_MAX]) * g_alproto_max); | ||
if (unlikely(tmp == NULL)) { | ||
FatalError("Unable to realloc alp_ctx.ctxs."); | ||
} | ||
alp_ctx.ctxs = tmp; | ||
memset(&alp_ctx.ctxs[alp_ctx.ctxs_len], 0, | ||
sizeof(AppLayerParserProtoCtx[FLOW_PROTO_MAX]) * | ||
(g_alproto_max - alp_ctx.ctxs_len)); | ||
alp_ctx.ctxs_len = g_alproto_max; | ||
} | ||
|
||
alp_ctx.ctxs[alproto][FlowGetProtoMapping(ipproto)].StateAlloc = StateAlloc; | ||
alp_ctx.ctxs[alproto][FlowGetProtoMapping(ipproto)].StateFree = StateFree; | ||
|
||
|
@@ -1750,6 +1736,24 @@ static void (**PreRegisteredCallbacks)(void) = NULL; | |
static size_t preregistered_callbacks_nb = 0; | ||
static size_t preregistered_callbacks_cap = 0; | ||
|
||
int SCAppLayerParserReallocCtx(AppProto alproto) | ||
{ | ||
if (alp_ctx.ctxs_len <= alproto && alproto < g_alproto_max) { | ||
/* Realloc alp_ctx.ctxs, so that dynamic alproto can be treated as real/normal ones. | ||
* In case we need to turn off dynamic alproto. */ | ||
void *tmp = SCRealloc(alp_ctx.ctxs, sizeof(AppLayerParserProtoCtx[FLOW_PROTO_MAX]) * | ||
(alp_ctx.ctxs_len + ARRAY_CAP_STEP)); | ||
if (unlikely(tmp == NULL)) { | ||
FatalError("Unable to realloc alp_ctx.ctxs."); | ||
} | ||
alp_ctx.ctxs = tmp; | ||
memset(&alp_ctx.ctxs[alp_ctx.ctxs_len], 0, | ||
sizeof(AppLayerParserProtoCtx[FLOW_PROTO_MAX]) * ARRAY_CAP_STEP); | ||
alp_ctx.ctxs_len += ARRAY_CAP_STEP; | ||
} | ||
return 0; | ||
} | ||
|
||
int AppLayerParserPreRegister(void (*Register)(void)) | ||
{ | ||
if (preregistered_callbacks_nb == preregistered_callbacks_cap) { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it mean that we should call
SCOutputEvePreRegisterLogger
even ifSCAppLayerProtoDetectConfProtoDetectionEnabled
returns 0 ?I would not think so