Return from snort_start early if dissector not enabled.

Change-Id: Idf63210ce33d92ac8619fe3295bd3e6c0bb304a9
Reviewed-on: https://code.wireshark.org/review/18941
Reviewed-by: Martin Mathieson <martin.r.mathieson@googlemail.com>
This commit is contained in:
Martin Mathieson 2016-11-23 16:31:57 -08:00
parent 76c3970265
commit 7dbe9b4987
1 changed files with 6 additions and 8 deletions

View File

@ -1061,13 +1061,6 @@ snort_dissector(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return tvb_reported_length(tvb);
}
/* N.B. is being called.. */
static void snort_config(gpointer user_data _U_)
{
/* N.B. original code tried to get line-buffered (or unbuffered) output from snort.
It wasn't very portable, and measurements indicated it didn't make any difference
to how often whole lines were output. */
}
/*------------------------------------------------------------------*/
/* Start up Snort. */
@ -1088,6 +1081,11 @@ static void snort_start(void)
NULL
};
/* Nothing to do if not enabled, but registered init function gets called anyway */
if (!snort_enable_dissector) {
return;
}
/* Create tree mapping packet_number -> Alerts_t*. It will get recreated when packet list is reloaded */
current_session.alerts_tree = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope());
@ -1123,7 +1121,7 @@ static void snort_start(void)
(char **)argv,
NULL, /* envp */
(GSpawnFlags)( G_SPAWN_DO_NOT_REAP_CHILD), /* Leave out G_SPAWN_SEARCH_PATH */
snort_config, /* child setup - not currently doing anything.. */
NULL, /* child setup - not currently doing anything.. */
NULL, /* user-data */
&current_session.pid, /* PID */
&current_session.in, /* stdin */