diff options
26 files changed, 385 insertions, 109 deletions
diff --git a/epan/dissectors/packet-l2tp.c b/epan/dissectors/packet-l2tp.c index efea07b255..3459f8227e 100644 --- a/epan/dissectors/packet-l2tp.c +++ b/epan/dissectors/packet-l2tp.c @@ -142,6 +142,8 @@ static gint ett_l2tp_avp_sub = -1; static gint ett_l2tp_lcp = -1; static gint ett_l2tp_l2_spec = -1; +static expert_field ei_l2tp_incorrect_digest = EI_INIT; + static const enum_val_t l2tpv3_cookies[] = { {"detect", "Detect", -1}, {"cookie0", "None", 0}, @@ -1968,7 +1970,7 @@ static void process_control_avps(tvbuff_t *tvb, /* SCCRQ digest can only be calculated once we know whether nonces are being used */ if (digest_avp_len) { if (check_control_digest(tunnel, tvb, length, digest_idx, digest_avp_len, msg_type, pinfo) < 0) - expert_add_info_format(pinfo, digest_item, PI_CHECKSUM, PI_WARN, "Incorrect Digest"); + expert_add_info(pinfo, digest_item, &ei_l2tp_incorrect_digest); } update_session(tunnel, session); @@ -2873,12 +2875,19 @@ proto_register_l2tp(void) &ett_l2tp_lcp, }; + static ei_register_info ei[] = { + { &ei_l2tp_incorrect_digest, { "l2tp.incorrect_digest", PI_CHECKSUM, PI_WARN, "Incorrect Digest", EXPFILL }}, + }; + module_t *l2tp_module; + expert_module_t* expert_l2tp; proto_l2tp = proto_register_protocol( "Layer 2 Tunneling Protocol", "L2TP", "l2tp"); proto_register_field_array(proto_l2tp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_l2tp = expert_register_protocol(proto_l2tp); + expert_register_field_array(expert_l2tp, ei, array_length(ei)); l2tp_module = prefs_register_protocol(proto_l2tp, NULL); diff --git a/epan/dissectors/packet-lapd.c b/epan/dissectors/packet-lapd.c index 471c93c69c..a5b730308b 100644 --- a/epan/dissectors/packet-lapd.c +++ b/epan/dissectors/packet-lapd.c @@ -82,6 +82,9 @@ static gint ett_lapd_control = -1; static gint ett_lapd_checksum = -1; static gint pref_lapd_rtp_payload_type = 0; +static expert_field ei_lapd_abort = EI_INIT; +static expert_field ei_lapd_checksum_bad = EI_INIT; + static dissector_table_t lapd_sapi_dissector_table; static dissector_table_t lapd_gsm_sapi_dissector_table; @@ -212,11 +215,10 @@ lapd_log_abort(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset { proto_tree *lapd_tree; proto_item *lapd_ti, *pi; - lapd_ti = proto_tree_add_item(tree, proto_lapd, tvb, offset, 1, - ENC_NA); + lapd_ti = proto_tree_add_item(tree, proto_lapd, tvb, offset, 1, ENC_NA); lapd_tree = proto_item_add_subtree(lapd_ti, ett_lapd); pi = proto_tree_add_boolean(lapd_tree, hf_lapd_abort, tvb, offset, 1, TRUE); - expert_add_info_format(pinfo, pi, PI_PROTOCOL, PI_ERROR, "%s", msg); + expert_add_info_format_text(pinfo, pi, &ei_lapd_abort, "%s", msg); } static void @@ -557,7 +559,7 @@ dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean checksum_tree = proto_item_add_subtree(checksum_ti, ett_lapd_checksum); proto_tree_add_boolean(checksum_tree, hf_lapd_checksum_good, tvb, checksum_offset, 2, FALSE); pi = proto_tree_add_boolean(checksum_tree, hf_lapd_checksum_bad, tvb, checksum_offset, 2, TRUE); - expert_add_info_format(pinfo, pi, PI_CHECKSUM, PI_WARN, "Bad FCS"); + expert_add_info(pinfo, pi, &ei_lapd_checksum_bad); } next_tvb = tvb_new_subset(tvb, lapd_header_len, tvb_length_remaining(tvb,lapd_header_len) - 2, tvb_length_remaining(tvb,lapd_header_len) - 2); @@ -565,7 +567,7 @@ dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean } else next_tvb = tvb_new_subset_remaining(tvb, lapd_header_len); - /* Dissection done, append " | " to COL_INFO */ + /* Dissection done, append " | " to COL_INFO */ col_append_fstr(pinfo->cinfo, COL_INFO, " | "); col_set_fence(pinfo->cinfo, COL_INFO); @@ -701,12 +703,20 @@ proto_register_lapd(void) &ett_lapd_checksum }; + static ei_register_info ei[] = { + { &ei_lapd_abort, { "lapd.abort.expert", PI_PROTOCOL, PI_ERROR, "Formatted message", EXPFILL }}, + { &ei_lapd_checksum_bad, { "lapd.checksum_bad.expert", PI_CHECKSUM, PI_WARN, "Bad FCS", EXPFILL }}, + }; + module_t *lapd_module; + expert_module_t* expert_lapd; proto_lapd = proto_register_protocol("Link Access Procedure, Channel D (LAPD)", "LAPD", "lapd"); proto_register_field_array (proto_lapd, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_lapd = expert_register_protocol(proto_lapd); + expert_register_field_array(expert_lapd, ei, array_length(ei)); register_dissector("lapd", dissect_lapd, proto_lapd); diff --git a/epan/dissectors/packet-ldp.c b/epan/dissectors/packet-ldp.c index 107e6e43dc..8dcdf464a9 100644 --- a/epan/dissectors/packet-ldp.c +++ b/epan/dissectors/packet-ldp.c @@ -301,6 +301,11 @@ static int ett_ldp_gen_saii = -1; static int ett_ldp_gen_taii = -1; static int ett_ldp_gen_aai_type2 = -1; +static expert_field ei_ldp_dtsm_and_target = EI_INIT; +static expert_field ei_ldp_gtsm_supported = EI_INIT; +static expert_field ei_ldp_gtsm_not_supported_basic_discovery = EI_INIT; +static expert_field ei_ldp_gtsm_not_supported = EI_INIT; + /* desegmentation of LDP over TCP */ static gboolean ldp_desegment = TRUE; @@ -1547,15 +1552,15 @@ dissect_tlv_common_hello_parms(tvbuff_t *tvb, packet_info *pinfo, guint offset, if ( gtsm_flag_buffer & 0x2000 ) { if ( gtsm_flag_buffer & 0x8000 ) { - expert_add_info_format(pinfo, gtsm_flag_item, PI_PROTOCOL, PI_WARN,"ERROR - Both GTSM and Target Flag are enabled."); + expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_dtsm_and_target); } else { - expert_add_info_format(pinfo, gtsm_flag_item, PI_PROTOCOL, PI_CHAT,"GTSM is supported by the source"); + expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_supported); } } else { if ( gtsm_flag_buffer & 0x8000 ) { - expert_add_info_format(pinfo, gtsm_flag_item, PI_PROTOCOL, PI_WARN,"GTSM is not supported by the source, since basic discovery is not enabled"); + expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_not_supported_basic_discovery); } else { - expert_add_info_format(pinfo, gtsm_flag_item, PI_PROTOCOL, PI_CHAT,"GTSM is not supported by the source"); + expert_add_info(pinfo, gtsm_flag_item, &ei_ldp_gtsm_not_supported); } } @@ -3995,13 +4000,23 @@ proto_register_ldp(void) &ett_ldp_gen_aai_type2 }; + static ei_register_info ei[] = { + { &ei_ldp_dtsm_and_target, { "ldp.dtsm_and_target", PI_PROTOCOL, PI_WARN,"ERROR - Both GTSM and Target Flag are enabled.", EXPFILL }}, + { &ei_ldp_gtsm_supported, { "ldp.gtsm_supported", PI_PROTOCOL, PI_CHAT,"GTSM is supported by the source", EXPFILL }}, + { &ei_ldp_gtsm_not_supported_basic_discovery, { "ldp.gtsm_not_supported_basic_discovery", PI_PROTOCOL, PI_WARN,"GTSM is not supported by the source, since basic discovery is not enabled", EXPFILL }}, + { &ei_ldp_gtsm_not_supported, { "ldp.gtsm_not_supported", PI_PROTOCOL, PI_CHAT,"GTSM is not supported by the source", EXPFILL }}, + }; + module_t *ldp_module; + expert_module_t* expert_ldp; proto_ldp = proto_register_protocol("Label Distribution Protocol", "LDP", "ldp"); proto_register_field_array(proto_ldp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ldp = expert_register_protocol(proto_ldp); + expert_register_field_array(expert_ldp, ei, array_length(ei)); /* Register our configuration options for , particularly our port */ diff --git a/epan/dissectors/packet-lisp-data.c b/epan/dissectors/packet-lisp-data.c index 3c8ffa3862..23335a7c07 100644 --- a/epan/dissectors/packet-lisp-data.c +++ b/epan/dissectors/packet-lisp-data.c @@ -74,6 +74,9 @@ static gint ett_lisp_data = -1; static gint ett_lisp_data_flags = -1; static gint ett_lisp_data_mapver = -1; +static expert_field ei_lisp_data_flags_en_invalid = EI_INIT; +static expert_field ei_lisp_data_flags_nv_invalid = EI_INIT; + static dissector_handle_t ipv4_handle; static dissector_handle_t ipv6_handle; static dissector_handle_t lisp_handle; @@ -132,14 +135,12 @@ dissect_lisp_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat offset += 1; if (flags&LISP_DATA_FLAG_E && !(flags&LISP_DATA_FLAG_N)) { - expert_add_info_format(pinfo, tif, PI_PROTOCOL, PI_WARN, - "Invalid flag combination: if E is set, N MUST be set"); + expert_add_info(pinfo, tif, &ei_lisp_data_flags_en_invalid); } if (flags&LISP_DATA_FLAG_N) { if (flags&LISP_DATA_FLAG_V) { - expert_add_info_format(pinfo, tif, PI_PROTOCOL, PI_WARN, - "Invalid flag combination: N and V can't be set both"); + expert_add_info(pinfo, tif, &ei_lisp_data_flags_nv_invalid); } proto_tree_add_item(lisp_data_tree, hf_lisp_data_nonce, tvb, offset, 3, ENC_BIG_ENDIAN); @@ -260,6 +261,13 @@ proto_register_lisp_data(void) &ett_lisp_data_mapver }; + static ei_register_info ei[] = { + { &ei_lisp_data_flags_en_invalid, { "lisp-data.flags.en_invalid", PI_PROTOCOL, PI_WARN, "Invalid flag combination: if E is set, N MUST be set", EXPFILL }}, + { &ei_lisp_data_flags_nv_invalid, { "lisp-data.flags.nv_invalid", PI_PROTOCOL, PI_WARN, "Invalid flag combination: N and V can't be set both", EXPFILL }}, + }; + + expert_module_t* expert_lisp_data; + /* Register the protocol name and description */ proto_lisp_data = proto_register_protocol("Locator/ID Separation Protocol (Data)", "LISP Data", "lisp-data"); @@ -267,6 +275,8 @@ proto_register_lisp_data(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_lisp_data, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_lisp_data = expert_register_protocol(proto_lisp_data); + expert_register_field_array(expert_lisp_data, ei, array_length(ei)); } /* Simple form of proto_reg_handoff_lisp_data which can be used if there are diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c index ada6877991..2ce07bc32a 100644 --- a/epan/dissectors/packet-lmp.c +++ b/epan/dissectors/packet-lmp.c @@ -503,6 +503,9 @@ enum hf_lmp_filter_keys { static int hf_lmp_filter[LMPF_MAX]; +static expert_field ei_lmp_checksum_incorrect = EI_INIT; + + static int lmp_valid_class(int lmp_class) { @@ -751,7 +754,7 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_item_append_text( ti, " [correct]"); } else { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_WARN, "[incorrect, should be 0x%04x]", + expert_add_info_format_text(pinfo, ti, &ei_lmp_checksum_incorrect, "[incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum)); } } @@ -2706,11 +2709,20 @@ proto_register_lmp(void) NULL, HFILL }}, }; + static ei_register_info ei[] = { + { &ei_lmp_checksum_incorrect, { "lmp.checksum.incorrect", PI_PROTOCOL, PI_WARN, "Incorrect checksum", EXPFILL }}, + }; + + expert_module_t* expert_lmp; + for (i=0; i<NUM_LMP_SUBTREES; i++) { lmp_subtree[i] = -1; ett[i] = &lmp_subtree[i]; } + expert_lmp = expert_register_protocol(proto_lmp); + expert_register_field_array(expert_lmp, ei, array_length(ei)); + proto_lmp = proto_register_protocol("Link Management Protocol (LMP)", "LMP", "lmp"); proto_register_field_array(proto_lmp, lmpf_info, array_length(lmpf_info)); diff --git a/epan/dissectors/packet-ltp.c b/epan/dissectors/packet-ltp.c index 2eea5eda69..5bdbb97f56 100644 --- a/epan/dissectors/packet-ltp.c +++ b/epan/dissectors/packet-ltp.c @@ -103,6 +103,9 @@ static int hf_ltp_fragment_count = -1; static int hf_ltp_reassembled_in = -1; static int hf_ltp_reassembled_length = -1; +static expert_field ei_ltp_neg_reception_claim_count = EI_INIT; +static expert_field ei_ltp_mal_reception_claim = EI_INIT; + static const value_string ltp_type_codes[] = { {0x0, "Red data, NOT {Checkpoint, EORP or EOB}"}, {0x1, "Red data, Checkpoint, NOT {EORP or EOB}"}, @@ -435,7 +438,8 @@ dissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree, rcpt_clm_cnt = evaluate_sdnv(tvb, frame_offset + segment_offset, &rcpt_clm_cnt_size); if (rcpt_clm_cnt < 0){ proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset); - expert_add_info_format(pinfo, ltp_tree, PI_UNDECODED, PI_ERROR, "Negative reception claim count: %d", rcpt_clm_cnt); + expert_add_info_format_text(pinfo, ltp_tree, &ei_ltp_neg_reception_claim_count, + "Negative reception claim count: %d", rcpt_clm_cnt); return 0; } /* Each reception claim is at least 2 bytes, so if the count is larger than the @@ -444,7 +448,7 @@ dissect_report_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ltp_tree, */ if (rcpt_clm_cnt > tvb_length_remaining(tvb, frame_offset + segment_offset) / 2) { proto_item_set_end(ltp_rpt_item, tvb, frame_offset + segment_offset); - expert_add_info_format(pinfo, ltp_tree, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ltp_tree, &ei_ltp_mal_reception_claim, "Reception claim count impossibly large: %d > %d", rcpt_clm_cnt, tvb_length_remaining(tvb, frame_offset + segment_offset) / 2); return 0; @@ -963,12 +967,22 @@ proto_register_ltp(void) &ett_ltp_fragments }; -/* Register the protocol name and description */ + static ei_register_info ei[] = { + { &ei_ltp_neg_reception_claim_count, { "ltp.neg_reception_claim_count", PI_UNDECODED, PI_ERROR, "Negative reception claim count", EXPFILL }}, + { &ei_ltp_mal_reception_claim, { "ltp.mal_reception_claim", PI_MALFORMED, PI_ERROR, "Reception claim count impossibly large", EXPFILL }}, + }; + + expert_module_t* expert_ltp; + + /* Register the protocol name and description */ proto_ltp = proto_register_protocol("Licklider Transmission Protocol", "LTP", "ltp"); proto_register_field_array(proto_ltp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ltp = expert_register_protocol(proto_ltp); + expert_register_field_array(expert_ltp, ei, array_length(ei)); + ltp_module = prefs_register_protocol(proto_ltp, proto_reg_handoff_ltp); prefs_register_obsolete_preference(ltp_module, "udp.port"); diff --git a/epan/dissectors/packet-m2pa.c b/epan/dissectors/packet-m2pa.c index b26b684866..06bf68523c 100644 --- a/epan/dissectors/packet-m2pa.c +++ b/epan/dissectors/packet-m2pa.c @@ -74,6 +74,8 @@ static int hf_undecode_data = -1; static gint ett_m2pa = -1; static gint ett_m2pa_li = -1; +static expert_field ei_undecode_data = EI_INIT; + static dissector_handle_t mtp3_handle; typedef enum { @@ -483,7 +485,7 @@ dissect_message_data(tvbuff_t *message_tvb, packet_info *pinfo, proto_item *m2pa proto_item *pi; pi = proto_tree_add_item(m2pa_tree, hf_undecode_data, message_tvb, length, (actual_length - length), ENC_NA); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, pi, &ei_undecode_data, "There are %d bytes of data which is greater than M2PA's length parameter (%d)", actual_length, length); } @@ -590,10 +592,18 @@ proto_register_m2pa(void) { NULL, NULL, 0 } }; + static ei_register_info ei[] = { + { &ei_undecode_data, { "m2pa.undecoded_data.expert", PI_MALFORMED, PI_WARN, "There are bytes of data which is greater than M2PA's length parameter", EXPFILL }}, + }; + + expert_module_t* expert_m2pa; + proto_m2pa = proto_register_protocol("MTP2 Peer Adaptation Layer", "M2PA", "m2pa"); proto_register_field_array(proto_m2pa, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_m2pa = expert_register_protocol(proto_m2pa); + expert_register_field_array(expert_m2pa, ei, array_length(ei)); /* Allow other dissectors to find this one by name. */ register_dissector("m2pa", dissect_m2pa, proto_m2pa); diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c index aa58638484..d5b04cacd5 100644 --- a/epan/dissectors/packet-mbtcp.c +++ b/epan/dissectors/packet-mbtcp.c @@ -157,6 +157,9 @@ static gint ett_events_send = -1; static gint ett_device_id_objects = -1; static gint ett_device_id_object_items = -1; +static expert_field ei_mbrtu_crc16_incorrect = EI_INIT; +static expert_field ei_modbus_data_decode = EI_INIT; + static dissector_table_t modbus_data_dissector_table; static dissector_table_t modbus_dissector_table; static dissector_handle_t modbus_handle; @@ -587,7 +590,7 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) { calc_crc16 = crc16_plain_tvb_offset_seed(tvb, offset, len-2, 0xFFFF); if (g_htons(calc_crc16) != crc16) - expert_add_info_format(pinfo, crc_item, PI_PROTOCOL, PI_WARN, "Incorrect CRC - should be 0x%04x", g_htons(calc_crc16)); + expert_add_info_format_text(pinfo, crc_item, &ei_mbrtu_crc16_incorrect, "Incorrect CRC - should be 0x%04x", g_htons(calc_crc16)); } /* make sure to ignore the CRC-16 footer bytes */ @@ -722,7 +725,7 @@ dissect_modbus_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 (register_format == MBTCP_PREF_REGISTER_FORMAT_IEEE_FLOAT) || (register_format == MBTCP_PREF_REGISTER_FORMAT_MODICON_FLOAT) ) ) { register_item = proto_tree_add_item(tree, hf_modbus_data, tvb, payload_start, payload_len, ENC_NA); - expert_add_info_format(pinfo, register_item, PI_PROTOCOL, PI_WARN, "Invalid decoding options, register data not a multiple of 4!"); + expert_add_info(pinfo, register_item, &ei_modbus_data_decode); return; } @@ -1388,6 +1391,10 @@ proto_register_modbus(void) }, }; + static ei_register_info mbrtu_ei[] = { + { &ei_mbrtu_crc16_incorrect, { "mbrtu.crc16.incorrect", PI_CHECKSUM, PI_WARN, "Incorrect CRC", EXPFILL }}, + }; + static hf_register_info hf[] = { /* Modbus header fields */ { &hf_mbtcp_functioncode, @@ -1684,8 +1691,14 @@ proto_register_modbus(void) &ett_device_id_object_items }; + static ei_register_info ei[] = { + { &ei_modbus_data_decode, { "modbus.data.decode", PI_PROTOCOL, PI_WARN, "Invalid decoding options, register data not a multiple of 4!", EXPFILL }}, + }; + module_t *mbtcp_module; module_t *mbrtu_module; + expert_module_t* expert_mbrtu; + expert_module_t* expert_modbus; /* Register the protocol name and description */ proto_mbtcp = proto_register_protocol("Modbus/TCP", "Modbus/TCP", "mbtcp"); @@ -1706,6 +1719,10 @@ proto_register_modbus(void) proto_register_field_array(proto_mbrtu, mbrtu_hf, array_length(mbrtu_hf)); proto_register_field_array(proto_modbus, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mbrtu = expert_register_protocol(proto_mbrtu); + expert_register_field_array(expert_mbrtu, mbrtu_ei, array_length(mbrtu_ei)); + expert_modbus = expert_register_protocol(proto_modbus); + expert_register_field_array(expert_modbus, ei, array_length(ei)); /* Register required preferences for Modbus Protocol register decoding */ diff --git a/epan/dissectors/packet-meta.c b/epan/dissectors/packet-meta.c index cd7b11d8e8..1f82f1b38a 100644 --- a/epan/dissectors/packet-meta.c +++ b/epan/dissectors/packet-meta.c @@ -89,7 +89,6 @@ enum meta_direction { static int proto_meta = -1; extern int proto_sscop; -extern int proto_malformed; /* fields */ static int hf_meta_schema = -1; @@ -131,6 +130,9 @@ static gint ett_meta_cell = -1; static gint ett_meta_imsi = -1; static gint ett_meta_imei = -1; +static expert_field ei_meta_malformed = EI_INIT; +static expert_field ei_meta_invalid_header = EI_INIT; + /* default handle */ static dissector_handle_t data_handle; static dissector_handle_t atm_untrunc_handle; @@ -496,11 +498,8 @@ static gint32 evaluate_meta_items(guint16 schema, tvbuff_t *tvb, packet_info *pi item_len = skip_item(meta_tree, tvb, pinfo, offs + total_len); } if (item_len < 4) { /* 4 is the minimum length of an item: id + type + length field */ - proto_item *malformed; - malformed = proto_tree_add_protocol_format(meta_tree, - proto_malformed, tvb, offs, -1, "[Malformed Packet: %s]", pinfo->current_proto); - expert_add_info_format(pinfo, malformed, PI_MALFORMED, PI_ERROR, - "Malformed Packet (wrong item encoding)"); + expert_add_info_format_text(pinfo, meta_tree, &ei_meta_malformed, + "Malformed Packet %s (wrong item encoding)", pinfo->current_proto); return -1; } total_len += item_len; @@ -543,8 +542,7 @@ dissect_meta(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } if (hdrlen != item_len) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Invalid Header Length"); - proto_tree_add_text(tree, tvb, hdrlen+4, -1, "[Malformed Packet]"); + expert_add_info(pinfo, ti, &ei_meta_invalid_header); return; } @@ -775,11 +773,20 @@ proto_register_meta(void) &ett_meta_imei }; + static ei_register_info ei[] = { + { &ei_meta_malformed, { "meta.malformed", PI_MALFORMED, PI_ERROR, "Malformed data", EXPFILL }}, + { &ei_meta_invalid_header, { "meta.invalid_header_length", PI_MALFORMED, PI_ERROR, "Invalid Header Length", EXPFILL }}, + }; + + expert_module_t* expert_meta; + proto_meta = proto_register_protocol("Metadata", "META", "meta"); register_dissector("meta", dissect_meta, proto_meta); proto_register_field_array(proto_meta, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_meta = expert_register_protocol(proto_meta); + expert_register_field_array(expert_meta, ei, array_length(ei)); meta_dissector_table = register_dissector_table("meta.proto", "META protocol", FT_UINT16, BASE_DEC); diff --git a/epan/dissectors/packet-miop.c b/epan/dissectors/packet-miop.c index 260290b303..3c5c4dd85a 100644 --- a/epan/dissectors/packet-miop.c +++ b/epan/dissectors/packet-miop.c @@ -79,6 +79,9 @@ static gint hf_miop_unique_id = -1; static gint ett_miop = -1; +static expert_field ei_miop_version_not_supported = EI_INIT; +static expert_field ei_miop_unique_id_len_exceed_max_value = EI_INIT; + #define MIOP_MAGIC "MIOP" static void dissect_miop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree); @@ -157,7 +160,7 @@ static void dissect_miop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree proto_tree_add_text (miop_tree, tvb, 0, -1, "Version %u.%u", version_major, version_minor); - expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_miop_version_not_supported, "MIOP version %u.%u not supported", version_major, version_minor); } @@ -217,7 +220,7 @@ static void dissect_miop (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree ti = proto_tree_add_item(miop_tree, hf_miop_unique_id_len, tvb, offset, 4, byte_order); if (unique_id_len >= MIOP_MAX_UNIQUE_ID_LENGTH) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(pinfo, ti, &ei_miop_unique_id_len_exceed_max_value, "Unique Id length (%u) exceeds max value (%u)", unique_id_len, MIOP_MAX_UNIQUE_ID_LENGTH); return; @@ -285,10 +288,18 @@ void proto_register_miop (void) { &ett_miop }; - proto_miop = proto_register_protocol("Unreliable Multicast Inter-ORB Protocol", "MIOP", - "miop"); + static ei_register_info ei[] = { + { &ei_miop_version_not_supported, { "miop.version.not_supported", PI_UNDECODED, PI_WARN, "MIOP version not supported", EXPFILL }}, + { &ei_miop_unique_id_len_exceed_max_value, { "miop.unique_id_len.exceed_max_value", PI_MALFORMED, PI_WARN, "Unique Id length exceeds max value", EXPFILL }}, + }; + + expert_module_t* expert_miop; + + proto_miop = proto_register_protocol("Unreliable Multicast Inter-ORB Protocol", "MIOP", "miop"); proto_register_field_array (proto_miop, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_miop = expert_register_protocol(proto_miop); + expert_register_field_array(expert_miop, ei, array_length(ei)); register_dissector("miop", dissect_miop, proto_miop); diff --git a/epan/dissectors/packet-mip6.c b/epan/dissectors/packet-mip6.c index f5c6fdde04..11c7c8099e 100644 --- a/epan/dissectors/packet-mip6.c +++ b/epan/dissectors/packet-mip6.c @@ -1154,6 +1154,8 @@ static gint ett_mip6_opt_cr = -1; static gint ett_mip6_opt_lmaa = -1; static gint ett_mip6_opt_mng = -1; +static expert_field ei_mip6_ie_not_dissected = EI_INIT; + typedef struct mip6_opt { int optcode; /**< code for option */ @@ -3402,11 +3404,8 @@ dissect_mipv6_options(tvbuff_t *tvb, int offset, guint length, } proto_tree_add_item(opt_data_tree, hf_mip6_mobility_opt, tvb, offset, 1, ENC_BIG_ENDIAN); if (optp == NULL) { - proto_item *expert_item; proto_item_append_text(ti, "(%u byte%s)",len, plurality(len, "", "s")); - expert_item = proto_tree_add_text(opt_tree, tvb, offset+2, len, "IE data not dissected yet"); - expert_add_info_format(pinfo, expert_item, PI_PROTOCOL, PI_NOTE, "IE data not dissected yet"); - PROTO_ITEM_SET_GENERATED(expert_item); + expert_add_info(pinfo, ti, &ei_mip6_ie_not_dissected); } else { if (dissect != NULL) { /* Option has a dissector. */ @@ -4455,6 +4454,12 @@ proto_register_mip6(void) &ett_mip6_opt_mng, }; + static ei_register_info ei[] = { + { &ei_mip6_ie_not_dissected, { "mip6.ie_not_dissected", PI_UNDECODED, PI_NOTE, "IE data not dissected yet", EXPFILL }}, + }; + + expert_module_t* expert_mip6; + /* Register the protocol name and description */ proto_mip6 = proto_register_protocol("Mobile IPv6 / Network Mobility", "MIPv6", "mipv6"); @@ -4464,6 +4469,8 @@ proto_register_mip6(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_mip6, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mip6 = expert_register_protocol(proto_mip6); + expert_register_field_array(expert_mip6, ei, array_length(ei)); mip6_vsm_dissector_table = register_dissector_table("mip6.vsm", "Mobile IPv6 vendor specific option", FT_UINT32, BASE_DEC); } diff --git a/epan/dissectors/packet-mojito.c b/epan/dissectors/packet-mojito.c index 2412265e33..82b697539a 100644 --- a/epan/dissectors/packet-mojito.c +++ b/epan/dissectors/packet-mojito.c @@ -116,6 +116,9 @@ static gint ett_mojito_dht = -1; static gint ett_mojito_status_code = -1; static gint ett_mojito_kuids = -1; +static expert_field ei_mojito_socketaddress_unknown = EI_INIT; +static expert_field ei_mojito_bigint_unsupported = EI_INIT; + /* Preferences */ static int udp_mojito_port = 0; @@ -214,7 +217,7 @@ dissect_mojito_address(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, break; default: /* ABORT */ - expert_add_info_format(pinfo, socket_item, PI_PROTOCOL, PI_ERROR, "Unsupported Socket Address Type"); + expert_add_info(pinfo, socket_item, &ei_mojito_socketaddress_unknown); return 0; } @@ -391,7 +394,7 @@ dissect_mojito_ping_response(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree proto_tree_add_item(bigint_tree, hf_mojito_bigint_value_four, tvb, offset, bigintlen, ENC_BIG_ENDIAN); break; default: /* ABORT */ - expert_add_info_format(pinfo, bigint_item, PI_PROTOCOL, PI_ERROR, "Unsupported BigInt length"); + expert_add_info(pinfo, bigint_item, &ei_mojito_bigint_unsupported); return; } @@ -725,6 +728,7 @@ void proto_register_mojito(void) { module_t *mojito_module; + expert_module_t* expert_mojito; static hf_register_info hf[] = { { &hf_mojito_dhtvaluecount, @@ -1022,10 +1026,17 @@ proto_register_mojito(void) &ett_mojito_kuids }; + static ei_register_info ei[] = { + { &ei_mojito_socketaddress_unknown, { "mojito.socketaddress.unknown", PI_PROTOCOL, PI_ERROR, "Unsupported Socket Address Type", EXPFILL }}, + { &ei_mojito_bigint_unsupported, { "mojito.bigint.unsupported", PI_PROTOCOL, PI_ERROR, "Unsupported BigInt length", EXPFILL }}, + }; + proto_mojito = proto_register_protocol("Mojito DHT", "Mojito", "mojito"); proto_register_field_array(proto_mojito, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mojito = expert_register_protocol(proto_mojito); + expert_register_field_array(expert_mojito, ei, array_length(ei)); /* Set the Prefs */ mojito_module = prefs_register_protocol(proto_mojito, NULL); diff --git a/epan/dissectors/packet-moldudp.c b/epan/dissectors/packet-moldudp.c index 2c1801bdb6..6a55ca62bf 100644 --- a/epan/dissectors/packet-moldudp.c +++ b/epan/dissectors/packet-moldudp.c @@ -59,6 +59,9 @@ static guint pf_moldudp_port = 0; static gint ett_moldudp = -1; static gint ett_moldudp_msgblk = -1; +static expert_field ei_moldudp_msglen_invalid = EI_INIT; +static expert_field ei_moldudp_count_invalid = EI_INIT; + /* Code to dissect a message block */ guint dissect_moldudp_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, @@ -103,7 +106,7 @@ dissect_moldudp_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvb, offset, MOLDUDP_MSGLEN_LEN, ENC_LITTLE_ENDIAN); if (msglen != real_msglen) - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_moldudp_msglen_invalid, "Invalid Message Length (claimed %u, found %u)", msglen, real_msglen); @@ -173,7 +176,7 @@ dissect_moldudp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data if (real_count != count) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_moldudp_count_invalid, "Invalid Message Count (claimed %u, found %u)", count, real_count); } @@ -227,6 +230,13 @@ proto_register_moldudp(void) &ett_moldudp_msgblk }; + static ei_register_info ei[] = { + { &ei_moldudp_msglen_invalid, { "moldudp.msglen.invalid", PI_MALFORMED, PI_ERROR, "Invalid Message Length", EXPFILL }}, + { &ei_moldudp_count_invalid, { "moldudp.count.invalid", PI_MALFORMED, PI_ERROR, "Invalid Count", EXPFILL }}, + }; + + expert_module_t* expert_moldudp; + /* Register the protocol name and description */ proto_moldudp = proto_register_protocol("MoldUDP", "MoldUDP", "moldudp"); @@ -234,6 +244,8 @@ proto_register_moldudp(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_moldudp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_moldudp = expert_register_protocol(proto_moldudp); + expert_register_field_array(expert_moldudp, ei, array_length(ei)); /* Register preferences module */ moldudp_module = prefs_register_protocol(proto_moldudp, diff --git a/epan/dissectors/packet-moldudp64.c b/epan/dissectors/packet-moldudp64.c index bf294198a8..4c5857bb29 100644 --- a/epan/dissectors/packet-moldudp64.c +++ b/epan/dissectors/packet-moldudp64.c @@ -60,6 +60,10 @@ static guint pf_moldudp64_port = 0; static gint ett_moldudp64 = -1; static gint ett_moldudp64_msgblk = -1; +static expert_field ei_moldudp64_msglen_invalid = EI_INIT; +static expert_field ei_moldudp64_end_of_session_extra = EI_INIT; +static expert_field ei_moldudp64_count_invalid = EI_INIT; + /* Code to dissect a message block */ guint dissect_moldudp64_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, @@ -101,7 +105,7 @@ dissect_moldudp64_msgblk(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, tvb, offset, MOLDUDP64_MSGLEN_LEN, ENC_BIG_ENDIAN); if (msglen != real_msglen) - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_moldudp64_msglen_invalid, "Invalid Message Length (claimed %u, found %u)", msglen, real_msglen); @@ -175,13 +179,12 @@ dissect_moldudp64(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat { if (real_count != 0) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, - "End Of Session packet with extra data."); + expert_add_info(pinfo, ti, &ei_moldudp64_end_of_session_extra); } } else if (real_count != count) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_moldudp64_count_invalid, "Invalid Message Count (claimed %u, found %u)", count, real_count); } @@ -235,6 +238,14 @@ proto_register_moldudp64(void) &ett_moldudp64_msgblk }; + static ei_register_info ei[] = { + { &ei_moldudp64_msglen_invalid, { "moldudp64.msglen.invalid", PI_MALFORMED, PI_ERROR, "Invalid Message Length", EXPFILL }}, + { &ei_moldudp64_end_of_session_extra, { "moldudp64.end_of_session_extra", PI_MALFORMED, PI_ERROR, "End Of Session packet with extra data.", EXPFILL }}, + { &ei_moldudp64_count_invalid, { "moldudp64.count.invalid", PI_MALFORMED, PI_ERROR, "Invalid Message Count", EXPFILL }}, + }; + + expert_module_t* expert_moldudp64; + /* Register the protocol name and description */ proto_moldudp64 = proto_register_protocol("MoldUDP64", "MoldUDP64", "moldudp64"); @@ -242,6 +253,8 @@ proto_register_moldudp64(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_moldudp64, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_moldudp64 = expert_register_protocol(proto_moldudp64); + expert_register_field_array(expert_moldudp64, ei, array_length(ei)); /* Register preferences module */ moldudp64_module = prefs_register_protocol(proto_moldudp64, diff --git a/epan/dissectors/packet-mp2t.c b/epan/dissectors/packet-mp2t.c index d7eac8424b..7dc0dc519d 100644 --- a/epan/dissectors/packet-mp2t.c +++ b/epan/dissectors/packet-mp2t.c @@ -68,7 +68,6 @@ static int hf_mp2t_pid = -1; static int hf_mp2t_tsc = -1; static int hf_mp2t_afc = -1; static int hf_mp2t_cc = -1; -static int hf_mp2t_cc_drop = -1; /* static int hf_mp2t_analysis_flags = -1; */ static int hf_mp2t_analysis_skips = -1; @@ -218,6 +217,9 @@ static int hf_msg_fragment_count = -1; static int hf_msg_reassembled_in = -1; static int hf_msg_reassembled_length = -1; +static expert_field ei_mp2t_pointer = EI_INIT; +static expert_field ei_mp2t_cc_drop = EI_INIT; + static const fragment_items mp2t_msg_frag_items = { /* Fragment subtrees */ &ett_msg_fragment, @@ -620,8 +622,7 @@ mp2t_process_fragmented_payload(tvbuff_t *tvb, gint offset, guint remaining_len, remaining_len--; if (pointer > remaining_len) { /* Bogus pointer */ - expert_add_info_format(pinfo, pi, PI_MALFORMED, - PI_ERROR, + expert_add_info_format_text(pinfo, pi, &ei_mp2t_pointer, "Pointer value is too large (> remaining data length %u)", remaining_len); } @@ -921,27 +922,20 @@ detect_cc_drops(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, /* Add info to the proto tree about drops */ if (detected_drop) { - - flags_item = - proto_tree_add_none_format( - tree, hf_mp2t_cc_drop, tvb, 0, 0, - "Detected %d missing TS frames before this" - " (last_cc:%d total skips:%d discontinuity:%d)", + expert_add_info_format_text(pinfo, tree, &ei_mp2t_cc_drop, + "Detected %d missing TS frames before this (last_cc:%d total skips:%d discontinuity:%d)", skips, cc_prev, mp2t_data->total_skips, mp2t_data->total_discontinuity ); - PROTO_ITEM_SET_GENERATED(flags_item); - expert_add_info_format(pinfo, flags_item, PI_MALFORMED, - PI_ERROR, "Detected TS frame loss"); - flags_item = proto_tree_add_uint(tree, hf_mp2t_analysis_skips, tvb, 0, 0, skips); PROTO_ITEM_SET_GENERATED(flags_item); flags_item = proto_tree_add_uint(tree, hf_mp2t_analysis_drops, - tvb, 0, 0, 1); + + tvb, 0, 0, 1); PROTO_ITEM_SET_GENERATED(flags_item); } @@ -1331,10 +1325,6 @@ proto_register_mp2t(void) "Continuity Counter", "mp2t.cc", FT_UINT32, BASE_DEC, NULL, MP2T_CC_MASK, NULL, HFILL } } , - { &hf_mp2t_cc_drop, { - "Continuity Counter Drops", "mp2t.cc.drop", - FT_NONE, BASE_NONE, NULL, 0x0, NULL, HFILL - } } , #if 0 { &hf_mp2t_analysis_flags, { "MPEG2-TS Analysis Flags", "mp2t.analysis.flags", @@ -1549,10 +1539,19 @@ proto_register_mp2t(void) &ett_msg_fragments }; + static ei_register_info ei[] = { + { &ei_mp2t_pointer, { "mp2t.pointer", PI_MALFORMED, PI_ERROR, "Pointer value is too large", EXPFILL }}, + { &ei_mp2t_cc_drop, { "mp2t.cc.drop", PI_MALFORMED, PI_ERROR, "Detected missing TS frames", EXPFILL }}, + }; + + expert_module_t* expert_mp2t; + proto_mp2t = proto_register_protocol("ISO/IEC 13818-1", "MP2T", "mp2t"); register_dissector("mp2t", dissect_mp2t, proto_mp2t); proto_register_field_array(proto_mp2t, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mp2t = expert_register_protocol(proto_mp2t); + expert_register_field_array(expert_mp2t, ei, array_length(ei)); register_heur_dissector_list("mp2t.pid", &heur_subdissector_list); /* Register init of processing of fragmented DEPI packets */ diff --git a/epan/dissectors/packet-mpeg-sect.c b/epan/dissectors/packet-mpeg-sect.c index a2424a06ad..d79292628b 100644 --- a/epan/dissectors/packet-mpeg-sect.c +++ b/epan/dissectors/packet-mpeg-sect.c @@ -42,6 +42,8 @@ static int hf_mpeg_sect_crc = -1; static gint ett_mpeg_sect = -1; +static expert_field ei_mpeg_sect_crc = EI_INIT; + static dissector_table_t mpeg_sect_tid_dissector_table; static gboolean mpeg_sect_check_crc = FALSE; @@ -256,15 +258,14 @@ packet_mpeg_sect_crc(tvbuff_t *tvb, packet_info *pinfo, proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb, end, 4, crc, "CRC: 0x%08x [%s]", crc, label); } else { - proto_item *msg_error = NULL; + proto_item *msg_error; msg_error = proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb, end, 4, crc, "CRC: 0x%08x [Failed Verification (Calculated: 0x%08x)]", crc, calculated_crc ); PROTO_ITEM_SET_GENERATED(msg_error); - expert_add_info_format( pinfo, msg_error, PI_MALFORMED, - PI_ERROR, "Invalid CRC" ); + expert_add_info( pinfo, msg_error, &ei_mpeg_sect_crc); } return 4; @@ -338,13 +339,21 @@ proto_register_mpeg_sect(void) static gint *ett[] = { &ett_mpeg_sect }; + + static ei_register_info ei[] = { + { &ei_mpeg_sect_crc, { "mpeg_sect.crc.invalid", PI_CHECKSUM, PI_WARN, "Invalid CRC", EXPFILL }}, + }; + module_t *mpeg_sect_module; + expert_module_t* expert_mpeg_sect; proto_mpeg_sect = proto_register_protocol("MPEG2 Section", "MPEG SECT", "mpeg_sect"); register_dissector("mpeg_sect", dissect_mpeg_sect, proto_mpeg_sect); proto_register_field_array(proto_mpeg_sect, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mpeg_sect = expert_register_protocol(proto_mpeg_sect); + expert_register_field_array(expert_mpeg_sect, ei, array_length(ei)); mpeg_sect_module = prefs_register_protocol(proto_mpeg_sect, NULL); diff --git a/epan/dissectors/packet-msproxy.c b/epan/dissectors/packet-msproxy.c index 965d8be83c..c0dbb7970e 100644 --- a/epan/dissectors/packet-msproxy.c +++ b/epan/dissectors/packet-msproxy.c @@ -93,6 +93,9 @@ static int hf_msproxy_server_int_port = -1; static int hf_msproxy_server_ext_addr = -1; static int hf_msproxy_server_ext_port = -1; +static expert_field ei_msproxy_unknown = EI_INIT; +static expert_field ei_msproxy_unhandled = EI_INIT; + static dissector_handle_t msproxy_sub_handle; @@ -1052,16 +1055,16 @@ static void dissect_msproxy_response(tvbuff_t *tvb, packet_info *pinfo, case MSPROXY_CONNECT_AUTHFAILED: case MSPROXY_BIND_AUTHFAILED: - expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "No know information (help wanted)"); + expert_add_info(pinfo, ti, &ei_msproxy_unknown); break; default: if ((((cmd >> 8) == MSPROXY_CONNREFUSED) || ((cmd >> 12) == MSPROXY_CONNREFUSED))) - expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "No know information (help wanted)"); + expert_add_info(pinfo, ti, &ei_msproxy_unknown); else - expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unhandled response command (report this, please)"); + expert_add_info(pinfo, ti, &ei_msproxy_unhandled); } @@ -1270,11 +1273,20 @@ proto_register_msproxy( void){ }, }; + static ei_register_info ei[] = { + { &ei_msproxy_unknown, { "msproxy.unknown", PI_UNDECODED, PI_WARN, "No know information (help wanted)", EXPFILL }}, + { &ei_msproxy_unhandled, { "msproxy.command.unhandled", PI_UNDECODED, PI_WARN, "Unhandled response command (report this, please)", EXPFILL }}, + }; + + expert_module_t* expert_msproxy; + proto_msproxy = proto_register_protocol( "MS Proxy Protocol", "MS Proxy", "msproxy"); proto_register_field_array(proto_msproxy, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_msproxy = expert_register_protocol(proto_msproxy); + expert_register_field_array(expert_msproxy, ei, array_length(ei)); register_init_routine( &msproxy_reinit); /* register re-init routine */ diff --git a/epan/dissectors/packet-mstp.c b/epan/dissectors/packet-mstp.c index 829a589bf5..2adac4d60e 100644 --- a/epan/dissectors/packet-mstp.c +++ b/epan/dissectors/packet-mstp.c @@ -91,6 +91,10 @@ static int hf_mstp_frame_crc16 = -1; static int hf_mstp_frame_checksum_bad = -1; static int hf_mstp_frame_checksum_good = -1; +static expert_field ei_mstp_frame_pdu_len = EI_INIT; +static expert_field ei_mstp_frame_checksum_bad = EI_INIT; + + #if defined(BACNET_MSTP_CHECKSUM_VALIDATE) /* Accumulate "dataValue" into the CRC in crcValue. */ /* Return value is updated CRC */ @@ -188,8 +192,7 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, /* check the length - which does not include the crc16 checksum */ if (mstp_tvb_pdu_len > 2) { if (mstp_frame_pdu_len > (mstp_tvb_pdu_len-2)) { - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_ERROR, - "Length field value goes past the end of the payload"); + expert_add_info(pinfo, item, &ei_mstp_frame_pdu_len); } } #if defined(BACNET_MSTP_CHECKSUM_VALIDATE) @@ -227,8 +230,7 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hf_mstp_frame_checksum_bad, tvb, offset+5, 1, TRUE); PROTO_ITEM_SET_GENERATED(item); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, - "Bad Checksum"); + expert_add_info(pinfo, item, &ei_mstp_frame_checksum_bad); } #else proto_tree_add_item(subtree, hf_mstp_frame_crc8, @@ -303,8 +305,7 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, hf_mstp_frame_checksum_bad, tvb, offset+mstp_frame_pdu_len, 2, TRUE); PROTO_ITEM_SET_GENERATED(item); - expert_add_info_format(pinfo, item, PI_CHECKSUM, PI_ERROR, - "Bad Checksum"); + expert_add_info(pinfo, item, &ei_mstp_frame_checksum_bad); } #else proto_tree_add_item(subtree, hf_mstp_frame_crc16, @@ -417,11 +418,20 @@ proto_register_mstp(void) &ett_bacnet_mstp_checksum }; + static ei_register_info ei[] = { + { &ei_mstp_frame_pdu_len, { "mstp.len.bad", PI_MALFORMED, PI_ERROR, "Length field value goes past the end of the payload", EXPFILL }}, + { &ei_mstp_frame_checksum_bad, { "mstp.checksum_bad.expert", PI_CHECKSUM, PI_WARN, "Bad Checksum", EXPFILL }}, + }; + + expert_module_t* expert_mstp; + proto_mstp = proto_register_protocol("BACnet MS/TP", "BACnet MS/TP", "mstp"); proto_register_field_array(proto_mstp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mstp = expert_register_protocol(proto_mstp); + expert_register_field_array(expert_mstp, ei, array_length(ei)); register_dissector("mstp", dissect_mstp_wtap, proto_mstp); diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index 1a82d7d43a..7e035ed9ec 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -54,6 +54,8 @@ static int hf_mtp2_ext_spare = -1; static int hf_mtp2_sf = -1; static int hf_mtp2_sf_extra = -1; +static expert_field ei_mtp2_checksum_error = EI_INIT; + /* Initialize the subtree pointers */ static gint ett_mtp2 = -1; @@ -193,8 +195,7 @@ mtp2_decode_crc16(tvbuff_t *tvb, proto_tree *fh_tree, packet_info *pinfo) cause=proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2, "FCS 16: 0x%04x [incorrect, should be 0x%04x]", rx_fcs_got, rx_fcs_exp); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(pinfo, cause, PI_MALFORMED, PI_WARN, "MTP2 Frame CheckFCS 16 Error"); + expert_add_info(pinfo, cause, &ei_mtp2_checksum_error); } else { proto_tree_add_text(fh_tree, tvb, rx_fcs_offset, 2, "FCS 16: 0x%04x [correct]", @@ -388,13 +389,20 @@ proto_register_mtp2(void) &ett_mtp2 }; + static ei_register_info ei[] = { + { &ei_mtp2_checksum_error, { "mtp2.checksum.error", PI_CHECKSUM, PI_WARN, "MTP2 Frame CheckFCS 16 Error", EXPFILL }}, + }; + module_t *mtp2_module; + expert_module_t* expert_mtp2; proto_mtp2 = proto_register_protocol("Message Transfer Part Level 2", "MTP2", "mtp2"); register_dissector("mtp2", dissect_mtp2, proto_mtp2); proto_register_field_array(proto_mtp2, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mtp2 = expert_register_protocol(proto_mtp2); + expert_register_field_array(expert_mtp2, ei, array_length(ei)); mtp2_module = prefs_register_protocol(proto_mtp2, NULL); prefs_register_bool_preference(mtp2_module, diff --git a/epan/dissectors/packet-mux27010.c b/epan/dissectors/packet-mux27010.c index e8e0b59bc7..1795d917ac 100644 --- a/epan/dissectors/packet-mux27010.c +++ b/epan/dissectors/packet-mux27010.c @@ -206,6 +206,8 @@ static gint ett_mux27010_controlchannelvalue = -1; static gint ett_mux27010_information = -1; static gint ett_mux27010_checksum = -1; +static expert_field ei_mux27010_message_illogical = EI_INIT; + /*private MUX frame header (PPP)*/ static guint8 sizeMuxPPPHeader = 0; static guint8 sizeOfOneMuxPPPHeader = 0; @@ -1046,8 +1048,7 @@ dissect_mux27010(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) proto_item *pi; pi = proto_tree_add_text(field_tree, tvb, tmpOffset-3, 2, "Message start and end are illogical, aborting dissection"); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, - "Message start and end are illogical"); + expert_add_info(pinfo, pi, &ei_mux27010_message_illogical); continue; } @@ -1519,6 +1520,12 @@ proto_register_mux27010 (void) &ett_msg_fragments }; + static ei_register_info ei[] = { + { &ei_mux27010_message_illogical, { "mux27010.message_illogical", PI_MALFORMED, PI_ERROR, "Message start and end are illogical", EXPFILL }}, + }; + + expert_module_t* expert_mux27010; + /*Register protocoll*/ proto_mux27010 = proto_register_protocol ("MUX27010 Protocol", "MUX27010", "mux27010"); @@ -1526,6 +1533,8 @@ proto_register_mux27010 (void) proto_register_field_array (proto_mux27010, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); register_dissector("mux27010", dissect_mux27010, proto_mux27010); + expert_mux27010 = expert_register_protocol(proto_mux27010); + expert_register_field_array(expert_mux27010, ei, array_length(ei)); register_init_routine(mux27010_init); } diff --git a/epan/dissectors/packet-nat-pmp.c b/epan/dissectors/packet-nat-pmp.c index e1c456af56..12d529de5d 100644 --- a/epan/dissectors/packet-nat-pmp.c +++ b/epan/dissectors/packet-nat-pmp.c @@ -127,6 +127,9 @@ static gint ett_opcode = -1; static gint ett_option = -1; static gint ett_suboption = -1; +static expert_field ei_natpmp_opcode_unknown = EI_INIT; +static expert_field ei_pcp_opcode_unknown = EI_INIT; +static expert_field ei_pcp_option_unknown = EI_INIT; static const value_string opcode_vals[] = { { EXTERNAL_ADDRESS_REQUEST, "External Address Request" }, @@ -273,7 +276,7 @@ dissect_nat_pmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data default: /* Unknown OP */ - expert_add_info_format (pinfo, op_ti, PI_RESPONSE_CODE, PI_WARN, "Unknown opcode: %d", opcode); + expert_add_info_format_text(pinfo, op_ti, &ei_natpmp_opcode_unknown, "Unknown opcode: %d", opcode); break; } @@ -428,7 +431,7 @@ dissect_portcontrol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui break; default: /* Unknown OP */ - expert_add_info_format (pinfo, opcode_ti, PI_RESPONSE_CODE, PI_WARN, "Unknown opcode: %d", ropcode); + expert_add_info_format_text(pinfo, opcode_ti, &ei_pcp_opcode_unknown, "Unknown opcode: %d", ropcode); break; } @@ -474,7 +477,7 @@ dissect_portcontrol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gui default: /* Unknown option */ - expert_add_info_format (pinfo, option_ti, PI_RESPONSE_CODE, PI_WARN, "Unknown option: %d", option); + expert_add_info_format_text(pinfo, option_ti, &ei_pcp_option_unknown, "Unknown option: %d", option); break; } } @@ -680,15 +683,31 @@ void proto_register_nat_pmp (void) &ett_nat_pmp, }; + static ei_register_info natpmp_ei[] = { + { &ei_natpmp_opcode_unknown, { "nat-pmp.opcode.unknown", PI_RESPONSE_CODE, PI_WARN, "Unknown opcode", EXPFILL }}, + }; + + static ei_register_info pcp_ei[] = { + { &ei_pcp_opcode_unknown, { "portcontrol.opcode.unknown", PI_RESPONSE_CODE, PI_WARN, "Unknown opcode", EXPFILL }}, + { &ei_pcp_option_unknown, { "portcontrol.option.unknown", PI_RESPONSE_CODE, PI_WARN, "Unknown option", EXPFILL }}, + }; + + expert_module_t* expert_nat_pmp; + expert_module_t* expert_pcp; + proto_nat_pmp = proto_register_protocol ("NAT Port Mapping Protocol", "NAT-PMP", "nat-pmp"); proto_register_field_array (proto_nat_pmp, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_nat_pmp = expert_register_protocol(proto_nat_pmp); + expert_register_field_array(expert_nat_pmp, natpmp_ei, array_length(natpmp_ei)); proto_pcp = proto_register_protocol ("Port Control Protocol", "Port Control", "portcontrol"); proto_register_field_array (proto_pcp, pcp_hf, array_length (pcp_hf)); proto_register_subtree_array (pcp_ett, array_length (pcp_ett)); + expert_pcp = expert_register_protocol(proto_pcp); + expert_register_field_array(expert_pcp, pcp_ei, array_length(pcp_ei)); } diff --git a/epan/dissectors/packet-ncp-nmas.c b/epan/dissectors/packet-ncp-nmas.c index 8c5089b00f..ab3f07c827 100644 --- a/epan/dissectors/packet-ncp-nmas.c +++ b/epan/dissectors/packet-ncp-nmas.c @@ -65,6 +65,9 @@ static int hf_enc_data = -1; static int hf_reply_buffer_size = -1; static int hf_encrypt_error = -1; +static expert_field ei_encrypt_error = EI_INIT; +static expert_field ei_return_error = EI_INIT; + static const value_string nmas_func_enum[] = { { 0x01, "Ping" }, { 0x02, "Fragment" }, @@ -599,7 +602,7 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin { col_add_fstr(pinfo->cinfo, COL_INFO, "R Payload Error - %s", str); expert_item = proto_tree_add_item(atree, hf_encrypt_error, tvb, foffset, 4, ENC_BIG_ENDIAN); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "NMAS Payload Error: %s", str); + expert_add_info_format_text(pinfo, expert_item, &ei_encrypt_error, "NMAS Payload Error: %s", str); } else { @@ -622,7 +625,7 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin if (str) { expert_item = proto_tree_add_item(atree, hf_return_code, tvb, roffset, 4, ENC_LITTLE_ENDIAN); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "NMAS Error: 0x%08x %s", return_code, str); + expert_add_info_format_text(pinfo, expert_item, &ei_return_error, "NMAS Error: 0x%08x %s", return_code, str); col_add_fstr(pinfo->cinfo, COL_INFO, "R Error - %s", str); } else @@ -630,7 +633,7 @@ dissect_nmas_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guin if (return_code!=0) { expert_item = proto_tree_add_item(atree, hf_return_code, tvb, roffset, 4, ENC_LITTLE_ENDIAN); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "NMAS Error: 0x%08x is unknown", return_code); + expert_add_info_format_text(pinfo, expert_item, &ei_return_error, "NMAS Error: 0x%08x is unknown", return_code); if (check_col(pinfo->cinfo, COL_INFO)) { col_add_fstr(pinfo->cinfo, COL_INFO, "R Unknown NMAS Error - 0x%08x", return_code); } @@ -789,7 +792,16 @@ proto_register_nmas(void) &ett_nmas, }; + static ei_register_info ei[] = { + { &ei_encrypt_error, { "nmas.encrypt_error.expert", PI_RESPONSE_CODE, PI_NOTE, "NMAS Payload Erro", EXPFILL }}, + { &ei_return_error, { "nmas.return_code.expert", PI_RESPONSE_CODE, PI_NOTE, "NMAS Error", EXPFILL }}, + }; + + expert_module_t* expert_nmas; + proto_nmas = proto_register_protocol("Novell Modular Authentication Service", "NMAS", "nmas"); proto_register_field_array(proto_nmas, hf_nmas, array_length(hf_nmas)); proto_register_subtree_array(ett, array_length(ett)); + expert_nmas = expert_register_protocol(proto_nmas); + expert_register_field_array(expert_nmas, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-ncp-sss.c b/epan/dissectors/packet-ncp-sss.c index 85227ec5b7..dfadd074ed 100644 --- a/epan/dissectors/packet-ncp-sss.c +++ b/epan/dissectors/packet-ncp-sss.c @@ -81,6 +81,8 @@ static int hfbit30 = -1; static int hfbit31 = -1; static int hfbit32 = -1; +static expert_field ei_return_code = EI_INIT; + static const value_string sss_func_enum[] = { { 0x00000001, "Ping Server" }, { 0x00000002, "Fragment" }, @@ -717,10 +719,8 @@ dissect_sss_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ncp_tree, guint if (str) { expert_item = proto_tree_add_item(atree, hf_return_code, tvb, foffset, 4, ENC_LITTLE_ENDIAN); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "SSS Error: %s", str); - if (check_col(pinfo->cinfo, COL_INFO)) { - col_add_fstr(pinfo->cinfo, COL_INFO, "R Error - %s", val_to_str(return_code, sss_errors_enum, "Unknown (%d)")); - } + expert_add_info_format_text(pinfo, expert_item, &ei_return_code, "SSS Error: %s", str); + col_add_fstr(pinfo->cinfo, COL_INFO, "R Error - %s", val_to_str(return_code, sss_errors_enum, "Unknown (%d)")); foffset+=4; } else @@ -934,9 +934,17 @@ proto_register_sss(void) static gint *ett[] = { &ett_sss, }; + + static ei_register_info ei[] = { + { &ei_return_code, { "ncp.return_code.expert", PI_RESPONSE_CODE, PI_NOTE, "SSS Error", EXPFILL }}, + }; + + expert_module_t* expert_sss; /*module_t *sss_module;*/ proto_sss = proto_register_protocol("Novell SecretStore Services", "SSS", "sss"); proto_register_field_array(proto_sss, hf_sss, array_length(hf_sss)); proto_register_subtree_array(ett, array_length(ett)); + expert_sss = expert_register_protocol(proto_sss); + expert_register_field_array(expert_sss, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-ndps.c b/epan/dissectors/packet-ndps.c index 73c6658a7f..63e416a555 100644 --- a/epan/dissectors/packet-ndps.c +++ b/epan/dissectors/packet-ndps.c @@ -355,6 +355,10 @@ static int hf_spx_ndps_func_broker = -1; static gint ett_ndps = -1; +static expert_field ei_ndps_problem_type = EI_INIT; +static expert_field ei_ndps_return_code = EI_INIT; +static expert_field ei_ndps_rpc_acc_stat = EI_INIT; + /* desegmentation of NDPS over TCP */ static gboolean ndps_desegment = TRUE; @@ -6732,7 +6736,7 @@ ndps_error(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffset ndps_problem_type = tvb_get_ntohl(tvb, foffset); col_set_str(pinfo->cinfo, COL_INFO, "R NDPS - Error"); expert_item = proto_tree_add_uint(ndps_tree, hf_ndps_problem_type, tvb, foffset, 4, ndps_problem_type); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Fault: %s", val_to_str(ndps_problem_type, error_type_enum, "Unknown NDPS Error (0x%08x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_ndps_problem_type, "Fault: %s", val_to_str(ndps_problem_type, error_type_enum, "Unknown NDPS Error (0x%08x)")); foffset += 4; switch(ndps_problem_type) { @@ -6933,7 +6937,7 @@ return_code(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int foffse expert_status = tvb_get_ntohl(tvb, foffset); expert_item = proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); if (expert_status != 0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Fault: %s", val_to_str(expert_status, ndps_error_types, "Unknown NDPS Error (0x%08x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_ndps_return_code, "Fault: %s", val_to_str(expert_status, ndps_error_types, "Unknown NDPS Error (0x%08x)")); } foffset += 4; if (check_col(pinfo->cinfo, COL_INFO) && tvb_get_ntohl(tvb, foffset-4) != 0) @@ -7010,7 +7014,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int expert_item = proto_tree_add_item(ndps_tree, hf_ndps_rpc_acc_stat, tvb, foffset, 4, ENC_BIG_ENDIAN); expert_status = tvb_get_ntohl(tvb, foffset); if (expert_status != 0) { - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Fault: %s", val_to_str(expert_status, accept_stat, "Unknown NDPS Error (0x%08x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_ndps_rpc_acc_stat, "Fault: %s", val_to_str(expert_status, accept_stat, "Unknown NDPS Error (0x%08x)")); } foffset += 4; if (tvb_length_remaining(tvb,foffset) < 4 ) { @@ -7032,7 +7036,7 @@ dissect_ndps_reply(tvbuff_t *tvb, packet_info *pinfo, proto_tree *ndps_tree, int { expert_status = tvb_get_ntohl(tvb, foffset); expert_item = proto_tree_add_item(ndps_tree, hf_ndps_return_code, tvb, foffset, 4, ENC_BIG_ENDIAN); - expert_add_info_format(pinfo, expert_item, PI_RESPONSE_CODE, PI_ERROR, "Fault: %s", val_to_str(expert_status, ndps_error_types, "Unknown NDPS Error (0x%08x)")); + expert_add_info_format_text(pinfo, expert_item, &ei_ndps_return_code, "Fault: %s", val_to_str(expert_status, ndps_error_types, "Unknown NDPS Error (0x%08x)")); col_append_str(pinfo->cinfo, COL_INFO, "- Error"); return foffset; } @@ -9764,11 +9768,21 @@ proto_register_ndps(void) &ett_ndps_segments, &ett_ndps_segment, }; + + static ei_register_info ei[] = { + { &ei_ndps_problem_type, { "ndps.problem_type.expert", PI_RESPONSE_CODE, PI_NOTE, "Fault", EXPFILL }}, + { &ei_ndps_return_code, { "ndps.return_code.expert", PI_RESPONSE_CODE, PI_NOTE, "Fault", EXPFILL }}, + { &ei_ndps_rpc_acc_stat, { "ndps.rpc_acc_stat.expert", PI_RESPONSE_CODE, PI_NOTE, "Fault", EXPFILL }}, + }; + module_t *ndps_module; + expert_module_t* expert_ndps; proto_ndps = proto_register_protocol("Novell Distributed Print System", "NDPS", "ndps"); proto_register_field_array(proto_ndps, hf_ndps, array_length(hf_ndps)); proto_register_subtree_array(ett, array_length(ett)); + expert_ndps = expert_register_protocol(proto_ndps); + expert_register_field_array(expert_ndps, ei, array_length(ei)); ndps_module = prefs_register_protocol(proto_ndps, NULL); prefs_register_bool_preference(ndps_module, "desegment_tcp", diff --git a/epan/dissectors/packet-netanalyzer.c b/epan/dissectors/packet-netanalyzer.c index 4c5f888c92..cec6eda34c 100644 --- a/epan/dissectors/packet-netanalyzer.c +++ b/epan/dissectors/packet-netanalyzer.c @@ -139,10 +139,13 @@ static gint hf_netanalyzer_status_short_frame = -1; static gint hf_netanalyzer_status_short_preamble = -1; static gint hf_netanalyzer_status_long_preamble = -1; -static gint ett_netanalyzer = -1; +static gint ett_netanalyzer = -1; static gint ett_netanalyzer_status = -1; static gint ett_netanalyzer_transparent = -1; +static expert_field ei_netanalyzer_header_version_wrong = EI_INIT; +static expert_field ei_netanalyzer_gpio_def_none = EI_INIT; +static expert_field ei_netanalyzer_header_version_none = EI_INIT; /* common routine for Ethernet and transparent mode */ static int @@ -179,7 +182,7 @@ dissect_netanalyzer_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if (version != 1) { /* something is wrong */ - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "Wrong netANALYZER header version"); + expert_add_info(pinfo, ti, &ei_netanalyzer_header_version_wrong); return FALSE; } @@ -293,7 +296,7 @@ dissect_netanalyzer_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { /* something is wrong */ - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "No valid netANALYZER GPIO definition found"); + expert_add_info(pinfo, ti, &ei_netanalyzer_gpio_def_none); } return FALSE; } @@ -322,11 +325,8 @@ dissect_netanalyzer(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) else { /* something is wrong */ - if (tree) - { - ti = proto_tree_add_text(tree, tvb, 4, tvb_length(tvb)-4, "netANALYZER"); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "No netANALYZER header found"); - } + ti = proto_tree_add_text(tree, tvb, 4, tvb_length(tvb)-4, "netANALYZER"); + expert_add_info(pinfo, ti, &ei_netanalyzer_header_version_none); } } @@ -360,11 +360,8 @@ dissect_netanalyzer_transparent(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t else { /* something is wrong */ - if (tree) - { - ti = proto_tree_add_text(tree, tvb, 4, tvb_length(tvb)-4, "netANALYZER transparent mode"); - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "No netANALYZER header found"); - } + ti = proto_tree_add_text(tree, tvb, 4, tvb_length(tvb)-4, "netANALYZER transparent mode"); + expert_add_info(pinfo, ti, &ei_netanalyzer_header_version_none); } } @@ -445,6 +442,14 @@ void proto_register_netanalyzer(void) &ett_netanalyzer_transparent, }; + static ei_register_info ei[] = { + { &ei_netanalyzer_header_version_wrong, { "netanalyzer.header_version.wrong", PI_PROTOCOL, PI_ERROR, "Wrong netANALYZER header version", EXPFILL }}, + { &ei_netanalyzer_gpio_def_none, { "netanalyzer.gpio_def_none", PI_MALFORMED, PI_ERROR, "No valid netANALYZER GPIO definition found", EXPFILL }}, + { &ei_netanalyzer_header_version_none, { "netanalyzer.header_version.none", PI_MALFORMED, PI_ERROR, "No netANALYZER header found", EXPFILL }}, + }; + + expert_module_t* expert_netanalyzer; + proto_netanalyzer = proto_register_protocol ( "netANALYZER", /* name */ "netANALYZER", /* short name */ @@ -452,6 +457,8 @@ void proto_register_netanalyzer(void) proto_register_field_array(proto_netanalyzer, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_netanalyzer = expert_register_protocol(proto_netanalyzer); + expert_register_field_array(expert_netanalyzer, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-nfs.c b/epan/dissectors/packet-nfs.c index 4f8ff2485b..132c41d329 100644 --- a/epan/dissectors/packet-nfs.c +++ b/epan/dissectors/packet-nfs.c @@ -714,6 +714,9 @@ static gint ett_nfs4_reclaim_complete = -1; static gint ett_nfs4_chan_attrs = -1; static gint ett_nfs4_want_notify_flags = -1; +static expert_field ei_nfs_too_many_ops = EI_INIT; + + /* Types of fhandles we can dissect */ static dissector_table_t nfs_fhandle_table; @@ -8861,7 +8864,7 @@ dissect_nfs4_request_op(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tre * This is an arbitrary number to keep us from attempting to * allocate too much memory below. */ - expert_add_info_format(pinfo, fitem, PI_MALFORMED, PI_NOTE, "Too many operations"); + expert_add_info(pinfo, fitem, &ei_nfs_too_many_ops); ops = MAX_NFSV4_OPS; } @@ -9494,7 +9497,7 @@ dissect_nfs4_response_op(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tr offset += 4; if (ops > MAX_NFSV4_OPS) { - expert_add_info_format(pinfo, fitem, PI_MALFORMED, PI_NOTE, "Too many operations"); + expert_add_info(pinfo, fitem, &ei_nfs_too_many_ops); ops = MAX_NFSV4_OPS; } @@ -12576,11 +12579,19 @@ proto_register_nfs(void) &ett_nfs4_sequence_status_flags, &ett_nfs4_want_notify_flags }; - module_t *nfs_module; + + static ei_register_info ei[] = { + { &ei_nfs_too_many_ops, { "nfs.too_many_ops", PI_PROTOCOL, PI_NOTE, "Too many operations", EXPFILL }}, + }; + + module_t *nfs_module; + expert_module_t* expert_nfs; proto_nfs = proto_register_protocol("Network File System", "NFS", "nfs"); proto_register_field_array(proto_nfs, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_nfs = expert_register_protocol(proto_nfs); + expert_register_field_array(expert_nfs, ei, array_length(ei)); nfs_module=prefs_register_protocol(proto_nfs, NULL); prefs_register_bool_preference(nfs_module, "file_name_snooping", |