epan: Remember whether heuristic dissectors are enabled by default
Store whether or not heuristic dissectors are enabled by default. When reenabling protocols to their initial state, such as when changing profiles, also set heuristic dissectors back to their initial state. Also use the initial state in dissector_dump_heur_decodes so that it correctly displays the default state of a heuristic dissector, even if the heuristic dissector has been changed from the default. Fix #19520
This commit is contained in:
parent
51c6fa874d
commit
8e8e07d892
|
@ -2881,6 +2881,7 @@ heur_dissector_add(const char *name, heur_dissector_t dissector, const char *dis
|
|||
hdtbl_entry->short_name = g_strdup(internal_name);
|
||||
hdtbl_entry->list_name = g_strdup(name);
|
||||
hdtbl_entry->enabled = (enable == HEURISTIC_ENABLE);
|
||||
hdtbl_entry->enabled_by_default = (enable == HEURISTIC_ENABLE);
|
||||
|
||||
/* do the table insertion */
|
||||
g_hash_table_insert(heuristic_short_names, (gpointer)hdtbl_entry->short_name, hdtbl_entry);
|
||||
|
@ -3159,7 +3160,7 @@ display_heur_dissector_table_entries(const char *table_name,
|
|||
table_name,
|
||||
proto_get_protocol_filter_name(proto_get_id(hdtbl_entry->protocol)),
|
||||
(proto_is_protocol_enabled(hdtbl_entry->protocol) && hdtbl_entry->enabled) ? 'T' : 'F',
|
||||
(proto_is_protocol_enabled_by_default(hdtbl_entry->protocol) && hdtbl_entry->enabled) ? 'T' : 'F',
|
||||
(proto_is_protocol_enabled_by_default(hdtbl_entry->protocol) && hdtbl_entry->enabled_by_default) ? 'T' : 'F',
|
||||
hdtbl_entry->short_name,
|
||||
hdtbl_entry->display_name);
|
||||
}
|
||||
|
|
|
@ -469,6 +469,7 @@ typedef struct heur_dtbl_entry {
|
|||
const gchar *display_name; /* the string used to present heuristic to user */
|
||||
gchar *short_name; /* string used for "internal" use to uniquely identify heuristic */
|
||||
gboolean enabled;
|
||||
bool enabled_by_default;
|
||||
} heur_dtbl_entry_t;
|
||||
|
||||
/** A protocol uses this function to register a heuristic sub-dissector list.
|
||||
|
|
|
@ -8407,6 +8407,14 @@ proto_disable_all(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
heur_reenable_cb(void *data, void *user_data _U_)
|
||||
{
|
||||
heur_dtbl_entry_t *heur = (heur_dtbl_entry_t*)data;
|
||||
|
||||
heur->enabled = heur->enabled_by_default;
|
||||
}
|
||||
|
||||
void
|
||||
proto_reenable_all(void)
|
||||
{
|
||||
|
@ -8420,6 +8428,7 @@ proto_reenable_all(void)
|
|||
protocol = (protocol_t *)list_item->data;
|
||||
if (protocol->can_toggle)
|
||||
protocol->is_enabled = protocol->enabled_by_default;
|
||||
proto_heuristic_dissector_foreach(protocol, heur_reenable_cb, NULL);
|
||||
list_item = g_list_next(list_item);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue