2005-09-11 16:55:34 +00:00
|
|
|
/* expert.c
|
|
|
|
* Collecting Expert information.
|
|
|
|
*
|
|
|
|
* Implemented as a tap named "expert".
|
|
|
|
*
|
2006-05-21 05:12:17 +00:00
|
|
|
* Wireshark - Network traffic analyzer
|
|
|
|
* By Gerald Combs <gerald@wireshark.org>
|
2005-09-11 16:55:34 +00:00
|
|
|
* Copyright 1998 Gerald Combs
|
|
|
|
*
|
2018-02-08 16:59:17 +00:00
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2005-09-11 16:55:34 +00:00
|
|
|
*/
|
|
|
|
|
2012-09-20 01:48:30 +00:00
|
|
|
#include "config.h"
|
2021-06-14 23:06:02 +00:00
|
|
|
#define WS_LOG_DOMAIN LOG_DOMAIN_EPAN
|
2005-09-11 16:55:34 +00:00
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
#include <stdio.h>
|
2013-11-10 15:59:37 +00:00
|
|
|
#include <stdlib.h>
|
2013-05-24 17:59:36 +00:00
|
|
|
|
2005-09-11 16:55:34 +00:00
|
|
|
#include "packet.h"
|
|
|
|
#include "expert.h"
|
2014-07-16 03:04:41 +00:00
|
|
|
#include "uat.h"
|
|
|
|
#include "prefs.h"
|
2022-02-02 21:45:15 +00:00
|
|
|
#include <epan/prefs-int.h>
|
2021-07-26 00:31:17 +00:00
|
|
|
#include <epan/wmem_scopes.h>
|
2005-09-11 16:55:34 +00:00
|
|
|
#include "tap.h"
|
|
|
|
|
2021-06-14 23:06:02 +00:00
|
|
|
#include <wsutil/wslog.h>
|
|
|
|
|
2011-12-14 21:13:06 +00:00
|
|
|
/* proto_expert cannot be static because it's referenced in the
|
|
|
|
* print routines
|
|
|
|
*/
|
|
|
|
int proto_expert = -1;
|
2005-09-11 16:55:34 +00:00
|
|
|
|
2013-07-02 16:02:31 +00:00
|
|
|
static int proto_malformed = -1;
|
|
|
|
|
2009-09-30 13:04:06 +00:00
|
|
|
static int expert_tap = -1;
|
|
|
|
static int highest_severity = 0;
|
2006-08-31 22:56:38 +00:00
|
|
|
|
2009-09-30 13:04:06 +00:00
|
|
|
static int ett_expert = -1;
|
|
|
|
static int ett_subexpert = -1;
|
2009-03-09 00:26:25 +00:00
|
|
|
|
2009-09-30 13:04:06 +00:00
|
|
|
static int hf_expert_msg = -1;
|
|
|
|
static int hf_expert_group = -1;
|
2009-03-09 00:26:25 +00:00
|
|
|
static int hf_expert_severity = -1;
|
2006-08-31 22:56:38 +00:00
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
struct expert_module
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
const char *proto_name;
|
2013-07-06 16:11:36 +00:00
|
|
|
int proto_id; /* Cache this for registering hfs */
|
2013-05-24 17:59:36 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/* List which stores protocols and expert_info that have been registered */
|
|
|
|
typedef struct _gpa_expertinfo_t {
|
|
|
|
guint32 len;
|
|
|
|
guint32 allocated_len;
|
|
|
|
expert_field_info **ei;
|
|
|
|
} gpa_expertinfo_t;
|
|
|
|
static gpa_expertinfo_t gpa_expertinfo;
|
|
|
|
|
2014-07-16 03:04:41 +00:00
|
|
|
/* Hash table of abbreviations and IDs */
|
|
|
|
static GHashTable *gpa_name_map = NULL;
|
|
|
|
|
2015-12-10 13:10:17 +00:00
|
|
|
/* Deregistered expert infos */
|
|
|
|
static GPtrArray *deregistered_expertinfos = NULL;
|
|
|
|
|
2013-12-22 10:52:29 +00:00
|
|
|
const value_string expert_group_vals[] = {
|
2014-09-15 23:32:13 +00:00
|
|
|
{ PI_CHECKSUM, "Checksum" },
|
|
|
|
{ PI_SEQUENCE, "Sequence" },
|
|
|
|
{ PI_RESPONSE_CODE, "Response" },
|
|
|
|
{ PI_REQUEST_CODE, "Request" },
|
|
|
|
{ PI_UNDECODED, "Undecoded" },
|
|
|
|
{ PI_REASSEMBLE, "Reassemble" },
|
|
|
|
{ PI_MALFORMED, "Malformed" },
|
|
|
|
{ PI_DEBUG, "Debug" },
|
|
|
|
{ PI_PROTOCOL, "Protocol" },
|
|
|
|
{ PI_SECURITY, "Security" },
|
|
|
|
{ PI_COMMENTS_GROUP, "Comment" },
|
2015-09-07 23:44:56 +00:00
|
|
|
{ PI_DECRYPTION, "Decryption" },
|
2016-01-07 01:23:00 +00:00
|
|
|
{ PI_ASSUMPTION, "Assumption" },
|
2016-07-29 14:00:56 +00:00
|
|
|
{ PI_DEPRECATED, "Deprecated" },
|
2014-09-15 23:32:13 +00:00
|
|
|
{ 0, NULL }
|
2013-12-22 10:52:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
const value_string expert_severity_vals[] = {
|
2014-09-15 23:32:13 +00:00
|
|
|
{ PI_ERROR, "Error" },
|
2016-01-14 19:15:46 +00:00
|
|
|
{ PI_WARN, "Warning" },
|
2014-09-15 23:32:13 +00:00
|
|
|
{ PI_NOTE, "Note" },
|
|
|
|
{ PI_CHAT, "Chat" },
|
|
|
|
{ PI_COMMENT, "Comment" },
|
|
|
|
{ 0, NULL }
|
2013-12-22 10:52:29 +00:00
|
|
|
};
|
|
|
|
|
2013-07-02 19:53:28 +00:00
|
|
|
/* Possible values for a checksum evaluation */
|
|
|
|
const value_string expert_checksum_vals[] = {
|
2013-07-02 20:08:49 +00:00
|
|
|
{ EXPERT_CHECKSUM_DISABLED, "Disabled" },
|
|
|
|
{ EXPERT_CHECKSUM_UNKNOWN, "Unknown" },
|
|
|
|
{ EXPERT_CHECKSUM_GOOD, "Good" },
|
|
|
|
{ EXPERT_CHECKSUM_BAD, "Bad" },
|
2013-07-02 19:53:28 +00:00
|
|
|
{ 0, NULL }
|
|
|
|
};
|
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
static expert_field_info *expert_registrar_get_byname(const char *field_name);
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
/* UAT for customizing severity levels. */
|
|
|
|
/*----------------------------------------------------------------------------*/
|
|
|
|
typedef struct
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
char *field;
|
|
|
|
guint32 severity;
|
2014-07-16 03:04:41 +00:00
|
|
|
} expert_level_entry_t;
|
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
static expert_level_entry_t *uat_expert_entries = NULL;
|
2014-07-16 03:04:41 +00:00
|
|
|
static guint expert_level_entry_count = 0;
|
|
|
|
/* Array of field names currently in UAT */
|
|
|
|
static GArray *uat_saved_fields = NULL;
|
|
|
|
|
|
|
|
UAT_CSTRING_CB_DEF(uat_expert_entries, field, expert_level_entry_t)
|
|
|
|
UAT_VS_DEF(uat_expert_entries, severity, expert_level_entry_t, guint32, PI_ERROR, "Error")
|
|
|
|
|
2015-02-18 00:40:28 +00:00
|
|
|
static gboolean uat_expert_update_cb(void *r, char **err)
|
2014-07-16 03:04:41 +00:00
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_level_entry_t *rec = (expert_level_entry_t *)r;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
if (expert_registrar_get_byname(rec->field) == NULL) {
|
2021-12-16 18:06:18 +00:00
|
|
|
*err = ws_strdup_printf("Expert Info field doesn't exist");
|
2015-02-18 00:40:28 +00:00
|
|
|
return FALSE;
|
2014-07-16 03:04:41 +00:00
|
|
|
}
|
2015-02-18 00:40:28 +00:00
|
|
|
return TRUE;
|
2014-07-16 03:04:41 +00:00
|
|
|
}
|
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
static void *uat_expert_copy_cb(void *n, const void *o, size_t siz _U_)
|
2014-07-16 03:04:41 +00:00
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_level_entry_t *new_record = (expert_level_entry_t*)n;
|
|
|
|
const expert_level_entry_t *old_record = (const expert_level_entry_t *)o;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
2017-08-26 08:30:47 +00:00
|
|
|
new_record->field = g_strdup(old_record->field);
|
2014-07-16 03:04:41 +00:00
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
new_record->severity = old_record->severity;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
return new_record;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void uat_expert_free_cb(void*r)
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_level_entry_t *rec = (expert_level_entry_t *)r;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
2017-08-26 08:30:47 +00:00
|
|
|
g_free(rec->field);
|
2014-07-16 03:04:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void uat_expert_post_update_cb(void)
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
guint i;
|
|
|
|
expert_field_info *field;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
/* Reset any of the previous list of expert info fields to their original severity */
|
|
|
|
for ( i = 0 ; i < uat_saved_fields->len; i++ ) {
|
|
|
|
field = g_array_index(uat_saved_fields, expert_field_info*, i);
|
|
|
|
if (field != NULL) {
|
|
|
|
field->severity = field->orig_severity;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_array_set_size(uat_saved_fields, 0);
|
|
|
|
|
|
|
|
for (i = 0; i < expert_level_entry_count; i++)
|
|
|
|
{
|
|
|
|
field = expert_registrar_get_byname(uat_expert_entries[i].field);
|
|
|
|
if (field != NULL)
|
|
|
|
{
|
|
|
|
field->severity = uat_expert_entries[i].severity;
|
|
|
|
g_array_append_val(uat_saved_fields, field);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-05-24 17:59:36 +00:00
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
#define EXPERT_REGISTRAR_GET_NTH(eiindex, expinfo) \
|
2019-09-04 11:51:29 +00:00
|
|
|
if((guint)eiindex >= gpa_expertinfo.len && wireshark_abort_on_dissector_bug) \
|
2021-06-14 23:06:02 +00:00
|
|
|
ws_error("Unregistered expert info! index=%d", eiindex); \
|
2014-09-15 23:32:13 +00:00
|
|
|
DISSECTOR_ASSERT_HINT((guint)eiindex < gpa_expertinfo.len, "Unregistered expert info!"); \
|
2015-12-10 13:10:17 +00:00
|
|
|
DISSECTOR_ASSERT_HINT(gpa_expertinfo.ei[eiindex] != NULL, "Unregistered expert info!"); \
|
2013-05-24 17:59:36 +00:00
|
|
|
expinfo = gpa_expertinfo.ei[eiindex];
|
|
|
|
|
2005-09-11 16:55:34 +00:00
|
|
|
void
|
2013-05-24 17:59:36 +00:00
|
|
|
expert_packet_init(void)
|
2005-09-11 16:55:34 +00:00
|
|
|
{
|
2014-07-16 03:04:41 +00:00
|
|
|
module_t *module_expert;
|
2014-09-15 23:32:13 +00:00
|
|
|
uat_t *expert_uat;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
2009-03-09 00:26:25 +00:00
|
|
|
static hf_register_info hf[] = {
|
|
|
|
{ &hf_expert_msg,
|
2013-10-09 12:56:19 +00:00
|
|
|
{ "Message", "_ws.expert.message", FT_STRING, BASE_NONE, NULL, 0, "Wireshark expert information", HFILL }
|
2009-03-09 00:26:25 +00:00
|
|
|
},
|
2009-09-06 18:25:23 +00:00
|
|
|
{ &hf_expert_group,
|
2016-07-17 22:24:45 +00:00
|
|
|
{ "Group", "_ws.expert.group", FT_UINT32, BASE_NONE, VALS(expert_group_vals), 0, "Wireshark expert group", HFILL }
|
2009-03-09 00:26:25 +00:00
|
|
|
},
|
2009-09-06 18:25:23 +00:00
|
|
|
{ &hf_expert_severity,
|
2016-07-17 22:24:45 +00:00
|
|
|
{ "Severity level", "_ws.expert.severity", FT_UINT32, BASE_NONE, VALS(expert_severity_vals), 0, "Wireshark expert severity level", HFILL }
|
2009-03-09 00:26:25 +00:00
|
|
|
}
|
|
|
|
};
|
|
|
|
static gint *ett[] = {
|
|
|
|
&ett_expert,
|
|
|
|
&ett_subexpert
|
|
|
|
};
|
|
|
|
|
2014-07-16 03:04:41 +00:00
|
|
|
/* UAT for overriding severity levels */
|
|
|
|
static uat_field_t custom_expert_fields[] = {
|
|
|
|
UAT_FLD_CSTRING(uat_expert_entries, field, "Field name", "Expert Info filter name"),
|
|
|
|
UAT_FLD_VS(uat_expert_entries, severity, "Severity", expert_severity_vals, "Custom severity level"),
|
|
|
|
UAT_END_FIELDS
|
|
|
|
};
|
|
|
|
|
2010-02-27 22:12:43 +00:00
|
|
|
if (expert_tap == -1) {
|
2005-09-11 16:55:34 +00:00
|
|
|
expert_tap = register_tap("expert");
|
|
|
|
}
|
2006-08-31 22:56:38 +00:00
|
|
|
|
2009-03-09 00:26:25 +00:00
|
|
|
if (proto_expert == -1) {
|
2013-10-09 12:56:19 +00:00
|
|
|
proto_expert = proto_register_protocol("Expert Info", "Expert", "_ws.expert");
|
2009-03-09 00:26:25 +00:00
|
|
|
proto_register_field_array(proto_expert, hf, array_length(hf));
|
|
|
|
proto_register_subtree_array(ett, array_length(ett));
|
|
|
|
proto_set_cant_toggle(proto_expert);
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
module_expert = prefs_register_protocol(proto_expert, NULL);
|
2022-02-02 21:45:15 +00:00
|
|
|
//Since "expert" is really a pseudo protocol, it shouldn't be
|
|
|
|
//categorized with other "real" protocols when it comes to
|
|
|
|
//preferences. Since it's just a UAT, don't bury it in
|
|
|
|
//with the other protocols
|
|
|
|
module_expert->use_gui = FALSE;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
expert_uat = uat_new("Expert Info Severity Level Configuration",
|
|
|
|
sizeof(expert_level_entry_t),
|
|
|
|
"expert_severity",
|
|
|
|
TRUE,
|
2014-09-15 23:32:13 +00:00
|
|
|
(void **)&uat_expert_entries,
|
2014-07-16 03:04:41 +00:00
|
|
|
&expert_level_entry_count,
|
|
|
|
UAT_AFFECTS_DISSECTION,
|
|
|
|
NULL,
|
|
|
|
uat_expert_copy_cb,
|
|
|
|
uat_expert_update_cb,
|
|
|
|
uat_expert_free_cb,
|
|
|
|
uat_expert_post_update_cb,
|
2016-12-21 10:50:47 +00:00
|
|
|
NULL,
|
2014-07-16 03:04:41 +00:00
|
|
|
custom_expert_fields);
|
|
|
|
|
|
|
|
prefs_register_uat_preference(module_expert,
|
|
|
|
"expert_severity_levels",
|
|
|
|
"Severity Level Configuration",
|
|
|
|
"A table that overrides Expert Info field severity levels to user configured levels",
|
|
|
|
expert_uat);
|
|
|
|
|
2009-03-09 00:26:25 +00:00
|
|
|
}
|
|
|
|
|
2006-08-31 22:56:38 +00:00
|
|
|
highest_severity = 0;
|
2013-05-24 17:59:36 +00:00
|
|
|
|
2013-10-09 12:56:19 +00:00
|
|
|
proto_malformed = proto_get_id_by_filter_name("_ws.malformed");
|
2005-09-11 16:55:34 +00:00
|
|
|
}
|
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
void
|
|
|
|
expert_init(void)
|
|
|
|
{
|
|
|
|
gpa_expertinfo.len = 0;
|
|
|
|
gpa_expertinfo.allocated_len = 0;
|
2014-09-15 23:32:13 +00:00
|
|
|
gpa_expertinfo.ei = NULL;
|
|
|
|
gpa_name_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
|
|
|
|
uat_saved_fields = g_array_new(FALSE, FALSE, sizeof(expert_field_info*));
|
2015-12-10 13:10:17 +00:00
|
|
|
deregistered_expertinfos = g_ptr_array_new();
|
2013-05-24 17:59:36 +00:00
|
|
|
}
|
2006-08-31 22:56:38 +00:00
|
|
|
|
2005-09-11 16:55:34 +00:00
|
|
|
void
|
2013-05-24 17:59:36 +00:00
|
|
|
expert_packet_cleanup(void)
|
2005-09-11 16:55:34 +00:00
|
|
|
{
|
2013-05-24 17:59:36 +00:00
|
|
|
}
|
2010-02-27 22:12:43 +00:00
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
void
|
|
|
|
expert_cleanup(void)
|
|
|
|
{
|
|
|
|
if (gpa_expertinfo.allocated_len) {
|
|
|
|
gpa_expertinfo.len = 0;
|
|
|
|
gpa_expertinfo.allocated_len = 0;
|
|
|
|
g_free(gpa_expertinfo.ei);
|
|
|
|
gpa_expertinfo.ei = NULL;
|
|
|
|
}
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
/* Free the abbrev/ID GTree */
|
|
|
|
if (gpa_name_map) {
|
|
|
|
g_hash_table_destroy(gpa_name_map);
|
|
|
|
gpa_name_map = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Free the UAT saved fields */
|
|
|
|
if (uat_saved_fields) {
|
|
|
|
g_array_free(uat_saved_fields, TRUE);
|
|
|
|
uat_saved_fields = NULL;
|
|
|
|
}
|
2015-12-10 13:10:17 +00:00
|
|
|
|
|
|
|
if (deregistered_expertinfos) {
|
2018-05-09 20:28:57 +00:00
|
|
|
g_ptr_array_free(deregistered_expertinfos, TRUE);
|
2015-12-10 13:10:17 +00:00
|
|
|
deregistered_expertinfos = NULL;
|
|
|
|
}
|
2005-09-11 16:55:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-31 22:56:38 +00:00
|
|
|
int
|
|
|
|
expert_get_highest_severity(void)
|
|
|
|
{
|
|
|
|
return highest_severity;
|
|
|
|
}
|
|
|
|
|
2013-06-20 22:25:33 +00:00
|
|
|
void
|
|
|
|
expert_update_comment_count(guint64 count)
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
if (count==0 && highest_severity==PI_COMMENT)
|
|
|
|
highest_severity = 0;
|
2013-06-20 22:25:33 +00:00
|
|
|
}
|
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
expert_module_t *expert_register_protocol(int id)
|
|
|
|
{
|
|
|
|
expert_module_t *module;
|
2014-09-15 23:32:13 +00:00
|
|
|
protocol_t *protocol;
|
2013-05-24 17:59:36 +00:00
|
|
|
|
|
|
|
protocol = find_protocol_by_id(id);
|
|
|
|
|
2013-07-06 12:54:13 +00:00
|
|
|
module = wmem_new(wmem_epan_scope(), expert_module_t);
|
2013-05-24 17:59:36 +00:00
|
|
|
module->proto_id = id;
|
|
|
|
module->proto_name = proto_get_protocol_short_name(protocol);
|
|
|
|
|
|
|
|
return module;
|
|
|
|
}
|
|
|
|
|
2015-12-10 13:10:17 +00:00
|
|
|
void
|
|
|
|
expert_deregister_expertinfo (const char *abbrev)
|
|
|
|
{
|
|
|
|
expert_field_info *expinfo = (expert_field_info*)g_hash_table_lookup(gpa_name_map, abbrev);
|
|
|
|
if (expinfo) {
|
|
|
|
g_ptr_array_add(deregistered_expertinfos, gpa_expertinfo.ei[expinfo->id]);
|
|
|
|
g_hash_table_steal(gpa_name_map, abbrev);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
expert_deregister_protocol (expert_module_t *module)
|
|
|
|
{
|
|
|
|
wmem_free(wmem_epan_scope(), module);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
free_deregistered_expertinfo (gpointer data, gpointer user_data _U_)
|
|
|
|
{
|
|
|
|
expert_field_info *expinfo = (expert_field_info *) data;
|
|
|
|
gpa_expertinfo.ei[expinfo->id] = NULL; /* Invalidate this id */
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
expert_free_deregistered_expertinfos (void)
|
2015-08-11 12:08:08 +00:00
|
|
|
{
|
2015-12-10 13:10:17 +00:00
|
|
|
g_ptr_array_foreach(deregistered_expertinfos, free_deregistered_expertinfo, NULL);
|
|
|
|
g_ptr_array_free(deregistered_expertinfos, TRUE);
|
|
|
|
deregistered_expertinfos = g_ptr_array_new();
|
2015-08-11 12:08:08 +00:00
|
|
|
}
|
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
static int
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_register_field_init(expert_field_info *expinfo, expert_module_t *module)
|
2013-05-24 17:59:36 +00:00
|
|
|
{
|
2021-03-06 13:07:51 +00:00
|
|
|
/* Check for valid group and severity vals */
|
|
|
|
switch (expinfo->group) {
|
|
|
|
case PI_CHECKSUM:
|
|
|
|
case PI_SEQUENCE:
|
|
|
|
case PI_RESPONSE_CODE:
|
|
|
|
case PI_REQUEST_CODE:
|
|
|
|
case PI_UNDECODED:
|
|
|
|
case PI_REASSEMBLE:
|
|
|
|
case PI_MALFORMED:
|
|
|
|
case PI_DEBUG:
|
|
|
|
case PI_PROTOCOL:
|
|
|
|
case PI_SECURITY:
|
|
|
|
case PI_COMMENTS_GROUP:
|
|
|
|
case PI_DECRYPTION:
|
|
|
|
case PI_ASSUMPTION:
|
|
|
|
case PI_DEPRECATED:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
REPORT_DISSECTOR_BUG("Expert info for %s has invalid group=0x%08x\n", expinfo->name, expinfo->group);
|
|
|
|
}
|
|
|
|
switch (expinfo->severity) {
|
|
|
|
case PI_COMMENT:
|
|
|
|
case PI_CHAT:
|
|
|
|
case PI_NOTE:
|
|
|
|
case PI_WARN:
|
|
|
|
case PI_ERROR:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
REPORT_DISSECTOR_BUG("Expert info for %s has invalid severity=0x%08x\n", expinfo->name, expinfo->severity);
|
|
|
|
}
|
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
expinfo->protocol = module->proto_name;
|
|
|
|
|
|
|
|
/* if we always add and never delete, then id == len - 1 is correct */
|
|
|
|
if (gpa_expertinfo.len >= gpa_expertinfo.allocated_len) {
|
|
|
|
if (!gpa_expertinfo.ei) {
|
|
|
|
gpa_expertinfo.allocated_len = PRE_ALLOC_EXPERT_FIELDS_MEM;
|
|
|
|
gpa_expertinfo.ei = (expert_field_info **)g_malloc(sizeof(expert_field_info *)*PRE_ALLOC_EXPERT_FIELDS_MEM);
|
|
|
|
} else {
|
|
|
|
gpa_expertinfo.allocated_len += 1000;
|
|
|
|
gpa_expertinfo.ei = (expert_field_info **)g_realloc(gpa_expertinfo.ei,
|
|
|
|
sizeof(expert_field_info *)*gpa_expertinfo.allocated_len);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gpa_expertinfo.ei[gpa_expertinfo.len] = expinfo;
|
|
|
|
gpa_expertinfo.len++;
|
|
|
|
expinfo->id = gpa_expertinfo.len - 1;
|
2014-07-16 03:04:41 +00:00
|
|
|
/* Save the original severity so it can be restored by the UAT */
|
|
|
|
expinfo->orig_severity = expinfo->severity;
|
|
|
|
|
|
|
|
/* save field name for lookup */
|
|
|
|
g_hash_table_insert(gpa_name_map, (gpointer) (expinfo->name), expinfo);
|
2013-05-24 17:59:36 +00:00
|
|
|
|
|
|
|
return expinfo->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* for use with static arrays only, since we don't allocate our own copies
|
|
|
|
of the expert_field_info struct contained within the exp_register_info struct */
|
|
|
|
void
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_register_field_array(expert_module_t *module, ei_register_info *exp, const int num_records)
|
2013-05-24 17:59:36 +00:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
ei_register_info *ptr = exp;
|
|
|
|
|
|
|
|
for (i = 0; i < num_records; i++, ptr++) {
|
|
|
|
/*
|
|
|
|
* Make sure we haven't registered this yet.
|
|
|
|
* Most fields have variables associated with them
|
|
|
|
* that are initialized to -1; some have array elements,
|
|
|
|
* or possibly uninitialized variables, so we also allow
|
|
|
|
* 0 (which is unlikely to be the field ID we get back
|
|
|
|
* from "expert_register_field_init()").
|
|
|
|
*/
|
|
|
|
if (ptr->ids->ei != -1 && ptr->ids->ei != 0) {
|
|
|
|
fprintf(stderr,
|
2015-08-21 11:54:53 +00:00
|
|
|
"Duplicate field detected in call to expert_register_field_array: '%s' is already registered, name=%s\n",
|
|
|
|
ptr->eiinfo.summary, ptr->eiinfo.name);
|
2013-05-24 17:59:36 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Register the field with the experts */
|
|
|
|
ptr->ids->ei = expert_register_field_init(&ptr->eiinfo, module);
|
|
|
|
|
|
|
|
/* Register with the header field info, so it's display filterable */
|
|
|
|
ptr->eiinfo.hf_info.p_id = &ptr->ids->hf;
|
2017-12-13 10:36:37 +00:00
|
|
|
ptr->eiinfo.hf_info.hfinfo.name = ptr->eiinfo.summary;
|
2013-05-24 17:59:36 +00:00
|
|
|
ptr->eiinfo.hf_info.hfinfo.abbrev = ptr->eiinfo.name;
|
|
|
|
|
|
|
|
proto_register_field_array(module->proto_id, &ptr->eiinfo.hf_info, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-16 03:04:41 +00:00
|
|
|
/* Finds a record in the expert array by name.
|
|
|
|
* For the moment, this function is only used "internally"
|
|
|
|
* but may find a reason to be exported
|
|
|
|
*/
|
|
|
|
static expert_field_info *
|
|
|
|
expert_registrar_get_byname(const char *field_name)
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_field_info *hfinfo;
|
2014-07-16 03:04:41 +00:00
|
|
|
|
|
|
|
if (!field_name)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
hfinfo = (expert_field_info*)g_hash_table_lookup(gpa_name_map, field_name);
|
|
|
|
|
|
|
|
return hfinfo;
|
|
|
|
}
|
|
|
|
|
2015-09-07 19:00:11 +00:00
|
|
|
/**
|
|
|
|
* Get summary text of an expert_info field.
|
|
|
|
* This is intended for use in expert_add_info_format or proto_tree_add_expert_format
|
|
|
|
* to get the "base" string to then append additional information
|
|
|
|
*/
|
|
|
|
const gchar* expert_get_summary(expert_field *eiindex)
|
|
|
|
{
|
|
|
|
expert_field_info *eiinfo;
|
|
|
|
|
|
|
|
/* Look up the item */
|
|
|
|
EXPERT_REGISTRAR_GET_NTH(eiindex->ei, eiinfo);
|
|
|
|
|
2018-05-14 08:23:04 +00:00
|
|
|
return eiinfo->summary;
|
2015-09-07 19:00:11 +00:00
|
|
|
}
|
2014-07-16 03:04:41 +00:00
|
|
|
|
2013-08-05 02:25:45 +00:00
|
|
|
/** clear flags according to the mask and set new flag values */
|
|
|
|
#define FI_REPLACE_FLAGS(fi, mask, flags_in) { \
|
|
|
|
(fi->flags = (fi)->flags & ~(mask)); \
|
|
|
|
(fi->flags = (fi)->flags | (flags_in)); \
|
|
|
|
}
|
2006-08-31 22:56:38 +00:00
|
|
|
|
2009-09-06 18:25:23 +00:00
|
|
|
/* set's the PI_ flags to a protocol item
|
2009-09-30 13:04:06 +00:00
|
|
|
* (and its parent items till the toplevel) */
|
2005-09-11 16:55:34 +00:00
|
|
|
static void
|
2013-08-05 02:25:45 +00:00
|
|
|
expert_set_item_flags(proto_item *pi, const int group, const guint severity)
|
2005-09-11 16:55:34 +00:00
|
|
|
{
|
2013-08-05 02:25:45 +00:00
|
|
|
if (pi != NULL && PITEM_FINFO(pi) != NULL && (severity >= FI_GET_FLAG(PITEM_FINFO(pi), PI_SEVERITY_MASK))) {
|
|
|
|
FI_REPLACE_FLAGS(PITEM_FINFO(pi), PI_GROUP_MASK, group);
|
|
|
|
FI_REPLACE_FLAGS(PITEM_FINFO(pi), PI_SEVERITY_MASK, severity);
|
|
|
|
|
2005-09-11 16:55:34 +00:00
|
|
|
/* propagate till toplevel item */
|
|
|
|
pi = proto_item_get_parent(pi);
|
|
|
|
expert_set_item_flags(pi, group, severity);
|
2014-07-16 03:04:41 +00:00
|
|
|
}
|
2005-09-11 16:55:34 +00:00
|
|
|
}
|
|
|
|
|
2009-03-09 00:26:25 +00:00
|
|
|
static proto_tree*
|
|
|
|
expert_create_tree(proto_item *pi, int group, int severity, const char *msg)
|
|
|
|
{
|
|
|
|
proto_tree *tree;
|
|
|
|
proto_item *ti;
|
|
|
|
|
|
|
|
tree = proto_item_add_subtree(pi, ett_expert);
|
2009-09-06 18:25:23 +00:00
|
|
|
ti = proto_tree_add_protocol_format(tree, proto_expert, NULL, 0, 0, "Expert Info (%s/%s): %s",
|
2010-02-27 22:12:43 +00:00
|
|
|
val_to_str(severity, expert_severity_vals, "Unknown (%u)"),
|
|
|
|
val_to_str(group, expert_group_vals, "Unknown (%u)"),
|
2009-09-30 13:04:06 +00:00
|
|
|
msg);
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_generated(ti);
|
2009-03-09 00:26:25 +00:00
|
|
|
|
2010-07-16 11:17:32 +00:00
|
|
|
if (group == PI_MALFORMED) {
|
|
|
|
/* Add hidden malformed protocol filter */
|
2011-07-19 19:37:58 +00:00
|
|
|
proto_item *malformed_ti = proto_tree_add_item(tree, proto_malformed, NULL, 0, 0, ENC_NA);
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_hidden(malformed_ti);
|
2010-07-16 11:17:32 +00:00
|
|
|
}
|
|
|
|
|
2009-03-09 00:26:25 +00:00
|
|
|
return proto_item_add_subtree(ti, ett_subexpert);
|
|
|
|
}
|
2005-09-11 16:55:34 +00:00
|
|
|
|
|
|
|
static void
|
2013-05-24 17:59:36 +00:00
|
|
|
expert_set_info_vformat(packet_info *pinfo, proto_item *pi, int group, int severity, int hf_index, gboolean use_vaformat,
|
2014-09-15 23:32:13 +00:00
|
|
|
const char *format, va_list ap)
|
2005-09-11 16:55:34 +00:00
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
char formatted[ITEM_LABEL_LENGTH];
|
|
|
|
int tap;
|
|
|
|
expert_info_t *ei;
|
|
|
|
proto_tree *tree;
|
|
|
|
proto_item *ti;
|
2005-09-11 16:55:34 +00:00
|
|
|
|
2012-08-10 22:52:04 +00:00
|
|
|
if (pinfo == NULL && pi && pi->tree_data) {
|
2012-08-10 20:33:01 +00:00
|
|
|
pinfo = PTREE_DATA(pi)->pinfo;
|
|
|
|
}
|
|
|
|
|
2005-09-11 16:55:34 +00:00
|
|
|
/* if this packet isn't loaded because of a read filter, don't output anything */
|
2016-01-24 03:40:51 +00:00
|
|
|
if (pinfo == NULL || pinfo->num == 0) {
|
2005-09-11 16:55:34 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-02-27 22:12:43 +00:00
|
|
|
if (severity > highest_severity) {
|
2009-09-30 13:04:06 +00:00
|
|
|
highest_severity = severity;
|
|
|
|
}
|
2009-09-13 13:39:09 +00:00
|
|
|
|
2014-03-25 22:11:05 +00:00
|
|
|
/* XXX: can we get rid of these checks and make them programming errors instead now? */
|
2010-02-27 22:12:43 +00:00
|
|
|
if (pi != NULL && PITEM_FINFO(pi) != NULL) {
|
2009-09-13 13:39:09 +00:00
|
|
|
expert_set_item_flags(pi, group, severity);
|
|
|
|
}
|
|
|
|
|
2014-02-25 20:42:35 +00:00
|
|
|
if ((pi == NULL) || (PITEM_FINFO(pi) == NULL) ||
|
2013-05-24 19:23:36 +00:00
|
|
|
((guint)severity >= FI_GET_FLAG(PITEM_FINFO(pi), PI_SEVERITY_MASK))) {
|
|
|
|
col_add_str(pinfo->cinfo, COL_EXPERT, val_to_str(severity, expert_severity_vals, "Unknown (%u)"));
|
|
|
|
}
|
2006-08-31 22:56:38 +00:00
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
if (use_vaformat) {
|
2021-02-27 07:17:11 +00:00
|
|
|
vsnprintf(formatted, ITEM_LABEL_LENGTH, format, ap);
|
2013-05-24 17:59:36 +00:00
|
|
|
} else {
|
2021-04-30 10:18:25 +00:00
|
|
|
(void) g_strlcpy(formatted, format, ITEM_LABEL_LENGTH);
|
2013-05-24 17:59:36 +00:00
|
|
|
}
|
2005-09-11 16:55:34 +00:00
|
|
|
|
2009-03-09 00:26:25 +00:00
|
|
|
tree = expert_create_tree(pi, group, severity, formatted);
|
2012-06-27 14:15:46 +00:00
|
|
|
|
2013-05-24 17:59:36 +00:00
|
|
|
if (hf_index == -1) {
|
|
|
|
/* If no filterable expert info, just add the message */
|
|
|
|
ti = proto_tree_add_string(tree, hf_expert_msg, NULL, 0, 0, formatted);
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_generated(ti);
|
2013-05-24 17:59:36 +00:00
|
|
|
} else {
|
|
|
|
/* If filterable expert info, hide the "generic" form of the message,
|
|
|
|
and generate the formatted filterable expert info */
|
|
|
|
ti = proto_tree_add_none_format(tree, hf_index, NULL, 0, 0, "%s", formatted);
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_generated(ti);
|
2013-05-24 17:59:36 +00:00
|
|
|
ti = proto_tree_add_string(tree, hf_expert_msg, NULL, 0, 0, formatted);
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_hidden(ti);
|
2013-05-24 17:59:36 +00:00
|
|
|
}
|
|
|
|
|
2012-06-27 14:15:46 +00:00
|
|
|
ti = proto_tree_add_uint_format_value(tree, hf_expert_severity, NULL, 0, 0, severity,
|
2012-06-27 14:44:00 +00:00
|
|
|
"%s", val_to_str_const(severity, expert_severity_vals, "Unknown"));
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_generated(ti);
|
2012-06-27 14:15:46 +00:00
|
|
|
ti = proto_tree_add_uint_format_value(tree, hf_expert_group, NULL, 0, 0, group,
|
2012-06-27 14:44:00 +00:00
|
|
|
"%s", val_to_str_const(group, expert_group_vals, "Unknown"));
|
2019-04-03 21:32:30 +00:00
|
|
|
proto_item_set_generated(ti);
|
2009-03-09 00:26:25 +00:00
|
|
|
|
2010-02-27 22:12:43 +00:00
|
|
|
tap = have_tap_listener(expert_tap);
|
|
|
|
|
2009-09-13 13:39:09 +00:00
|
|
|
if (!tap)
|
|
|
|
return;
|
|
|
|
|
2021-07-16 15:36:34 +00:00
|
|
|
ei = wmem_new(pinfo->pool, expert_info_t);
|
2009-09-30 13:04:06 +00:00
|
|
|
|
2016-01-24 03:40:51 +00:00
|
|
|
ei->packet_num = pinfo->num;
|
2010-02-27 22:12:43 +00:00
|
|
|
ei->group = group;
|
|
|
|
ei->severity = severity;
|
2015-03-11 22:22:20 +00:00
|
|
|
ei->hf_index = hf_index;
|
2010-02-27 22:12:43 +00:00
|
|
|
ei->protocol = pinfo->current_proto;
|
2021-07-16 15:36:34 +00:00
|
|
|
ei->summary = wmem_strdup(pinfo->pool, formatted);
|
2009-09-13 13:39:09 +00:00
|
|
|
|
2005-09-11 16:55:34 +00:00
|
|
|
/* if we have a proto_item (not a faked item), set expert attributes to it */
|
2010-02-27 22:12:43 +00:00
|
|
|
if (pi != NULL && PITEM_FINFO(pi) != NULL) {
|
2009-09-30 13:04:06 +00:00
|
|
|
ei->pitem = pi;
|
2014-03-25 22:11:05 +00:00
|
|
|
}
|
|
|
|
/* XXX: remove this because we don't have an internal-only function now? */
|
|
|
|
else {
|
2010-02-27 22:12:43 +00:00
|
|
|
ei->pitem = NULL;
|
2005-09-11 16:55:34 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
tap_queue_packet(expert_tap, pinfo, ei);
|
|
|
|
}
|
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
/* Helper function for expert_add_info() to work around compiler's special needs on ARM */
|
2014-06-19 21:54:57 +00:00
|
|
|
static inline void
|
|
|
|
expert_add_info_internal(packet_info *pinfo, proto_item *pi, expert_field *expindex, ...)
|
2013-05-24 17:59:36 +00:00
|
|
|
{
|
2014-06-19 21:54:57 +00:00
|
|
|
/* the va_list is ignored */
|
2014-09-15 23:32:13 +00:00
|
|
|
va_list unused;
|
|
|
|
expert_field_info *eiinfo;
|
2013-05-24 17:59:36 +00:00
|
|
|
|
|
|
|
/* Look up the item */
|
|
|
|
EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
|
|
|
|
|
2014-06-19 21:54:57 +00:00
|
|
|
va_start(unused, expindex);
|
|
|
|
expert_set_info_vformat(pinfo, pi, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, FALSE, eiinfo->summary, unused);
|
|
|
|
va_end(unused);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
expert_add_info(packet_info *pinfo, proto_item *pi, expert_field *expindex)
|
|
|
|
{
|
|
|
|
expert_add_info_internal(pinfo, pi, expindex);
|
2013-05-24 17:59:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2013-09-08 19:32:10 +00:00
|
|
|
expert_add_info_format(packet_info *pinfo, proto_item *pi, expert_field *expindex, const char *format, ...)
|
2013-05-24 17:59:36 +00:00
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
va_list ap;
|
|
|
|
expert_field_info *eiinfo;
|
2013-05-24 17:59:36 +00:00
|
|
|
|
|
|
|
/* Look up the item */
|
|
|
|
EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
|
|
|
|
|
|
|
|
va_start(ap, format);
|
|
|
|
expert_set_info_vformat(pinfo, pi, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, TRUE, format, ap);
|
2005-09-11 16:55:34 +00:00
|
|
|
va_end(ap);
|
|
|
|
}
|
|
|
|
|
2014-09-15 23:32:13 +00:00
|
|
|
/* Helper function for expert_add_expert() to work around compiler's special needs on ARM */
|
2014-06-19 21:54:57 +00:00
|
|
|
static inline proto_item *
|
2014-09-15 23:32:13 +00:00
|
|
|
proto_tree_add_expert_internal(proto_tree *tree, packet_info *pinfo, expert_field *expindex,
|
2014-06-19 21:54:57 +00:00
|
|
|
tvbuff_t *tvb, gint start, gint length, ...)
|
2013-07-02 19:53:28 +00:00
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
expert_field_info *eiinfo;
|
|
|
|
proto_item *ti;
|
2018-06-06 16:22:45 +00:00
|
|
|
gint item_length, captured_length;
|
2014-09-15 23:32:13 +00:00
|
|
|
va_list unused;
|
2013-07-02 19:53:28 +00:00
|
|
|
|
|
|
|
/* Look up the item */
|
|
|
|
EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
|
|
|
|
|
2018-06-06 16:22:45 +00:00
|
|
|
/* Make sure this doesn't throw an exception when adding the item */
|
|
|
|
item_length = length;
|
|
|
|
captured_length = tvb_captured_length_remaining(tvb, start);
|
|
|
|
if (captured_length < 0)
|
|
|
|
item_length = 0;
|
|
|
|
else if (captured_length < item_length)
|
|
|
|
item_length = captured_length;
|
|
|
|
ti = proto_tree_add_text_internal(tree, tvb, start, item_length, "%s", eiinfo->summary);
|
2014-06-19 21:54:57 +00:00
|
|
|
va_start(unused, length);
|
|
|
|
expert_set_info_vformat(pinfo, ti, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, FALSE, eiinfo->summary, unused);
|
|
|
|
va_end(unused);
|
2018-06-06 16:22:45 +00:00
|
|
|
|
|
|
|
/* But make sure it throws an exception *after* adding the item */
|
2018-06-12 06:17:54 +00:00
|
|
|
if (length != -1) {
|
2018-06-06 16:22:45 +00:00
|
|
|
tvb_ensure_bytes_exist(tvb, start, length);
|
|
|
|
}
|
2013-07-02 19:53:28 +00:00
|
|
|
return ti;
|
|
|
|
}
|
|
|
|
|
2014-06-19 21:54:57 +00:00
|
|
|
proto_item *
|
2014-09-15 23:32:13 +00:00
|
|
|
proto_tree_add_expert(proto_tree *tree, packet_info *pinfo, expert_field *expindex,
|
2014-06-19 21:54:57 +00:00
|
|
|
tvbuff_t *tvb, gint start, gint length)
|
|
|
|
{
|
|
|
|
return proto_tree_add_expert_internal(tree, pinfo, expindex, tvb, start, length);
|
|
|
|
}
|
|
|
|
|
2013-07-02 19:53:28 +00:00
|
|
|
proto_item *
|
2014-09-15 23:32:13 +00:00
|
|
|
proto_tree_add_expert_format(proto_tree *tree, packet_info *pinfo, expert_field *expindex,
|
2013-07-02 19:53:28 +00:00
|
|
|
tvbuff_t *tvb, gint start, gint length, const char *format, ...)
|
|
|
|
{
|
2014-09-15 23:32:13 +00:00
|
|
|
va_list ap;
|
|
|
|
expert_field_info *eiinfo;
|
2018-06-06 16:22:45 +00:00
|
|
|
gint item_length, captured_length;
|
2014-09-15 23:32:13 +00:00
|
|
|
proto_item *ti;
|
2013-07-02 19:53:28 +00:00
|
|
|
|
|
|
|
/* Look up the item */
|
|
|
|
EXPERT_REGISTRAR_GET_NTH(expindex->ei, eiinfo);
|
|
|
|
|
2018-06-06 16:22:45 +00:00
|
|
|
/* Make sure this doesn't throw an exception when adding the item */
|
|
|
|
item_length = length;
|
|
|
|
captured_length = tvb_captured_length_remaining(tvb, start);
|
|
|
|
if (captured_length < 0)
|
|
|
|
item_length = 0;
|
|
|
|
else if (captured_length < item_length)
|
|
|
|
item_length = captured_length;
|
2013-07-02 19:53:28 +00:00
|
|
|
va_start(ap, format);
|
2018-06-06 16:22:45 +00:00
|
|
|
ti = proto_tree_add_text_valist_internal(tree, tvb, start, item_length, format, ap);
|
2013-07-05 23:53:25 +00:00
|
|
|
va_end(ap);
|
|
|
|
|
|
|
|
va_start(ap, format);
|
2013-07-02 19:53:28 +00:00
|
|
|
expert_set_info_vformat(pinfo, ti, eiinfo->group, eiinfo->severity, *eiinfo->hf_info.p_id, TRUE, format, ap);
|
|
|
|
va_end(ap);
|
2013-07-05 23:53:25 +00:00
|
|
|
|
2018-06-06 16:22:45 +00:00
|
|
|
/* But make sure it throws an exception *after* adding the item */
|
2018-06-12 06:17:54 +00:00
|
|
|
if (length != -1) {
|
2018-06-06 16:22:45 +00:00
|
|
|
tvb_ensure_bytes_exist(tvb, start, length);
|
|
|
|
}
|
2013-07-02 19:53:28 +00:00
|
|
|
return ti;
|
|
|
|
}
|
2014-09-15 23:32:13 +00:00
|
|
|
|
|
|
|
/*
|
2019-07-26 18:43:17 +00:00
|
|
|
* Editor modelines - https://www.wireshark.org/tools/modelines.html
|
2014-09-15 23:32:13 +00:00
|
|
|
*
|
|
|
|
* Local variables:
|
|
|
|
* c-basic-offset: 8
|
|
|
|
* tab-width: 8
|
|
|
|
* indent-tabs-mode: t
|
|
|
|
* End:
|
|
|
|
*
|
|
|
|
* vi: set shiftwidth=8 tabstop=8 noexpandtab:
|
|
|
|
* :indentSize=8:tabSize=8:noTabs=false:
|
|
|
|
*/
|