diff --git a/epan/dissectors/packet-bgp.c b/epan/dissectors/packet-bgp.c index 6a0f27087a..33fcb12c44 100644 --- a/epan/dissectors/packet-bgp.c +++ b/epan/dissectors/packet-bgp.c @@ -936,6 +936,7 @@ static expert_field ei_bgp_cap_gr_helper_mode_only = EI_INIT; static expert_field ei_bgp_notify_minor_unknown = EI_INIT; static expert_field ei_bgp_route_refresh_orf_type_unknown = EI_INIT; static expert_field ei_bgp_length_invalid = EI_INIT; +static expert_field ei_bgp_afi_type_not_supported = EI_INIT; /* desegmentation */ static gboolean bgp_desegment = TRUE; @@ -1419,7 +1420,7 @@ decode_flowspec_nlri(proto_tree *tree, tvbuff_t *tvb, gint offset, guint16 afi, if (afi != AFNUM_INET) { - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "AFI Type not supported"); + expert_add_info(pinfo, NULL, &ei_bgp_afi_type_not_supported); return(-1); } @@ -5100,6 +5101,7 @@ proto_register_bgp(void) { &ei_bgp_notify_minor_unknown, { "bgp.notify.minor_error.unknown", PI_UNDECODED, PI_NOTE, "Unknown notification error", EXPFILL }}, { &ei_bgp_route_refresh_orf_type_unknown, { "bgp.route_refresh.orf.type.unknown", PI_CHAT, PI_ERROR, "ORFEntry-Unknown", EXPFILL }}, { &ei_bgp_length_invalid, { "bgp.length.invalid", PI_MALFORMED, PI_ERROR, "Length is invalid", EXPFILL }}, + { &ei_bgp_afi_type_not_supported, { "bgp.afi_type_not_supported", PI_PROTOCOL, PI_ERROR, "AFI Type not supported", EXPFILL }}, }; module_t *bgp_module; diff --git a/epan/dissectors/packet-btatt.c b/epan/dissectors/packet-btatt.c index a96f6af283..d851a97854 100644 --- a/epan/dissectors/packet-btatt.c +++ b/epan/dissectors/packet-btatt.c @@ -62,6 +62,9 @@ static int hf_btatt_signature = -1; static gint ett_btatt = -1; static gint ett_btatt_list = -1; +static expert_field ei_btatt_uuid_format_unknown = EI_INIT; +static expert_field ei_btatt_handle_too_few = EI_INIT; + /* Opcodes */ static const value_string opcode_vals[] = { {0x01, "Error Response"}, @@ -343,7 +346,7 @@ dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U } } else { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Unknown format"); + expert_add_info(pinfo, item, &ei_btatt_uuid_format_unknown); } } break; @@ -451,8 +454,7 @@ dissect_btatt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U case 0x0e: /* Multiple Read Request */ if(tvb_length_remaining(tvb, offset) < 4) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, - "Too few handles, should be 2 or more"); + expert_add_info(pinfo, item, &ei_btatt_handle_too_few); break; } @@ -654,6 +656,13 @@ proto_register_btatt(void) &ett_btatt_list }; + static ei_register_info ei[] = { + { &ei_btatt_uuid_format_unknown, { "btatt.uuid_format.unknown", PI_PROTOCOL, PI_WARN, "Unknown format", EXPFILL }}, + { &ei_btatt_handle_too_few, { "btatt.handle.too_few", PI_PROTOCOL, PI_WARN, "Too few handles, should be 2 or more", EXPFILL }}, + }; + + expert_module_t* expert_btatt; + /* Register the protocol name and description */ proto_btatt = proto_register_protocol("Bluetooth Attribute Protocol", "BT ATT", "btatt"); @@ -662,6 +671,8 @@ proto_register_btatt(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_btatt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btatt = expert_register_protocol(proto_btatt); + expert_register_field_array(expert_btatt, ei, array_length(ei)); module = prefs_register_protocol(proto_btatt, NULL); prefs_register_static_text_preference(module, "att.version", diff --git a/epan/dissectors/packet-btavctp.c b/epan/dissectors/packet-btavctp.c index bbe4422b17..94e3dd0ad1 100644 --- a/epan/dissectors/packet-btavctp.c +++ b/epan/dissectors/packet-btavctp.c @@ -52,6 +52,8 @@ static int hf_btavctp_number_of_packets = -1; static gint ett_btavctp = -1; +static expert_field ei_btavctp_unexpected_frame = EI_INIT; + static dissector_table_t avctp_service_dissector_table; static dissector_handle_t data_handle = NULL; @@ -351,8 +353,7 @@ dissect_btavctp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) length = 0; if (!fragments || fragments->count != fragments->number_of_packets) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Unexpected frame"); + expert_add_info(pinfo, pitem, &ei_btavctp_unexpected_frame); call_dissector(data_handle, next_tvb, pinfo, tree); } else { guint8 *reassembled; @@ -393,6 +394,7 @@ void proto_register_btavctp(void) { module_t *module; + expert_module_t* expert_btavctp; static hf_register_info hf[] = { { &hf_btavctp_transaction, @@ -436,6 +438,10 @@ proto_register_btavctp(void) &ett_btavctp }; + static ei_register_info ei[] = { + { &ei_btavctp_unexpected_frame, { "btavctp.unexpected_frame", PI_PROTOCOL, PI_WARN, "Unexpected frame", EXPFILL }}, + }; + reassembling = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); avctp_service_dissector_table = register_dissector_table("btavctp.service", "AVCTP Service", FT_UINT16, BASE_HEX); @@ -445,6 +451,8 @@ proto_register_btavctp(void) proto_register_field_array(proto_btavctp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btavctp = expert_register_protocol(proto_btavctp); + expert_register_field_array(expert_btavctp, ei, array_length(ei)); module = prefs_register_protocol(proto_btavctp, NULL); prefs_register_static_text_preference(module, "avctp.version", diff --git a/epan/dissectors/packet-btavdtp.c b/epan/dissectors/packet-btavdtp.c index a10ac9d410..f92478db9a 100644 --- a/epan/dissectors/packet-btavdtp.c +++ b/epan/dissectors/packet-btavdtp.c @@ -227,6 +227,10 @@ static gint ett_btavdtp_sep = -1; static gint ett_btavdtp_capabilities = -1; static gint ett_btavdtp_service = -1; +static expert_field ei_btavdtp_sbc_min_bitpool_out_of_range = EI_INIT; +static expert_field ei_btavdtp_sbc_max_bitpool_out_of_range = EI_INIT; +static expert_field ei_btavdtp_unexpected_losc_data = EI_INIT; + static gboolean force_avdtp = FALSE; static dissector_handle_t btavdtp_handle; @@ -567,15 +571,13 @@ dissect_codec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset, pitem = proto_tree_add_item(tree, hf_btavdtp_sbc_min_bitpool, tvb, offset + 2, 1, ENC_BIG_ENDIAN); bitpool = tvb_get_guint8(tvb, offset + 2); if (bitpool < 2 || bitpool > 250) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Bitpool is out of range. Should be 2..250."); + expert_add_info(pinfo, pitem, &ei_btavdtp_sbc_min_bitpool_out_of_range); } pitem = proto_tree_add_item(tree, hf_btavdtp_sbc_max_bitpool, tvb, offset + 3, 1, ENC_BIG_ENDIAN); bitpool = tvb_get_guint8(tvb, offset + 3); if (bitpool < 2 || bitpool > 250) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Bitpool is out of range. Should be 2..250."); + expert_add_info(pinfo, pitem, &ei_btavdtp_sbc_max_bitpool_out_of_range); } break; case CODEC_MPEG12_AUDIO: @@ -870,8 +872,7 @@ dissect_capabilities(tvbuff_t *tvb, packet_info *pinfo, pitem = proto_tree_add_item(service_tree, hf_btavdtp_data, tvb, offset, losc, ENC_NA); offset += losc; - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Unexpected losc data"); + expert_add_info(pinfo, pitem, &ei_btavdtp_unexpected_losc_data); } } @@ -2156,15 +2157,24 @@ void proto_register_btvdp(void) { module_t *module; + expert_module_t* expert_btavdtp; static gint *ett[] = { &ett_btvdp }; + static ei_register_info ei[] = { + { &ei_btavdtp_sbc_min_bitpool_out_of_range, { "btavdtp.codec.sbc.minimum_bitpool.out_of_range", PI_PROTOCOL, PI_WARN, "Bitpool is out of range. Should be 2..250.", EXPFILL }}, + { &ei_btavdtp_sbc_max_bitpool_out_of_range, { "btavdtp.codec.sbc.maximum_bitpool.out_of_range", PI_PROTOCOL, PI_WARN, "Bitpool is out of range. Should be 2..250.", EXPFILL }}, + { &ei_btavdtp_unexpected_losc_data, { "btavdtp.unexpected_losc_data", PI_PROTOCOL, PI_WARN, "Unexpected losc data", EXPFILL }}, + }; + proto_btvdp = proto_register_protocol("Bluetooth VDP Profile", "BT VDP", "btvdp"); new_register_dissector("btvdp", dissect_btvdp, proto_btvdp); proto_register_subtree_array(ett, array_length(ett)); + expert_btavdtp = expert_register_protocol(proto_btvdp); + expert_register_field_array(expert_btavdtp, ei, array_length(ei)); module = prefs_register_protocol(proto_btvdp, NULL); prefs_register_static_text_preference(module, "vdp.version", diff --git a/epan/dissectors/packet-btavrcp.c b/epan/dissectors/packet-btavrcp.c index ff163a890a..6a1065a074 100644 --- a/epan/dissectors/packet-btavrcp.c +++ b/epan/dissectors/packet-btavrcp.c @@ -202,6 +202,9 @@ static gint ett_btavrcp_features = -1; static gint ett_btavrcp_features_not_used = -1; static gint ett_btavrcp_path = -1; +static expert_field ei_btavrcp_item_length_bad = EI_INIT; +static expert_field ei_btavrcp_unexpected_data = EI_INIT; + #define OPCODE_VENDOR_DEPENDANT 0x00 #define OPCODE_UNIT 0x30 #define OPCODE_SUBUNIT 0x31 @@ -856,8 +859,7 @@ dissect_item_media_element(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset = dissect_attribute_entries(tvb, pinfo, ptree, offset, number_of_attributes); if ( item_length != (guint) offset - offset_in) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Item length does not correspond to sum of length of attributes"); + expert_add_info(pinfo, pitem, &ei_btavrcp_item_length_bad); } return offset; @@ -2300,8 +2302,7 @@ dissect_btavrcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_reported_length_remaining(tvb, offset) > 0) { pitem = proto_tree_add_item(btavrcp_tree, hf_btavrcp_data, tvb, offset, -1, ENC_NA); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Unexpected data"); + expert_add_info(pinfo, pitem, &ei_btavrcp_unexpected_data); } } @@ -2311,6 +2312,7 @@ void proto_register_btavrcp(void) { module_t *module; + expert_module_t* expert_btavrcp; static hf_register_info hf[] = { { &hf_btavrcp_reserved, @@ -3080,6 +3082,11 @@ proto_register_btavrcp(void) &ett_btavrcp_path, }; + static ei_register_info ei[] = { + { &ei_btavrcp_item_length_bad, { "btavrcp.item.length.bad", PI_PROTOCOL, PI_WARN, "Item length does not correspond to sum of length of attributes", EXPFILL }}, + { &ei_btavrcp_unexpected_data, { "btavrcp.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected data", EXPFILL }}, + }; + reassembling = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); timing = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); @@ -3088,6 +3095,8 @@ proto_register_btavrcp(void) proto_register_field_array(proto_btavrcp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btavrcp = expert_register_protocol(proto_btavrcp); + expert_register_field_array(expert_btavrcp, ei, array_length(ei)); module = prefs_register_protocol(proto_btavrcp, NULL); prefs_register_static_text_preference(module, "avrcp.version", diff --git a/epan/dissectors/packet-btbnep.c b/epan/dissectors/packet-btbnep.c index 5a213730d0..214f4b9f89 100644 --- a/epan/dissectors/packet-btbnep.c +++ b/epan/dissectors/packet-btbnep.c @@ -69,6 +69,8 @@ static int hf_btbnep_multicast_address_end = -1; static gint ett_btbnep = -1; static gint ett_addr = -1; +static expert_field ei_btbnep_src_not_group_address = EI_INIT; + static gboolean top_dissect = TRUE; static dissector_handle_t eth_handle; @@ -337,8 +339,7 @@ dissect_btbnep(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (addr_item) { addr_tree = proto_item_add_subtree(addr_item, ett_addr); if (tvb_get_guint8(tvb, offset) & 0x01) { - expert_add_info_format(pinfo, addr_item, PI_PROTOCOL, PI_WARN, - "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)"); + expert_add_info(pinfo, addr_item, &ei_btbnep_src_not_group_address); } } proto_tree_add_ether(addr_tree, hf_btbnep_addr, tvb, offset, 6, src_addr); @@ -380,6 +381,7 @@ void proto_register_btbnep(void) { module_t *module; + expert_module_t* expert_btbnep; static hf_register_info hf[] = { { &hf_btbnep_bnep_type, @@ -505,11 +507,17 @@ proto_register_btbnep(void) &ett_addr }; + static ei_register_info ei[] = { + { &ei_btbnep_src_not_group_address, { "btbnep.src.not_group_address", PI_PROTOCOL, PI_WARN, "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)", EXPFILL }}, + }; + proto_btbnep = proto_register_protocol("Bluetooth BNEP Protocol", "BT BNEP", "btbnep"); register_dissector("btbnep", dissect_btbnep, proto_btbnep); proto_register_field_array(proto_btbnep, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btbnep = expert_register_protocol(proto_btbnep); + expert_register_field_array(expert_btbnep, ei, array_length(ei)); module = prefs_register_protocol(proto_btbnep, NULL); prefs_register_static_text_preference(module, "bnep.version", diff --git a/epan/dissectors/packet-bthcrp.c b/epan/dissectors/packet-bthcrp.c index d4865e0973..1a901dbe81 100644 --- a/epan/dissectors/packet-bthcrp.c +++ b/epan/dissectors/packet-bthcrp.c @@ -62,6 +62,9 @@ static int hf_bthcrp_data = -1; static gint ett_bthcrp = -1; +static expert_field ei_bthcrp_control_parameter_length = EI_INIT; +static expert_field ei_bthcrp_unexpected_data = EI_INIT; + static dissector_handle_t data_handle; static gboolean is_client = TRUE; @@ -144,15 +147,15 @@ dissect_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset += 2; if (!is_client_message && parameter_length < 2) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, pitem, &ei_bthcrp_control_parameter_length, "Parameter length is shorter than 2 in response"); } if (parameter_length < tvb_length_remaining(tvb, offset)) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, pitem, &ei_bthcrp_control_parameter_length, "Parameter length is shorter than payload length"); } else if (parameter_length > tvb_length_remaining(tvb, offset)) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, pitem, &ei_bthcrp_control_parameter_length, "Parameter length is larger than payload length"); } @@ -393,8 +396,7 @@ dissect_bthcrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *pitem; pitem = proto_tree_add_item(main_tree, hf_bthcrp_data, tvb, offset, -1, ENC_NA); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Unexpected data"); + expert_add_info(pinfo, pitem, &ei_bthcrp_unexpected_data); } } @@ -403,6 +405,7 @@ void proto_register_bthcrp(void) { module_t *module; + expert_module_t* expert_bthcrp; static hf_register_info hf[] = { { &hf_bthcrp_control_pdu_id, @@ -531,11 +534,18 @@ proto_register_bthcrp(void) &ett_bthcrp }; + static ei_register_info ei[] = { + { &ei_bthcrp_control_parameter_length, { "bthcrp.control_parameter_length.bad", PI_PROTOCOL, PI_WARN, "Length bad", EXPFILL }}, + { &ei_bthcrp_unexpected_data, { "bthcrp.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected data", EXPFILL }}, + }; + proto_bthcrp = proto_register_protocol("Bluetooth HCRP Profile", "BT HCRP", "bthcrp"); register_dissector("bthcrp", dissect_bthcrp, proto_bthcrp); proto_register_field_array(proto_bthcrp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_bthcrp = expert_register_protocol(proto_bthcrp); + expert_register_field_array(expert_bthcrp, ei, array_length(ei)); module = prefs_register_protocol(proto_bthcrp, NULL); prefs_register_static_text_preference(module, "hcrp.version", diff --git a/epan/dissectors/packet-bthid.c b/epan/dissectors/packet-bthid.c index e55ce6fa9a..4c20891b45 100644 --- a/epan/dissectors/packet-bthid.c +++ b/epan/dissectors/packet-bthid.c @@ -86,6 +86,9 @@ static int hf_bthid_data = -1; static gint ett_bthid = -1; +static expert_field ei_bthid_parameter_control_operation_deprecated = EI_INIT; +static expert_field ei_bthid_transaction_type_deprecated = EI_INIT; + static gboolean show_deprecated = FALSE; static const value_string transaction_type_vals[] = { @@ -730,8 +733,7 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U control_operation = tvb_get_guint8(tvb, offset); col_append_fstr(pinfo->cinfo, COL_INFO, " - Control Operation: %s", val_to_str_const(parameter, control_operation_vals, "reserved")); if (control_operation < 3 && show_deprecated) - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "This value of Control Operation is deprecated by HID 1.1"); + expert_add_info(pinfo, pitem, &ei_bthid_parameter_control_operation_deprecated); offset += 1; break; case 0x04: /* GET_REPORT */ @@ -794,8 +796,7 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U case 0x08: /* GET_IDLE */ case 0x09: /* SET_IDLE */ if (show_deprecated) - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "This Transaction Type is deprecated by HID 1.1"); + expert_add_info(pinfo, pitem, &ei_bthid_transaction_type_deprecated); proto_tree_add_item(bthid_tree, hf_bthid_parameter_reserved, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; @@ -808,8 +809,7 @@ dissect_bthid(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U break; case 0x0B: /* DATC */ if (show_deprecated) - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "This Transaction Type is deprecated by HID 1.1"); + expert_add_info(pinfo, pitem, &ei_bthid_transaction_type_deprecated); case 0x0A: /* DATA */ proto_tree_add_item(bthid_tree, hf_bthid_parameter_reserved_32, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_item(bthid_tree, hf_bthid_parameter_report_type, tvb, offset, 1, ENC_BIG_ENDIAN); @@ -829,6 +829,7 @@ void proto_register_bthid(void) { module_t *module; + expert_module_t* expert_bthid; static hf_register_info hf[] = { { &hf_bthid_transaction_type, @@ -1078,11 +1079,18 @@ proto_register_bthid(void) &ett_bthid }; + static ei_register_info ei[] = { + { &ei_bthid_parameter_control_operation_deprecated, { "bthid.control_operation.deprecated", PI_PROTOCOL, PI_WARN, "This value of Control Operation is deprecated by HID 1.1", EXPFILL }}, + { &ei_bthid_transaction_type_deprecated, { "bthid.transaction_type.deprecated", PI_PROTOCOL, PI_WARN, "This Transaction Type is deprecated by HID 1.1", EXPFILL }}, + }; + proto_bthid = proto_register_protocol("Bluetooth HID Profile", "BT HID", "bthid"); new_register_dissector("bthid", dissect_bthid, proto_bthid); proto_register_field_array(proto_bthid, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_bthid = expert_register_protocol(proto_bthid); + expert_register_field_array(expert_bthid, ei, array_length(ei)); module = prefs_register_protocol(proto_bthid, NULL); prefs_register_static_text_preference(module, "hid.version", diff --git a/epan/dissectors/packet-btl2cap.c b/epan/dissectors/packet-btl2cap.c index 0892f0ddc7..c9b55b9168 100644 --- a/epan/dissectors/packet-btl2cap.c +++ b/epan/dissectors/packet-btl2cap.c @@ -134,6 +134,10 @@ static gint ett_btl2cap_extfeatures = -1; static gint ett_btl2cap_fixedchans = -1; static gint ett_btl2cap_control = -1; +static expert_field ei_btl2cap_parameter_mismatch = EI_INIT; +static expert_field ei_btl2cap_sdulength_bad = EI_INIT; +static expert_field ei_btl2cap_length_bad = EI_INIT; + /* Initialize dissector table */ static dissector_table_t l2cap_psm_dissector_table; static dissector_table_t l2cap_cid_dissector_table; @@ -1180,7 +1184,7 @@ dissect_connparamrequest(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr slave_latency = tvb_get_letohs(tvb, offset); if(slave_latency >= 500 || slave_latency > 10.0 * tvb_get_letohs(tvb, offset + 2) / (max_interval *1.25)) - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Parameter mismatch"); + expert_add_info(pinfo, item, &ei_btl2cap_parameter_mismatch); offset += 2; item = proto_tree_add_item(tree, hf_btl2cap_timeout_multiplier, tvb, offset, 2, ENC_LITTLE_ENDIAN); @@ -1403,7 +1407,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree /* Detect malformed data */ if (length <= 6) { - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, pi, &ei_btl2cap_sdulength_bad, "SDU length too short: %u", length); THROW(ReportedBoundsError); } @@ -1412,7 +1416,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree if (sdulen < length) { sdulen = length; - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, pi, &ei_btl2cap_sdulength_bad, "SDU length less than length of first packet (%u < %u)", sdulen, length); } @@ -1436,7 +1440,7 @@ dissect_i_frame(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree } } else { if (length <= 4) { - expert_add_info_format(pinfo, btl2cap_tree, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, btl2cap_tree, &ei_btl2cap_length_bad, "Control / FCS length too short: %u", length); THROW(ReportedBoundsError); } @@ -2319,6 +2323,14 @@ proto_register_btl2cap(void) &ett_btl2cap_control }; + static ei_register_info ei[] = { + { &ei_btl2cap_parameter_mismatch, { "btl2cap.parameter_mismatch", PI_PROTOCOL, PI_WARN, "Unexpected frame", EXPFILL }}, + { &ei_btl2cap_sdulength_bad, { "btl2cap.sdulength.bad", PI_MALFORMED, PI_WARN, "SDU length bad", EXPFILL }}, + { &ei_btl2cap_length_bad, { "btl2cap.length.bad", PI_MALFORMED, PI_WARN, "Length bad", EXPFILL }}, + }; + + expert_module_t* expert_btl2cap; + /* Register the protocol name and description */ proto_btl2cap = proto_register_protocol("Bluetooth L2CAP Protocol", "BT L2CAP", "btl2cap"); @@ -2332,6 +2344,8 @@ proto_register_btl2cap(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_btl2cap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btl2cap = expert_register_protocol(proto_btl2cap); + expert_register_field_array(expert_btl2cap, ei, array_length(ei)); cid_to_psm_table = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); /* scid: psm */ } diff --git a/epan/dissectors/packet-btmcap.c b/epan/dissectors/packet-btmcap.c index 1a8b252d99..0ac41ab95d 100644 --- a/epan/dissectors/packet-btmcap.c +++ b/epan/dissectors/packet-btmcap.c @@ -56,6 +56,10 @@ static int hf_btmcap_data = -1; static gint ett_btmcap = -1; +static expert_field ei_btmcap_mdl_id_ffff = EI_INIT; +static expert_field ei_btmcap_response_parameters_bad = EI_INIT; +static expert_field ei_btmcap_unexpected_data = EI_INIT; + static const value_string op_code_vals[] = { { 0x00, "ERROR_RSP" }, { 0x01, "MD_CREATE_MDL_REQ" }, @@ -164,8 +168,7 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (op_code != 0x07 && mdl_id == 0xFFFF) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - " The value 0xFFFF is not a valid MDL ID for this request and shall not be used."); + expert_add_info(pinfo, pitem, &ei_btmcap_mdl_id_ffff); } if (op_code == 0x01) { @@ -293,12 +296,12 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if ((op_code == 0x03 || op_code == 0x05 || op_code == 0x07) && tvb_length_remaining(tvb, offset)) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, pitem, &ei_btmcap_response_parameters_bad, "The Response Parameters for MD_RECONNECT_MDL_RSP shall have length zero."); } else if (tvb_length_remaining(tvb, offset)) { pitem = proto_tree_add_item(main_tree, hf_btmcap_response_parameters, tvb, offset, -1, ENC_NA); if (response_code != 0x00) { - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, pitem, &ei_btmcap_response_parameters_bad, "When the Response Code is not Success, the Response Parameters shall have length zero."); } offset += tvb_length_remaining(tvb, offset); @@ -308,8 +311,7 @@ dissect_btmcap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (tvb_length_remaining(tvb, offset)) { pitem = proto_tree_add_item(main_tree, hf_btmcap_data, tvb, offset, -1, ENC_NA); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, - "Unexpected data"); + expert_add_info(pinfo, pitem, &ei_btmcap_unexpected_data); } } @@ -318,6 +320,7 @@ void proto_register_btmcap(void) { module_t *module; + expert_module_t* expert_btmcap; static hf_register_info hf[] = { { &hf_btmcap_op_code, @@ -408,11 +411,19 @@ proto_register_btmcap(void) &ett_btmcap }; + static ei_register_info ei[] = { + { &ei_btmcap_mdl_id_ffff, { "btmcap.mdl_id.ffff", PI_PROTOCOL, PI_WARN, "The value 0xFFFF is not a valid MDL ID for this request and shall not be used.", EXPFILL }}, + { &ei_btmcap_response_parameters_bad, { "btmcap.response_parameters.bad", PI_PROTOCOL, PI_WARN, "Response parameters bad", EXPFILL }}, + { &ei_btmcap_unexpected_data, { "btmcap.unexpected_data", PI_PROTOCOL, PI_WARN, "Unexpected data", EXPFILL }}, + }; + proto_btmcap = proto_register_protocol("Bluetooth MCAP Protocol", "BT MCAP", "btmcap"); register_dissector("btmcap", dissect_btmcap, proto_btmcap); proto_register_field_array(proto_btmcap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btmcap = expert_register_protocol(proto_btmcap); + expert_register_field_array(expert_btmcap, ei, array_length(ei)); module = prefs_register_protocol(proto_btmcap, NULL); prefs_register_static_text_preference(module, "mcap.version", diff --git a/epan/dissectors/packet-btobex.c b/epan/dissectors/packet-btobex.c index 3304ff540d..e64f79f7ac 100644 --- a/epan/dissectors/packet-btobex.c +++ b/epan/dissectors/packet-btobex.c @@ -188,6 +188,8 @@ static int hf_btobex_reassembled_length = -1; static gint ett_btobex_fragment = -1; static gint ett_btobex_fragments = -1; +static expert_field ei_application_parameter_length_bad = EI_INIT; + static reassembly_table btobex_reassembly_table; static const fragment_items btobex_frag_items = { @@ -676,12 +678,12 @@ dissect_bpp_application_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(parameter_tree, hf_bpp_application_parameter_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); + item = proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (parameter_length != 4) { - item = proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, + proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); + expert_add_info_format_text(pinfo, item, &ei_application_parameter_length_bad, "According to the specification this parameter length should be 4, but there is %i", parameter_length); } else switch (parameter_id) { case 0x01: @@ -730,13 +732,13 @@ dissect_bip_application_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(parameter_tree, hf_bip_application_parameter_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); + item = proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (parameter_id < (sizeof(required_length_map)/sizeof(gint)) && required_length_map[parameter_id] != parameter_length) { - item = proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, + proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); + expert_add_info_format_text(pinfo, item, &ei_application_parameter_length_bad, "According to the specification this parameter length should be %i, but there is %i", required_length_map[parameter_id], parameter_length); } else switch (parameter_id) { @@ -804,14 +806,14 @@ dissect_pbap_application_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(parameter_tree, hf_pbap_application_parameter_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); + item = proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (parameter_id < (sizeof(required_length_map)/sizeof(gint)) && required_length_map[parameter_id] != -1 && required_length_map[parameter_id] != parameter_length) { - item = proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, + proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); + expert_add_info_format_text(pinfo, item, &ei_application_parameter_length_bad, "According to the specification this parameter length should be %i, but there is %i", required_length_map[parameter_id], parameter_length); } else switch (parameter_id) { @@ -909,14 +911,14 @@ dissect_map_application_parameters(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_item(parameter_tree, hf_map_application_parameter_id, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; - proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); + item = proto_tree_add_item(parameter_tree, hf_application_parameter_length, tvb, offset, 1, ENC_BIG_ENDIAN); offset += 1; if (parameter_id < (sizeof(required_length_map)/sizeof(gint)) && required_length_map[parameter_id] != -1 && required_length_map[parameter_id] != parameter_length) { - item = proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, + proto_tree_add_item(parameter_tree, hf_application_parameter_data, tvb, offset, parameter_length, ENC_NA); + expert_add_info_format_text(pinfo, item, &ei_application_parameter_length_bad, "According to the specification this parameter length should be %i, but there is %i", required_length_map[parameter_id], parameter_length); } else switch (parameter_id) { @@ -2286,6 +2288,12 @@ proto_register_btobex(void) &ett_btobex_application_parameters }; + static ei_register_info ei[] = { + { &ei_application_parameter_length_bad, { "btobex.parameter.length.bad", PI_PROTOCOL, PI_WARN, "Parameter length bad", EXPFILL }}, + }; + + expert_module_t* expert_btobex; + obex_profile = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); obex_last_opcode = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); obex_over_l2cap = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); @@ -2297,6 +2305,8 @@ proto_register_btobex(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_btobex, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btobex = expert_register_protocol(proto_btobex); + expert_register_field_array(expert_btobex, ei, array_length(ei)); register_init_routine(&defragment_init); } diff --git a/epan/dissectors/packet-btrfcomm.c b/epan/dissectors/packet-btrfcomm.c index fe9c2ef851..fe0ce75be7 100644 --- a/epan/dissectors/packet-btrfcomm.c +++ b/epan/dissectors/packet-btrfcomm.c @@ -108,6 +108,8 @@ static gint ett_btdun = -1; static gint ett_btspp = -1; static gint ett_btgnss = -1; +static expert_field ei_btrfcomm_mcc_length_bad = EI_INIT; + static wmem_tree_t *sdp_service_infos = NULL; static dissector_table_t rfcomm_service_dissector_table; @@ -679,7 +681,7 @@ dissect_btrfcomm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset = get_le_multi_byte_value(tvb, offset, ctrl_tree, &length, hf_mcc_len); if (length > (guint32) tvb_length_remaining(tvb, offset)) { - expert_add_info_format(pinfo, ctrl_tree, PI_MALFORMED, PI_ERROR, "Huge MCC length: %u", length); + expert_add_info_format_text(pinfo, ctrl_tree, &ei_btrfcomm_mcc_length_bad, "Huge MCC length: %u", length); return; } @@ -766,6 +768,7 @@ void proto_register_btrfcomm(void) { module_t *module; + expert_module_t* expert_btrfcomm; static hf_register_info hf[] = { { &hf_dlci, @@ -955,6 +958,10 @@ proto_register_btrfcomm(void) &ett_mcc_dlci }; + static ei_register_info ei[] = { + { &ei_btrfcomm_mcc_length_bad, { "btrfcomm.mcc_length_bad", PI_MALFORMED, PI_ERROR, "Huge MCC length", EXPFILL }}, + }; + /* Register the protocol name and description */ proto_btrfcomm = proto_register_protocol("Bluetooth RFCOMM Protocol", "BT RFCOMM", "btrfcomm"); register_dissector("btrfcomm", dissect_btrfcomm, proto_btrfcomm); @@ -962,6 +969,8 @@ proto_register_btrfcomm(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_btrfcomm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btrfcomm = expert_register_protocol(proto_btrfcomm); + expert_register_field_array(expert_btrfcomm, ei, array_length(ei)); rfcomm_service_dissector_table = register_dissector_table("btrfcomm.service", "RFCOMM SERVICE", FT_UINT16, BASE_HEX); rfcomm_channel_dissector_table = register_dissector_table("btrfcomm.channel", "RFCOMM Channel", FT_UINT16, BASE_DEC); diff --git a/epan/dissectors/packet-btsap.c b/epan/dissectors/packet-btsap.c index db3f7efbe8..d6bc537cf9 100644 --- a/epan/dissectors/packet-btsap.c +++ b/epan/dissectors/packet-btsap.c @@ -80,6 +80,8 @@ static int hf_btsap_data = -1; static gint ett_btsap = -1; static gint ett_btsap_parameter = -1; +static expert_field ei_btsap_parameter_error = EI_INIT; + static gint top_dissect = TOP_DISSECT_INTERNAL; static dissector_handle_t gsm_sim_cmd_handle; @@ -362,7 +364,7 @@ dissect_parameter(tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, if (length != parameter_length || padding_length != parameter_padding_length) { /* Malformed frame */ - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, + expert_add_info_format_text(pinfo, pitem, &ei_btsap_parameter_error, "Parameter Length does not meet content length"); } @@ -391,7 +393,6 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) guint required_parameters = 0; guint i_parameter; guint i_next_parameter; - proto_item *pitem; col_set_str(pinfo->cinfo, COL_PROTOCOL, "SAP"); @@ -561,27 +562,19 @@ dissect_btsap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) break; } - if (parameters_check < required_parameters) { - static const gchar error_message[] = "There are no required parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); - PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); + if (parameters_check < required_parameters) { + proto_tree_add_expert_format(tree, pinfo, &ei_btsap_parameter_error, + tvb, offset, 0, "There are no required parameters"); } else if (parameters_check > required_parameters) { - static const gchar error_message[] = "Invalid parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); - PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); + proto_tree_add_expert_format(tree, pinfo, &ei_btsap_parameter_error, + tvb, offset, 0, "Invalid parameters"); } if (number_of_parameters < required_parameters) { - static const gchar error_message[] = "Too few parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); - PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); + proto_tree_add_expert_format(tree, pinfo, &ei_btsap_parameter_error, + tvb, offset, 0, "Too few parameters"); } else if (number_of_parameters > required_parameters) { - static const gchar error_message[] = "Too many parameters"; - pitem = proto_tree_add_text(tree, tvb, offset, 0, error_message); - PROTO_ITEM_SET_GENERATED(pitem); - expert_add_info_format(pinfo, pitem, PI_PROTOCOL, PI_WARN, error_message); + proto_tree_add_expert_format(tree, pinfo, &ei_btsap_parameter_error, + tvb, offset, 0, "Too many parameters"); } if (tvb_length(tvb) > offset) { @@ -594,6 +587,7 @@ void proto_register_btsap(void) { module_t *module; + expert_module_t* expert_btsap; static hf_register_info hf[] = { { &hf_btsap_header_msg_id, @@ -705,11 +699,17 @@ proto_register_btsap(void) &ett_btsap_parameter }; + static ei_register_info ei[] = { + { &ei_btsap_parameter_error, { "btsap.parameter_error", PI_PROTOCOL, PI_WARN, "Parameter error", EXPFILL }}, + }; + proto_btsap = proto_register_protocol("Bluetooth SAP Profile", "BT SAP", "btsap"); register_dissector("btsap", dissect_btsap, proto_btsap); proto_register_field_array(proto_btsap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btsap = expert_register_protocol(proto_btsap); + expert_register_field_array(expert_btsap, ei, array_length(ei)); module = prefs_register_protocol(proto_btsap, NULL); prefs_register_static_text_preference(module, "sap.version", diff --git a/epan/dissectors/packet-btsdp.c b/epan/dissectors/packet-btsdp.c index fd34653281..42cee241f7 100644 --- a/epan/dissectors/packet-btsdp.c +++ b/epan/dissectors/packet-btsdp.c @@ -304,6 +304,10 @@ static gint ett_btsdp_supported_features_mdep_role = -1; static gint ett_btsdp_supported_features_mdep_description = -1; static gint ett_btsdp_protocol = -1; +static expert_field ei_btsdp_continuation_state_none = EI_INIT; +static expert_field ei_btsdp_continuation_state_large = EI_INIT; +static expert_field ei_data_element_value_large = EI_INIT; + static gint btsdp_tap = -1; static wmem_tree_t *tid_requests = NULL; @@ -1056,11 +1060,9 @@ dissect_continuation_state(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, length = tvb_length_remaining(tvb, offset); if (length == 0) { - cont_item = proto_tree_add_text(tree, tvb, offset, -1, "[Malformed packet] - no Continuation State"); - expert_add_info_format(pinfo, cont_item, PI_MALFORMED, PI_WARN, "There is no Continuation State"); + proto_tree_add_expert(tree, pinfo, &ei_btsdp_continuation_state_none, tvb, offset, -1); } else if (length > 17) { - cont_item = proto_tree_add_text(tree, tvb, offset, -1, "[Malformed packet] - Continuation State data is longer then 16"); - expert_add_info_format(pinfo, cont_item, PI_MALFORMED, PI_WARN, "Continuation State data is longer then 16"); + proto_tree_add_expert(tree, pinfo, &ei_btsdp_continuation_state_large, tvb, offset, -1); } else if (length == 1 && tvb_get_guint8(tvb, offset) == 0x00) { proto_tree_add_text(tree, tvb, offset, -1, "Continuation State: no (0x00)"); } else { @@ -1552,7 +1554,7 @@ dissect_data_element(proto_tree *tree, proto_tree **next_tree, pitem = proto_tree_add_item(ptree, hf_data_element_value, tvb, offset, 0, ENC_NA); if (length > tvb_length_remaining(tvb, offset)) { - expert_add_info_format(pinfo, pitem, PI_MALFORMED, PI_WARN, "Data size exceeds the length of payload"); + expert_add_info(pinfo, pitem, &ei_data_element_value_large); length = 0; } proto_item_set_len(pitem, length); @@ -3946,6 +3948,7 @@ void proto_register_btsdp(void) { module_t *module; + expert_module_t* expert_btsdp; static hf_register_info hf[] = { { &hf_pdu_id, @@ -5162,11 +5165,19 @@ proto_register_btsdp(void) &ett_btsdp_protocol }; + static ei_register_info ei[] = { + { &ei_btsdp_continuation_state_none, { "btsdp.continuation_state_none", PI_MALFORMED, PI_WARN, "There is no Continuation State", EXPFILL }}, + { &ei_btsdp_continuation_state_large, { "btsdp.continuation_state_large", PI_MALFORMED, PI_WARN, "Continuation State data is longer then 16", EXPFILL }}, + { &ei_data_element_value_large, { "btavctp.data_element.value.large", PI_MALFORMED, PI_WARN, "Data size exceeds the length of payload", EXPFILL }}, + }; + proto_btsdp = proto_register_protocol("Bluetooth SDP Protocol", "BT SDP", "btsdp"); new_register_dissector("btsdp", dissect_btsdp, proto_btsdp); proto_register_field_array(proto_btsdp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_btsdp = expert_register_protocol(proto_btsdp); + expert_register_field_array(expert_btsdp, ei, array_length(ei)); tid_requests = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); continuation_states = wmem_tree_new_autoreset(wmem_epan_scope(), wmem_file_scope()); diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c index 5dee147ad3..ea60217f11 100644 --- a/epan/dissectors/packet-lmp.c +++ b/epan/dissectors/packet-lmp.c @@ -503,7 +503,8 @@ enum hf_lmp_filter_keys { static int hf_lmp_filter[LMPF_MAX]; static expert_field ei_lmp_checksum_incorrect = EI_INIT; - +static expert_field ei_lmp_invalid_msg_type = EI_INIT; +static expert_field ei_lmp_invalid_class = EI_INIT; static int lmp_valid_class(int lmp_class) @@ -734,7 +735,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) tvb, offset+3, 1, 1); PROTO_ITEM_SET_HIDDEN(hidden_item); } else { - expert_add_info_format(pinfo, msg_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, msg_item, &ei_lmp_invalid_msg_type, "Invalid message type: %u", message_type); return tvb_length(tvb); } @@ -783,7 +784,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) hf_lmp_filter[lmp_class_to_filter_num(lmp_class)], tvb, offset, obj_length, ENC_NA); /* all possibilities are FT_NONE */ } else { - expert_add_info_format(pinfo, hidden_item, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, hidden_item, &ei_lmp_invalid_class, "Invalid class: %u", lmp_class); return tvb_length(tvb); } @@ -2709,6 +2710,8 @@ proto_register_lmp(void) static ei_register_info ei[] = { { &ei_lmp_checksum_incorrect, { "lmp.checksum.incorrect", PI_PROTOCOL, PI_WARN, "Incorrect checksum", EXPFILL }}, + { &ei_lmp_invalid_msg_type, { "lmp.invalid_msg_type", PI_PROTOCOL, PI_WARN, "Invalid message type", EXPFILL }}, + { &ei_lmp_invalid_class, { "lmp.invalid_class", PI_PROTOCOL, PI_WARN, "Invalid class", EXPFILL }}, }; expert_module_t* expert_lmp;