diff options
author | Michael Mann <mmann78@netscape.net> | 2013-06-10 02:18:55 +0000 |
---|---|---|
committer | Michael Mann <mmann78@netscape.net> | 2013-06-10 02:18:55 +0000 |
commit | 2ee48f150d05ad615667090203e48625d23d2819 (patch) | |
tree | 3f091f2be288a39d9bad652cc670e71ef1d5a05e /epan/dissectors | |
parent | 613739da3a92592d69f1179cd2cc8634e94b7f66 (diff) |
Batch of filterable expert infos.
svn path=/trunk/; revision=49868
Diffstat (limited to 'epan/dissectors')
-rw-r--r-- | epan/dissectors/packet-eap.c | 28 | ||||
-rw-r--r-- | epan/dissectors/packet-ipxwan.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-isakmp.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-iwarp-mpa.c | 24 | ||||
-rw-r--r-- | epan/dissectors/packet-lon.c | 25 | ||||
-rw-r--r-- | epan/dissectors/packet-mongo.c | 21 | ||||
-rw-r--r-- | epan/dissectors/packet-mpeg-dsmcc.c | 29 | ||||
-rw-r--r-- | epan/dissectors/packet-per.c | 38 | ||||
-rw-r--r-- | epan/dissectors/packet-reload.c | 133 | ||||
-rw-r--r-- | epan/dissectors/packet-rpcap.c | 32 |
10 files changed, 258 insertions, 122 deletions
diff --git a/epan/dissectors/packet-eap.c b/epan/dissectors/packet-eap.c index 6e67ac85d9..7ee34494b2 100644 --- a/epan/dissectors/packet-eap.c +++ b/epan/dissectors/packet-eap.c @@ -92,6 +92,11 @@ static int hf_eap_ms_chap_v2_failure_request = -1; static gint ett_eap = -1; +static expert_field ei_eap_ms_chap_v2_length = EI_INIT; +static expert_field ei_eap_mitm_attacks = EI_INIT; +static expert_field ei_eap_md5_value_size_overflow = EI_INIT; +static expert_field ei_eap_dictionary_attacks = EI_INIT; + static dissector_handle_t ssl_handle; const value_string eap_code_vals[] = { @@ -444,7 +449,7 @@ dissect_eap_mschapv2(proto_tree *eap_tree, tvbuff_t *tvb, packet_info *pinfo, in item = proto_tree_add_item(eap_tree, hf_eap_ms_chap_v2_length, tvb, offset, 2, ENC_BIG_ENDIAN); ms_len = tvb_get_ntohs(tvb, offset); if (ms_len != size) - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Invalid Length"); + expert_add_info(pinfo, item, &ei_eap_ms_chap_v2_length); offset += 2; left -= 2; @@ -787,13 +792,12 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) proto_item *item; /* Warn that this is an insecure EAP type. */ - expert_add_info_format(pinfo, eap_type_item, PI_SECURITY, PI_WARN, - "Vulnerable to MITM attacks. If possible, change EAP type."); + expert_add_info(pinfo, eap_type_item, &ei_eap_mitm_attacks); item = proto_tree_add_item(eap_tree, hf_eap_md5_value_size, tvb, offset, 1, ENC_BIG_ENDIAN); if (value_size > (size - 1)) { - expert_add_info_format(pinfo, item, PI_PROTOCOL, PI_WARN, "Overflow"); + expert_add_info(pinfo, item, &ei_eap_md5_value_size_overflow); value_size = size - 1; } @@ -1051,9 +1055,7 @@ dissect_eap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) guint8 count, namesize; /* Warn that this is an insecure EAP type. */ - expert_add_info_format(pinfo, eap_type_item, PI_SECURITY, PI_WARN, - "Vulnerable to dictionary attacks. If possible, change EAP type." - " See http://www.cisco.com/warp/public/cc/pd/witc/ao350ap/prodlit/2331_pp.pdf"); + expert_add_info(pinfo, eap_type_item, &ei_eap_dictionary_attacks); /* Version (byte) */ if (tree) { @@ -1516,11 +1518,23 @@ proto_register_eap(void) &ett_eap_exp_attr, &ett_eap_tls_flags }; + static ei_register_info ei[] = { + { &ei_eap_ms_chap_v2_length, { "eap.ms_chap_v2.length.invalid", PI_PROTOCOL, PI_WARN, "Invalid Length", EXPFILL }}, + { &ei_eap_mitm_attacks, { "eap.mitm_attacks", PI_SECURITY, PI_WARN, "Vulnerable to MITM attacks. If possible, change EAP type.", EXPFILL }}, + { &ei_eap_md5_value_size_overflow, { "eap.md5.value_size.overflow", PI_PROTOCOL, PI_WARN, "Overflow", EXPFILL }}, + { &ei_eap_dictionary_attacks, { "eap.dictionary_attacks", PI_SECURITY, PI_WARN, + "Vulnerable to dictionary attacks. If possible, change EAP type." + " See http://www.cisco.com/warp/public/cc/pd/witc/ao350ap/prodlit/2331_pp.pdf", EXPFILL }}, + }; + + expert_module_t* expert_eap; proto_eap = proto_register_protocol("Extensible Authentication Protocol", "EAP", "eap"); proto_register_field_array(proto_eap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_eap = expert_register_protocol(proto_eap); + expert_register_field_array(expert_eap, ei, array_length(ei)); new_register_dissector("eap", dissect_eap, proto_eap); register_init_routine(eap_tls_defragment_init); diff --git a/epan/dissectors/packet-ipxwan.c b/epan/dissectors/packet-ipxwan.c index a22e1df91b..99c0db057f 100644 --- a/epan/dissectors/packet-ipxwan.c +++ b/epan/dissectors/packet-ipxwan.c @@ -63,6 +63,8 @@ static int hf_ipxwan_option_value = -1; static gint ett_ipxwan = -1; static gint ett_ipxwan_option = -1; +static expert_field ei_ipxwan_option_data_len = EI_INIT; + static const value_string ipxwan_packet_type_vals[] = { { 0, "Timer Request" }, { 1, "Timer Response" }, @@ -196,7 +198,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_ROUTING_TYPE: if (option_data_len != 1) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 1", option_data_len); } else { proto_tree_add_item(option_tree, @@ -207,7 +209,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_RIP_SAP_INFO_EXCHANGE: if (option_data_len != 54) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 54", option_data_len); } else { wan_link_delay = tvb_get_ntohs(tvb, @@ -228,7 +230,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_NLSP_INFORMATION: if (option_data_len != 8) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 8", option_data_len); } else { delay = tvb_get_ntohl(tvb, offset); @@ -247,7 +249,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_NLSP_RAW_THROUGHPUT_DATA: if (option_data_len != 8) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 8", option_data_len); } else { proto_tree_add_item(option_tree, @@ -264,7 +266,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_EXTENDED_NODE_ID: if (option_data_len != 4) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 4", option_data_len); } else { proto_tree_add_item(option_tree, @@ -275,7 +277,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_NODE_NUMBER: if (option_data_len != 6) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be 6", option_data_len); } else { proto_tree_add_item(option_tree, @@ -286,7 +288,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case OPT_COMPRESSION: if (option_data_len < 1) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be >= 1", option_data_len); } else { compression_type = tvb_get_guint8(tvb, @@ -298,7 +300,7 @@ dissect_ipxwan(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) case COMP_TYPE_TELEBIT: if (option_data_len < 3) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, ti, &ei_ipxwan_option_data_len, "Bogus length: %u, should be >= 3", option_data_len); } else { proto_tree_add_item(option_tree, hf_ipxwan_compression_options, @@ -441,10 +443,17 @@ proto_register_ipxwan(void) &ett_ipxwan, &ett_ipxwan_option, }; + static ei_register_info ei[] = { + { &ei_ipxwan_option_data_len, { "ipxwan.option_data_len.invalid", PI_MALFORMED, PI_ERROR, "Wrong length", EXPFILL }}, + }; + + expert_module_t* expert_ipxwan; proto_ipxwan = proto_register_protocol("IPX WAN", "IPX WAN", "ipxwan"); proto_register_field_array(proto_ipxwan, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ipxwan = expert_register_protocol(proto_ipxwan); + expert_register_field_array(expert_ipxwan, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-isakmp.c b/epan/dissectors/packet-isakmp.c index d29b68ee38..3061b41bfc 100644 --- a/epan/dissectors/packet-isakmp.c +++ b/epan/dissectors/packet-isakmp.c @@ -368,6 +368,11 @@ static gint ett_isakmp_decrypted_data = -1; static gint ett_isakmp_decrypted_payloads = -1; #endif /* HAVE_LIBGCRYPT */ +static expert_field ei_isakmp_enc_iv = EI_INIT; +static expert_field ei_isakmp_ikev2_integrity_checksum = EI_INIT; +static expert_field ei_isakmp_enc_data_length_mult_block_size = EI_INIT; +static expert_field ei_isakmp_enc_pad_length_big = EI_INIT; + static dissector_handle_t eap_handle = NULL; static reassembly_table isakmp_reassembly_table; @@ -4602,7 +4607,7 @@ dissect_enc(tvbuff_t *tvb, */ if (encr_data_len <= 0) { item = proto_tree_add_text(tree, tvb, offset, length, "Not enough data for IV, Encrypted data and ICD."); - expert_add_info_format(pinfo, item, PI_MALFORMED, PI_WARN, "Not enough data in IKEv2 Encrypted payload"); + expert_add_info(pinfo, item, &ei_isakmp_enc_iv); PROTO_ITEM_SET_GENERATED(item); return; } @@ -4664,7 +4669,7 @@ dissect_enc(tvbuff_t *tvb, proto_item_append_text(icd_item, "[correct]"); } else { proto_item_append_text(icd_item, "[incorrect, should be %s]", bytes_to_str(md, icd_len)); - expert_add_info_format(pinfo, icd_item, PI_CHECKSUM, PI_WARN, "IKEv2 Integrity Checksum Data is incorrect"); + expert_add_info(pinfo, icd_item, &ei_isakmp_ikev2_integrity_checksum); } gcry_md_close(md_hd); } else { @@ -4678,7 +4683,7 @@ dissect_enc(tvbuff_t *tvb, if (encr_data_len % key_info->encr_spec->block_len != 0) { proto_item_append_text(encr_data_item, "[Invalid length, should be a multiple of block size (%u)]", key_info->encr_spec->block_len); - expert_add_info_format(pinfo, encr_data_item, PI_MALFORMED, PI_WARN, "Encrypted data length isn't a multiple of block size"); + expert_add_info(pinfo, encr_data_item, &ei_isakmp_enc_data_length_mult_block_size); return; } @@ -4747,7 +4752,7 @@ dissect_enc(tvbuff_t *tvb, if (pad_len > 0) { if (payloads_len < 0) { proto_item_append_text(padlen_item, " [too long]"); - expert_add_info_format(pinfo, padlen_item, PI_MALFORMED, PI_WARN, "Pad length is too big"); + expert_add_info(pinfo, padlen_item, &ei_isakmp_enc_pad_length_big); } else { item = proto_tree_add_item(decr_tree, hf_isakmp_enc_padding, decr_tvb, payloads_len, pad_len, ENC_NA); proto_item_append_text(item, " (%d byte%s)", pad_len, plurality(pad_len, "", "s")); @@ -6086,6 +6091,16 @@ proto_register_isakmp(void) &ett_isakmp_decrypted_payloads #endif /* HAVE_LIBGCRYPT */ }; + + static ei_register_info ei[] = { + { &ei_isakmp_enc_iv, { "isakmp.enc.iv.not_enough_data", PI_MALFORMED, PI_WARN, "Not enough data in IKEv2 Encrypted payload", EXPFILL }}, + { &ei_isakmp_ikev2_integrity_checksum, { "isakmp.ikev2.integrity_checksum", PI_CHECKSUM, PI_WARN, "IKEv2 Integrity Checksum Data is incorrect", EXPFILL }}, + { &ei_isakmp_enc_data_length_mult_block_size, { "isakmp.enc_data_length_mult_block_size", PI_MALFORMED, PI_WARN, "Encrypted data length isn't a multiple of block size", EXPFILL }}, + { &ei_isakmp_enc_pad_length_big, { "isakmp.enc.pad_length.big", PI_MALFORMED, PI_WARN, "Pad length is too big", EXPFILL }}, + }; + + expert_module_t* expert_isakmp; + #ifdef HAVE_LIBGCRYPT static uat_field_t ikev1_uat_flds[] = { UAT_FLD_BUFFER(ikev1_users, icookie, "Initiator's COOKIE", "Initiator's COOKIE"), @@ -6109,6 +6124,8 @@ proto_register_isakmp(void) "ISAKMP", "isakmp"); proto_register_field_array(proto_isakmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_isakmp = expert_register_protocol(proto_isakmp); + expert_register_field_array(expert_isakmp, ei, array_length(ei)); register_init_routine(&isakmp_init_protocol); register_dissector("isakmp", dissect_isakmp, proto_isakmp); diff --git a/epan/dissectors/packet-iwarp-mpa.c b/epan/dissectors/packet-iwarp-mpa.c index e5c94983db..b7f6035cde 100644 --- a/epan/dissectors/packet-iwarp-mpa.c +++ b/epan/dissectors/packet-iwarp-mpa.c @@ -110,6 +110,10 @@ static gint ett_mpa_rep = -1; static gint ett_mpa_fpdu = -1; static gint ett_mpa_marker = -1; +static expert_field ei_mpa_res_field_not_set0 = EI_INIT; +static expert_field ei_mpa_rev_field_not_set1 = EI_INIT; +static expert_field ei_mpa_reject_bit_responder = EI_INIT; + /* handles of our subdissectors */ static dissector_handle_t ddp_rdmap_handle = NULL; @@ -359,12 +363,10 @@ is_mpa_req(tvbuff_t *tvb, packet_info *pinfo) /* update expert info */ if (mcrres & MPA_RESERVED_FLAG) - expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_WARN, - "Res field is NOT set to zero as required by RFC 5044"); + expert_add_info(pinfo, NULL, &ei_mpa_res_field_not_set0); if (state->revision != 1) - expert_add_info_format(pinfo, NULL, PI_REQUEST_CODE, PI_WARN, - "Rev field is NOT set to one as required by RFC 5044"); + expert_add_info(pinfo, NULL, &ei_mpa_rev_field_not_set1); } return TRUE; } @@ -406,8 +408,7 @@ is_mpa_rep(tvbuff_t *tvb, packet_info *pinfo) if (!(mcrres & MPA_REJECT_FLAG)) state->full_operation = TRUE; else - expert_add_info_format(pinfo, NULL, PI_RESPONSE_CODE, PI_NOTE, - "Reject bit set by Responder"); + expert_add_info(pinfo, NULL, &ei_mpa_reject_bit_responder); } return TRUE; } @@ -960,6 +961,14 @@ void proto_register_mpa(void) &ett_mpa_marker }; + static ei_register_info ei[] = { + { &ei_mpa_res_field_not_set0, { "iwarp_mpa.res.not_set0", PI_REQUEST_CODE, PI_WARN, "Res field is NOT set to zero as required by RFC 5044", EXPFILL }}, + { &ei_mpa_rev_field_not_set1, { "iwarp_mpa.rev.not_set1", PI_REQUEST_CODE, PI_WARN, "Rev field is NOT set to one as required by RFC 5044", EXPFILL }}, + { &ei_mpa_reject_bit_responder, { "iwarp_mpa.reject_bit_responder", PI_RESPONSE_CODE, PI_NOTE, "Reject bit set by Responder", EXPFILL }}, + }; + + expert_module_t* expert_iwarp_mpa; + /* register the protocol name and description */ proto_iwarp_mpa = proto_register_protocol( "iWARP Marker Protocol data unit Aligned framing", @@ -968,7 +977,8 @@ void proto_register_mpa(void) /* required function calls to register the header fields and subtrees */ proto_register_field_array(proto_iwarp_mpa, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); - + expert_iwarp_mpa = expert_register_protocol(proto_iwarp_mpa); + expert_register_field_array(expert_iwarp_mpa, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-lon.c b/epan/dissectors/packet-lon.c index 3bdb7ee797..000ab922c4 100644 --- a/epan/dissectors/packet-lon.c +++ b/epan/dissectors/packet-lon.c @@ -185,6 +185,11 @@ static gint ett_ff = -1; static gint ett_address = -1; +static expert_field ei_lon_tpdu_tpdu_type_unknown = EI_INIT; +static expert_field ei_lon_tpdu_spdu_type_unknown = EI_INIT; +static expert_field ei_lon_tpdu_authpdu_type_unknown = EI_INIT; +static expert_field ei_lon_tpdu_apdu_dest_type = EI_INIT; + static dissector_handle_t data_handle; static gint dissect_apdu(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, @@ -339,7 +344,7 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) offset += length; offset += dissect_apdu(lon_tree, pinfo, tvb, offset); } else { - expert_add_info_format(pinfo, lon_tree, PI_MALFORMED, PI_WARN, "Unexpected TPDU type %i", pdutype); + expert_add_info_format_text(pinfo, lon_tree, &ei_lon_tpdu_tpdu_type_unknown, "Unexpected TPDU type %i", pdutype); } } else if (pdu_fmt == 1) { /* SPDU */ static const gint *spdu_fields[] = { @@ -371,7 +376,7 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) offset += length; offset += dissect_apdu(lon_tree, pinfo, tvb, offset); } else { - expert_add_info_format(pinfo, lon_tree, PI_MALFORMED, PI_WARN, "Unexpected SPDU type %i", pdutype); + expert_add_info_format_text(pinfo, lon_tree, &ei_lon_tpdu_spdu_type_unknown, "Unexpected SPDU type %i", pdutype); } } else if (pdu_fmt == 2) { /* AuthPDU */ static const gint *authpdu_fields[] = { @@ -390,8 +395,7 @@ dissect_lon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) } else if (pdutype == 2) { /* REPLY */ offset += 9; } else { - expert_add_info_format(pinfo, lon_tree, - PI_MALFORMED, PI_WARN, "Unexpected AuthPDU type %i", pdutype); + expert_add_info_format_text(pinfo, lon_tree, &ei_lon_tpdu_authpdu_type_unknown, "Unexpected AuthPDU type %i", pdutype); } } else if (pdu_fmt == 3) { /* APDU */ offset += dissect_apdu(lon_tree, pinfo, tvb, offset); @@ -460,7 +464,7 @@ dissect_apdu(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, ett_ff, ff_fields, ENC_BIG_ENDIAN); offset++; } else { /* Shouldn't get here */ - expert_add_info_format(pinfo, tree, PI_MALFORMED, PI_WARN, "Malformed APDU destin&type %i", dest_type); + expert_add_info_format_text(pinfo, tree, &ei_lon_tpdu_apdu_dest_type, "Malformed APDU destin&type %i", dest_type); } next_tvb = tvb_new_subset_remaining(tvb, offset); @@ -704,11 +708,22 @@ proto_register_lon(void) &ett_ff }; + static ei_register_info ei[] = { + { &ei_lon_tpdu_tpdu_type_unknown, { "lon.tpdu_type.unknown", PI_PROTOCOL, PI_WARN, "Unexpected TPDU type", EXPFILL }}, + { &ei_lon_tpdu_spdu_type_unknown, { "lon.spdu_type.unknown", PI_PROTOCOL, PI_WARN, "Unexpected SPDU type", EXPFILL }}, + { &ei_lon_tpdu_authpdu_type_unknown, { "lon.authpdu_type.unknown", PI_PROTOCOL, PI_WARN, "Unexpected AuthPDU type", EXPFILL }}, + { &ei_lon_tpdu_apdu_dest_type, { "lon.authpdu_dest_type.unknown", PI_PROTOCOL, PI_WARN, "Malformed APDU destin&type", EXPFILL }}, + }; + + expert_module_t* expert_lon; + proto_lon = proto_register_protocol("Local Operating Network", "LON", "lon"); proto_register_field_array (proto_lon, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_lon = expert_register_protocol(proto_lon); + expert_register_field_array(expert_lon, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-mongo.c b/epan/dissectors/packet-mongo.c index 9a0e88239f..e35f8075b6 100644 --- a/epan/dissectors/packet-mongo.c +++ b/epan/dissectors/packet-mongo.c @@ -215,6 +215,10 @@ static gint ett_mongo_code = -1; static gint ett_mongo_fcn = -1; static gint ett_mongo_flags = -1; +static expert_field ei_mongo_document_recursion_exceeded = EI_INIT; +static expert_field ei_mongo_document_length_bad = EI_INIT; +static expert_field ei_mongo_unknown = EI_INIT; + static int dissect_fullcollectionname(tvbuff_t *tvb, guint offset, proto_tree *tree) { @@ -257,17 +261,17 @@ dissect_bson_document(tvbuff_t *tvb, packet_info *pinfo, guint offset, proto_tre proto_tree_add_item(doc_tree, hf_mongo_document_length, tvb, offset, 4, ENC_LITTLE_ENDIAN); if (nest_level > BSON_MAX_NESTING) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "BSON document recursion exceeds %u", BSON_MAX_NESTING); + expert_add_info_format_text(pinfo, ti, &ei_mongo_document_recursion_exceeded, "BSON document recursion exceeds %u", BSON_MAX_NESTING); THROW(ReportedBoundsError); } if (document_length < 5) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "BSON document length too short: %u", document_length); + expert_add_info_format_text(pinfo, ti, &ei_mongo_document_length_bad, "BSON document length too short: %u", document_length); THROW(ReportedBoundsError); } if (document_length > BSON_MAX_DOC_SIZE) { - expert_add_info_format(pinfo, ti, PI_MALFORMED, PI_ERROR, "BSON document length too long: %u", document_length); + expert_add_info_format_text(pinfo, ti, &ei_mongo_document_length_bad, "BSON document length too long: %u", document_length); THROW(ReportedBoundsError); } @@ -644,7 +648,7 @@ dissect_mongo_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) if(offset < tvb_reported_length(tvb)) { ti = proto_tree_add_item(mongo_tree, hf_mongo_unknown, tvb, offset, -1, ENC_NA); - expert_add_info_format(pinfo, ti, PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)"); + expert_add_info(pinfo, ti, &ei_mongo_unknown); } } @@ -672,6 +676,7 @@ void proto_register_mongo(void) { module_t *mongo_module; + expert_module_t* expert_mongo; static hf_register_info hf[] = { { &hf_mongo_message_length, @@ -1021,10 +1026,18 @@ proto_register_mongo(void) &ett_mongo_flags }; + static ei_register_info ei[] = { + { &ei_mongo_document_recursion_exceeded, { "mongo.document.recursion_exceeded", PI_MALFORMED, PI_ERROR, "BSON document recursion exceeds", EXPFILL }}, + { &ei_mongo_document_length_bad, { "mongo.document.length.bad", PI_MALFORMED, PI_ERROR, "BSON document length bad", EXPFILL }}, + { &ei_mongo_unknown, { "mongo.unknown.expert", PI_UNDECODED, PI_WARN, "Unknown Data (not interpreted)", EXPFILL }}, + }; + proto_mongo = proto_register_protocol("Mongo Wire Protocol", "MONGO", "mongo"); proto_register_field_array(proto_mongo, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mongo = expert_register_protocol(proto_mongo); + expert_register_field_array(expert_mongo, ei, array_length(ei)); mongo_module = prefs_register_protocol(proto_mongo, proto_reg_handoff_mongo); diff --git a/epan/dissectors/packet-mpeg-dsmcc.c b/epan/dissectors/packet-mpeg-dsmcc.c index 7a590604e9..c4a8f41c9b 100644 --- a/epan/dissectors/packet-mpeg-dsmcc.c +++ b/epan/dissectors/packet-mpeg-dsmcc.c @@ -165,6 +165,9 @@ static gint ett_dsmcc_compat = -1; static gint ett_dsmcc_compat_sub_desc = -1; static gint ett_dsmcc_dii_module = -1; +static expert_field ei_dsmcc_invalid_value = EI_INIT; +static expert_field ei_dsmcc_crc_invalid = EI_INIT; + #define DSMCC_TID_LLCSNAP 0x3a #define DSMCC_TID_UN_MSG 0x3b #define DSMCC_TID_DD_MSG 0x3c @@ -243,7 +246,7 @@ dissect_dsmcc_adaptation_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t offset, 1, ENC_BIG_ENDIAN); if (0xff != tmp) { PROTO_ITEM_SET_GENERATED(pi); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } offset +=1; @@ -267,7 +270,7 @@ dissect_dsmcc_adaptation_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *t offset, 1, ENC_BIG_ENDIAN); if (0xff != tmp) { PROTO_ITEM_SET_GENERATED(pi); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } offset +=1; @@ -303,7 +306,7 @@ dissect_dsmcc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, 1, ENC_BIG_ENDIAN); if (0x11 != prot_disc) { PROTO_ITEM_SET_GENERATED(pi); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0x11"); } offset +=1; @@ -327,7 +330,7 @@ dissect_dsmcc_header(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint offset, 1, ENC_BIG_ENDIAN); if (0xff != reserved) { PROTO_ITEM_SET_GENERATED(pi); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } offset +=1; @@ -416,8 +419,7 @@ dissect_dsmcc_dii_compat_desc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre } if( 1000 == offset ) { - expert_add_info_format( pinfo, NULL, PI_MALFORMED, - PI_ERROR, "Invalid CRC" ); + expert_add_info( pinfo, NULL, &ei_dsmcc_crc_invalid); } } @@ -509,7 +511,7 @@ dissect_dsmcc_ddb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, offset, 1, ENC_BIG_ENDIAN); if (0xff != reserved) { PROTO_ITEM_SET_GENERATED(pi); - expert_add_info_format(pinfo, pi, PI_MALFORMED, PI_ERROR, + expert_add_info_format_text(pinfo, pi, &ei_dsmcc_invalid_value, "Invalid value - should be 0xff"); } offset +=1; @@ -676,15 +678,14 @@ dissect_dsmcc_ts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree_in, void *d proto_tree_add_uint_format( tree, hf_dsmcc_crc, tvb, crc_len, 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_dsmcc_crc, tvb, crc_len, 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_dsmcc_crc_invalid); } } else { /* TODO: actually check the checksum */ @@ -1027,12 +1028,20 @@ proto_register_dsmcc(void) &ett_dsmcc_compat_sub_desc, &ett_dsmcc_dii_module }; + static ei_register_info ei[] = { + { &ei_dsmcc_invalid_value, { "dsmcc.invalid_value", PI_PROTOCOL, PI_WARN, "Invalid value", EXPFILL }}, + { &ei_dsmcc_crc_invalid, { "mpeg_sect.crc.invalid", PI_CHECKSUM, PI_WARN, "Invalid CRC", EXPFILL }}, + }; + module_t *dsmcc_module; + expert_module_t* expert_dsmcc; proto_dsmcc = proto_register_protocol("MPEG DSM-CC", "MPEG DSM-CC", "mpeg_dsmcc"); proto_register_field_array(proto_dsmcc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dsmcc = expert_register_protocol(proto_dsmcc); + expert_register_field_array(expert_dsmcc, ei, array_length(ei)); new_register_dissector("mp2t-dsmcc", dissect_dsmcc_ts, proto_dsmcc); dsmcc_module = prefs_register_protocol(proto_dsmcc, NULL); diff --git a/epan/dissectors/packet-per.c b/epan/dissectors/packet-per.c index a91d8593c0..1a1dabfe60 100644 --- a/epan/dissectors/packet-per.c +++ b/epan/dissectors/packet-per.c @@ -80,6 +80,13 @@ static gint ett_per_sequence_of_item = -1; static gint ett_per_External = -1; static gint ett_per_External_encoding = -1; +static expert_field ei_per_size_constraint_value = EI_INIT; +static expert_field ei_per_size_constraint_too_few = EI_INIT; +static expert_field ei_per_size_constraint_too_many = EI_INIT; +static expert_field ei_per_choice_extension_unknown = EI_INIT; +static expert_field ei_per_sequence_extension_unknown = EI_INIT; +static expert_field ei_per_encoding_error = EI_INIT; + /* #define DEBUG_ENTRY(x) \ printf("#%u %s tvb:0x%08x\n",actx->pinfo->fd->num,x,(int)tvb); @@ -121,27 +128,27 @@ static const true_false_string tfs_optional_field_bit = { static void per_check_value(guint32 value, guint32 min_len, guint32 max_len, asn1_ctx_t *actx, proto_item *item, gboolean is_signed) { if ((is_signed == FALSE) && (value > max_len)) { - expert_add_info_format(actx->pinfo, item, PI_PROTOCOL, PI_WARN, "Size constraint: value too big: %u (%u .. %u)", value, min_len, max_len); + expert_add_info_format_text(actx->pinfo, item, &ei_per_size_constraint_value, "Size constraint: value too big: %u (%u .. %u)", value, min_len, max_len); } else if ((is_signed == TRUE) && ((gint32)value > (gint32)max_len)) { - expert_add_info_format(actx->pinfo, item, PI_PROTOCOL, PI_WARN, "Size constraint: value too big: %d (%d .. %d)", (gint32)value, (gint32)min_len, (gint32)max_len); + expert_add_info_format_text(actx->pinfo, item, &ei_per_size_constraint_value, "Size constraint: value too big: %d (%d .. %d)", (gint32)value, (gint32)min_len, (gint32)max_len); } } static void per_check_value64(guint64 value, guint64 min_len, guint64 max_len, asn1_ctx_t *actx, proto_item *item, gboolean is_signed) { if ((is_signed == FALSE) && (value > max_len)) { - expert_add_info_format(actx->pinfo, item, PI_PROTOCOL, PI_WARN, "Size constraint: value too big: %" G_GINT64_MODIFIER "u (%" G_GINT64_MODIFIER "u .. %" G_GINT64_MODIFIER "u)", value, min_len, max_len); + expert_add_info_format_text(actx->pinfo, item, &ei_per_size_constraint_value, "Size constraint: value too big: %" G_GINT64_MODIFIER "u (%" G_GINT64_MODIFIER "u .. %" G_GINT64_MODIFIER "u)", value, min_len, max_len); } else if ((is_signed == TRUE) && ((gint64)value > (gint64)max_len)) { - expert_add_info_format(actx->pinfo, item, PI_PROTOCOL, PI_WARN, "Size constraint: value too big: %" G_GINT64_MODIFIER "d (%" G_GINT64_MODIFIER "d .. %" G_GINT64_MODIFIER "d)", (gint64)value, (gint64)min_len, (gint64)max_len); + expert_add_info_format_text(actx->pinfo, item, &ei_per_size_constraint_value, "Size constraint: value too big: %" G_GINT64_MODIFIER "d (%" G_GINT64_MODIFIER "d .. %" G_GINT64_MODIFIER "d)", (gint64)value, (gint64)min_len, (gint64)max_len); } } static void per_check_items(guint32 cnt, int min_len, int max_len, asn1_ctx_t *actx, proto_item *item) { if (min_len != NO_BOUND && cnt < (guint32)min_len) { - expert_add_info_format(actx->pinfo, item, PI_PROTOCOL, PI_WARN, "Size constraint: too few items: %d (%d .. %d)", cnt, min_len, max_len); + expert_add_info_format_text(actx->pinfo, item, &ei_per_size_constraint_too_few, "Size constraint: too few items: %d (%d .. %d)", cnt, min_len, max_len); } else if (max_len != NO_BOUND && cnt > (guint32)max_len) { - expert_add_info_format(actx->pinfo, item, PI_PROTOCOL, PI_WARN, "Size constraint: too many items: %d (%d .. %d)", cnt, min_len, max_len); + expert_add_info_format_text(actx->pinfo, item, &ei_per_size_constraint_too_many, "Size constraint: too many items: %d (%d .. %d)", cnt, min_len, max_len); } } @@ -1651,7 +1658,7 @@ DEBUG_ENTRY("dissect_per_choice"); } else { offset += ext_length * 8; proto_tree_add_text(tree, tvb, old_offset>>3, BLEN(old_offset, offset), "Choice no. %d in extension", choice_index); - expert_add_info_format(actx->pinfo, choice_item, PI_UNDECODED, PI_NOTE, "unknown choice extension"); + expert_add_info(actx->pinfo, choice_item, &ei_per_choice_extension_unknown); } } @@ -1865,7 +1872,7 @@ DEBUG_ENTRY("dissect_per_sequence"); if(i>=num_known_extensions){ /* we don't know how to decode this extension */ offset+=length*8; - expert_add_info_format(actx->pinfo, item, PI_UNDECODED, PI_NOTE, "unknown sequence extension"); + expert_add_info(actx->pinfo, item, &ei_per_sequence_extension_unknown); continue; } @@ -1889,8 +1896,7 @@ DEBUG_ENTRY("dissect_per_sequence"); if ((length > 1) && (difference > 7)) { cause=proto_tree_add_text(tree, tvb, new_offset>>3, (offset-new_offset)>>3, "[Possible encoding error full length not decoded. Open type length %u ,decoded %u]",length, length - (difference>>3)); - proto_item_set_expert_flags(cause, PI_MALFORMED, PI_WARN); - expert_add_info_format(actx->pinfo, cause, PI_MALFORMED, PI_WARN, + expert_add_info_format_text(actx->pinfo, cause, &ei_per_encoding_error, "Possible encoding error full length not decoded. Open type length %u ,decoded %u",length, length - (difference>>3)); } } else { @@ -2569,11 +2575,23 @@ proto_register_per(void) &ett_per_External, &ett_per_External_encoding, }; + static ei_register_info ei[] = { + { &ei_per_size_constraint_value, { "per.size_constraint.value", PI_PROTOCOL, PI_WARN, "Size constraint: value too big", EXPFILL }}, + { &ei_per_size_constraint_too_few, { "per.size_constraint.too_few", PI_PROTOCOL, PI_WARN, "Size constraint: too few items", EXPFILL }}, + { &ei_per_size_constraint_too_many, { "per.size_constraint.too_many", PI_PROTOCOL, PI_WARN, "Size constraint: too many items", EXPFILL }}, + { &ei_per_choice_extension_unknown, { "per.choice_extension_unknown", PI_UNDECODED, PI_NOTE, "unknown choice extension", EXPFILL }}, + { &ei_per_sequence_extension_unknown, { "per.sequence_extension_unknown", PI_UNDECODED, PI_NOTE, "unknown sequence extension", EXPFILL }}, + { &ei_per_encoding_error, { "per.encoding_error", PI_MALFORMED, PI_WARN, "Encoding error", EXPFILL }}, + }; + module_t *per_module; + expert_module_t* expert_per; proto_per = proto_register_protocol("Packed Encoding Rules (ASN.1 X.691)", "PER", "per"); proto_register_field_array(proto_per, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_per = expert_register_protocol(proto_per); + expert_register_field_array(expert_per, ei, array_length(ei)); proto_set_cant_toggle(proto_per); diff --git a/epan/dissectors/packet-reload.c b/epan/dissectors/packet-reload.c index 95f0ab21ef..81cd125255 100644 --- a/epan/dissectors/packet-reload.c +++ b/epan/dissectors/packet-reload.c @@ -641,6 +641,13 @@ static gint ett_reload_joinreq = -1; static gint ett_reload_joinans = -1; static gint ett_reload_leavereq = -1; +static expert_field ei_reload_truncated_field = EI_INIT; +static expert_field ei_reload_truncated_packet = EI_INIT; +static expert_field ei_reload_computed_len_too_big = EI_INIT; +static expert_field ei_reload_identity_type_unknown = EI_INIT; +static expert_field ei_reload_unknown_data_model = EI_INIT; +static expert_field ei_reload_no_xml_dissector = EI_INIT; + static const fragment_items reload_frag_items = { &ett_reload_fragment, &ett_reload_fragments, @@ -1111,7 +1118,7 @@ dissect_opaque_string_or_data(tvbuff_t *tvb, packet_info *pinfo,proto_tree *tree if (max_field_length > 0) { if ((length + length_size) > max_field_length) { - expert_add_info_format(pinfo, ti_anchor, PI_PROTOCOL, PI_ERROR, "Computed length > max_field length"); + expert_add_info(pinfo, ti_anchor, &ei_reload_computed_len_too_big); length = max_field_length - length_size; } } @@ -1181,7 +1188,7 @@ static int dissect_resourceid(int anchor, tvbuff_t *tvb, packet_info *pinfo, pro /* We don't know the node ID. Just assume that all the data is part of it */ if (length < local_length+1) { ti_local = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated ResourceId"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated ResourceId"); return length; } @@ -1212,7 +1219,7 @@ static int dissect_nodeid(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_t /* We don't know the node ID. Just assume that all the data is part of it */ if (length < reload_nodeid_length) { ti_nodeid = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_nodeid, PI_PROTOCOL, PI_ERROR, "Truncated NodeId"); + expert_add_info_format_text(pinfo, ti_nodeid, &ei_reload_truncated_field, "Truncated NodeId"); return length; } @@ -1287,7 +1294,7 @@ dissect_destination(int anchor, tvbuff_t *tvb, packet_info *pinfo, proto_tree *t proto_tree_add_item(destination_tree, hf_reload_destination_type, tvb, offset, 1, ENC_BIG_ENDIAN); proto_tree_add_uint(destination_tree, hf_reload_length_uint8, tvb, offset+1, 1, destination_length); if (2 + destination_length > length) { - expert_add_info_format(pinfo, ti_destination, PI_PROTOCOL, PI_ERROR, "Truncated Destination"); + expert_add_info_format_text(pinfo, ti_destination, &ei_reload_truncated_field, "Truncated Destination"); return length; } switch(destination_type) { @@ -1340,7 +1347,7 @@ dissect_probe_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g if (probe_length + 2 > length) { ti_probe_information = proto_tree_add_item(tree, hf_reload_probe_information, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_probe_information, PI_PROTOCOL, PI_ERROR, "Truncated probe information"); + expert_add_info_format_text(pinfo, ti_probe_information, &ei_reload_truncated_field, "Truncated probe information"); return length; } ti_probe_information = proto_tree_add_item(tree, hf_reload_probe_information, tvb, offset, 2 + probe_length, ENC_NA); @@ -1359,21 +1366,21 @@ dissect_probe_information(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g switch(type) { case PROBEINFORMATIONTYPE_RESPONSIBLESET: if (probe_length < 4) { - expert_add_info_format(pinfo, ti_probe_information_data, PI_PROTOCOL, PI_ERROR, "Truncated responsible set"); + expert_add_info_format_text(pinfo, ti_probe_information_data, &ei_reload_truncated_field, "Truncated responsible set"); return 2 + probe_length; } proto_tree_add_item(probe_information_data_tree, hf_reload_responsible_set, tvb, offset + 2, 4, ENC_BIG_ENDIAN); break; case PROBEINFORMATIONTYPE_NUMRESOURCES: if (probe_length < 4) { - expert_add_info_format(pinfo, ti_probe_information_data, PI_PROTOCOL, PI_ERROR, "Truncated num resource info"); + expert_add_info_format_text(pinfo, ti_probe_information_data, &ei_reload_truncated_field, "Truncated num resource info"); return 2 + probe_length; } proto_tree_add_item(probe_information_data_tree, hf_reload_num_resources, tvb, offset + 2, 4, ENC_BIG_ENDIAN); break; case PROBEINFORMATIONTYPE_UPTIME: if (probe_length < 4) { - expert_add_info_format(pinfo, ti_probe_information_data, PI_PROTOCOL, PI_ERROR, "Truncated uptime info"); + expert_add_info_format_text(pinfo, ti_probe_information_data, &ei_reload_truncated_field, "Truncated uptime info"); return 2 + probe_length; } proto_tree_add_item(probe_information_data_tree, hf_reload_uptime, tvb, offset + 2, 4, ENC_BIG_ENDIAN); @@ -1463,7 +1470,7 @@ dissect_icecandidates(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint /* Precalculate the length of the icecandidate list */ if (2+icecandidates_length > length) { ti_icecandidates = proto_tree_add_item(tree, hf_reload_icecandidates, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_icecandidates, PI_PROTOCOL, PI_ERROR, "Truncated ice candidates"); + expert_add_info_format_text(pinfo, ti_icecandidates, &ei_reload_truncated_field, "Truncated ice candidates"); return length; } @@ -1510,7 +1517,7 @@ dissect_icecandidates(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint /* icecandidate_offset is now equal to the length of this icecandicate */ if (icecandidates_offset + icecandidate_offset > icecandidates_length) { - expert_add_info_format(pinfo, ti_icecandidates, PI_PROTOCOL, PI_ERROR, "Truncated IceCandidate"); + expert_add_info_format_text(pinfo, ti_icecandidates, &ei_reload_truncated_field, "Truncated IceCandidate"); break; } ti_icecandidate = proto_tree_add_item(icecandidates_tree, hf_reload_icecandidate, tvb, offset+local_offset+ icecandidates_offset, icecandidate_offset, ENC_NA); @@ -1582,7 +1589,7 @@ dissect_icecandidates(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint iceextension_value_length = tvb_get_ntohs(tvb, offset+local_offset+icecandidates_offset+icecandidate_offset+iceextensions_offset+iceextension_name_length + 2); if ((iceextensions_offset + 4 + iceextension_name_length + iceextension_value_length) > iceextensions_length) { - expert_add_info_format(pinfo, ti_extensions, PI_PROTOCOL, PI_ERROR, "Truncated extensions"); + expert_add_info_format_text(pinfo, ti_extensions, &ei_reload_truncated_field, "Truncated extensions"); break; } ti_iceextension = @@ -1624,7 +1631,7 @@ dissect_attachreqans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint1 local_offset += 1; if (local_offset + ufrag_length > length) { ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_attachreqans, PI_PROTOCOL, PI_ERROR, "Truncated attach_reqans"); + expert_add_info_format_text(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans"); return length; } local_offset += ufrag_length; @@ -1632,7 +1639,7 @@ dissect_attachreqans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint1 local_offset += 1; if (local_offset + password_length > length) { ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_attachreqans, PI_PROTOCOL, PI_ERROR, "Truncated attach_reqans"); + expert_add_info_format_text(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans"); return length; } local_offset += password_length; @@ -1640,7 +1647,7 @@ dissect_attachreqans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint1 local_offset += 1; if (local_offset + role_length > length) { ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_attachreqans, PI_PROTOCOL, PI_ERROR, "Truncated attach_reqans"); + expert_add_info_format_text(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans"); return length; } local_offset += role_length; @@ -1648,7 +1655,7 @@ dissect_attachreqans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint1 local_offset += 2; if (local_offset +icecandidates_length > length) { ti_attachreqans = proto_tree_add_item(tree, hf_reload_attachreqans, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_attachreqans, PI_PROTOCOL, PI_ERROR, "Truncated attach_reqans"); + expert_add_info_format_text(pinfo, ti_attachreqans, &ei_reload_truncated_field, "Truncated attach_reqans"); return length; } local_offset += icecandidates_length; @@ -1769,7 +1776,7 @@ static int dissect_redirserviceprovider(tvbuff_t *tvb, packet_info *pinfo, proto if (2+length_field>length) { ti_local = proto_tree_add_item(tree, hf_reload_redirserviceprovider, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated RedirServiceProvider"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated RedirServiceProvider"); return length; } @@ -1798,7 +1805,7 @@ static int dissect_datavalue(int anchor, tvbuff_t *tvb, packet_info *pinfo, prot if (1+4+value_length > length) { ti_datavalue = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_datavalue, PI_PROTOCOL, PI_ERROR, "Truncated DataValue"); + expert_add_info_format_text(pinfo, ti_datavalue, &ei_reload_truncated_field, "Truncated DataValue"); return length; } @@ -1878,7 +1885,7 @@ static int dissect_datavalue(int anchor, tvbuff_t *tvb, packet_info *pinfo, prot if (1+4+1+1+hash_length > length) { ti_datavalue = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_datavalue, PI_PROTOCOL, PI_ERROR, "Truncated MetaData"); + expert_add_info_format_text(pinfo, ti_datavalue, &ei_reload_truncated_field, "Truncated MetaData"); return length; } @@ -1922,7 +1929,7 @@ static int dissect_arrayentry(int anchor, tvbuff_t *tvb, packet_info *pinfo, pro if (4+data_length > length) { ti_arrayentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_arrayentry, PI_PROTOCOL, PI_ERROR, "Truncated ArrayEntry"); + expert_add_info_format_text(pinfo, ti_arrayentry, &ei_reload_truncated_field, "Truncated ArrayEntry"); return length; } @@ -1954,7 +1961,7 @@ static int dissect_dictionaryentry(int anchor, tvbuff_t *tvb, packet_info *pinfo if (length < 2) { ti_dictionaryentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_dictionaryentry, PI_PROTOCOL, PI_ERROR, "Truncated ArrayEntry"); + expert_add_info_format_text(pinfo, ti_dictionaryentry, &ei_reload_truncated_field, "Truncated ArrayEntry"); return length; } key_length = get_opaque_length(tvb,offset,2); @@ -1962,7 +1969,7 @@ static int dissect_dictionaryentry(int anchor, tvbuff_t *tvb, packet_info *pinfo if (length < (key_length +2)) { ti_dictionaryentry = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_dictionaryentry, PI_PROTOCOL, PI_ERROR, "Truncated ArrayEntry"); + expert_add_info_format_text(pinfo, ti_dictionaryentry, &ei_reload_truncated_field, "Truncated ArrayEntry"); return length; } @@ -2080,7 +2087,7 @@ dissect_signature(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 o certificate_hash_length = tvb_get_guint8(tvb, offset + local_offset + 1); if (1 + 1 + certificate_hash_length > signeridentityvalue_length) { - expert_add_info_format(pinfo, ti_signeridentity, PI_PROTOCOL, PI_ERROR, "Truncated signature identity value"); + expert_add_info_format_text(pinfo, ti_signeridentity, &ei_reload_truncated_field, "Truncated signature identity value"); } else { ti_signeridentityvalue= proto_tree_add_item(signeridentity_identity_tree, @@ -2099,7 +2106,7 @@ dissect_signature(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 o } } else { - expert_add_info_format(pinfo, signeridentity_identity_tree, PI_PROTOCOL, PI_ERROR, "Unknown identity type"); + expert_add_info(pinfo, signeridentity_identity_tree, &ei_reload_identity_type_unknown); } } } @@ -2130,7 +2137,7 @@ dissect_storeddata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 if (storeddata_length + 4 > length) { ti_storeddata = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_storeddata, PI_PROTOCOL, PI_ERROR, "Truncated StoredData"); + expert_add_info_format_text(pinfo, ti_storeddata, &ei_reload_truncated_field, "Truncated StoredData"); return length; } @@ -2170,7 +2177,7 @@ dissect_storeddata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 local_offset += dissect_dictionaryentry(hf_reload_value,tvb, pinfo, storeddata_tree, offset+local_offset, (storeddata_length-local_offset+4), meta, kind); break; default: - expert_add_info_format(pinfo, ti_storeddata, PI_PROTOCOL, PI_ERROR, "Unknown Data Model"); + expert_add_info(pinfo, ti_storeddata, &ei_reload_unknown_data_model); return (storeddata_length + 4); } if (TRUE != meta) { @@ -2223,7 +2230,7 @@ dissect_kinddata(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 of values_length = tvb_get_ntohl(tvb, offset + 4 + 8); if (12 + values_length > length) { ti_kinddata = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_kinddata, PI_PROTOCOL, PI_ERROR, "Truncated kind data"); + expert_add_info_format_text(pinfo, ti_kinddata, &ei_reload_truncated_field, "Truncated kind data"); return length; } ti_kinddata = proto_tree_add_item(tree, hf, tvb, offset, 16+values_length, ENC_NA); @@ -2279,7 +2286,7 @@ static int dissect_nodeid_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if (list_length+length_size>length) { ti_local = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated NodeId list"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated NodeId list"); } ti_local = proto_tree_add_item(tree, hf, tvb, offset, list_length+length_size, ENC_NA); proto_item_append_text(ti_local, " (NodeId<%d>)", list_length); @@ -2315,7 +2322,7 @@ dissect_storekindresponse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g if (length < local_length) { ti_local = proto_tree_add_item(tree, hf_reload_storekindresponse, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated StoreKindResponse"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated StoreKindResponse"); return length; } ti_local = proto_tree_add_item(tree, hf_reload_storekindresponse, tvb, offset, 4+8+2+replicas_length, ENC_NA); @@ -2372,14 +2379,14 @@ dissect_storereq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 of local_offset += get_opaque_length(tvb, offset, 1) + 1; /* resource id length */ if (local_offset > length) { ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_storereq, PI_PROTOCOL, PI_ERROR, "Truncated StoreReq: resource too long"); + expert_add_info_format_text(pinfo, ti_storereq, &ei_reload_truncated_field, "Truncated StoreReq: resource too long"); return length; } local_offset += 1; /* replica_num */ if (local_offset > length) { ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_storereq, PI_PROTOCOL, PI_ERROR, "Truncated StoreReq: no room for replica_number"); + expert_add_info_format_text(pinfo, ti_storereq, &ei_reload_truncated_field, "Truncated StoreReq: no room for replica_number"); return length; } @@ -2387,7 +2394,7 @@ dissect_storereq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 of local_offset += 4; if (local_offset + kind_data_length > length) { ti_storereq = proto_tree_add_item(tree, hf_reload_storereq, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_storereq, PI_PROTOCOL, PI_ERROR, "Truncated StoreReq: kind_data too long"); + expert_add_info_format_text(pinfo, ti_storereq, &ei_reload_truncated_field, "Truncated StoreReq: kind_data too long"); return length; } local_offset += kind_data_length; @@ -2462,7 +2469,7 @@ dissect_storeddataspecifier(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, length_field = tvb_get_ntohs(tvb, offset+4+8); if ((length_field + 4 + 8 + 2) > length) { ti_storeddataspecifier = proto_tree_add_item(tree, hf_reload_storeddataspecifier, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_storeddataspecifier, PI_PROTOCOL, PI_ERROR, "Truncated StoredDataSpecifier"); + expert_add_info_format_text(pinfo, ti_storeddataspecifier, &ei_reload_truncated_field, "Truncated StoredDataSpecifier"); return length; } @@ -2551,7 +2558,7 @@ dissect_fetchreq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 of if (1+ resourceid_length+ 2 + specifiers_length > length) { ti_fetchreq = proto_tree_add_item(tree, hf, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_fetchreq, PI_PROTOCOL, PI_ERROR, "Truncated FetchReq"); + expert_add_info_format_text(pinfo, ti_fetchreq, &ei_reload_truncated_field, "Truncated FetchReq"); return length; } local_length = 1+ resourceid_length+ 2 + specifiers_length; @@ -2593,7 +2600,7 @@ dissect_fetchans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 of kind_responses_length = tvb_get_ntohl(tvb, offset); if (4 + kind_responses_length > length) { ti_fetchans = proto_tree_add_item(tree, hf_reload_fetchans, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_fetchans, PI_PROTOCOL, PI_ERROR, "Truncated FetchAns"); + expert_add_info_format_text(pinfo, ti_fetchans, &ei_reload_truncated_field, "Truncated FetchAns"); return length; } ti_fetchans = proto_tree_add_item(tree, hf_reload_fetchans, tvb, offset, 4 + kind_responses_length, ENC_NA); @@ -2627,7 +2634,7 @@ dissect_statans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint16 off if (4 + kind_responses_length > length) { ti_statans = proto_tree_add_item(tree, hf_reload_statans, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_statans, PI_PROTOCOL, PI_ERROR, "Truncated StatAns"); + expert_add_info_format_text(pinfo, ti_statans, &ei_reload_truncated_field, "Truncated StatAns"); return length; } ti_statans = proto_tree_add_item(tree, hf_reload_statans, tvb, offset, 4 + kind_responses_length, ENC_NA); @@ -2744,7 +2751,7 @@ static int dissect_kindid_list(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tr if ((guint16)length<kinds_length+length_size) { ti_local = proto_tree_add_item(tree, hf_reload_kindid_list, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated kinds list"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated kinds list"); } ti_local = proto_tree_add_item(tree, hf_reload_kindid_list, tvb, offset, length, ENC_NA); local_tree = proto_item_add_subtree(ti_local, ett_reload_kindid_list); @@ -2788,7 +2795,7 @@ static int dissect_findans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, results_length = tvb_get_ntohs(tvb, offset); proto_item_append_text(ti_local, " (FindKindData<%d>)", results_length); if (results_length + 2 > length) { - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated FindAns"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated FindAns"); } proto_tree_add_uint(local_tree, hf_reload_length_uint16, tvb, offset, 2, results_length); @@ -2803,7 +2810,7 @@ static int dissect_findans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, findkinddata_length = 4/*kind id */ + 1 + get_opaque_length(tvb,offset + 2 + results_offset + 4, 1)/* resourceId */; if (results_offset + findkinddata_length > results_length) { ti_findkinddata = proto_tree_add_item(local_tree, hf_reload_findkinddata, tvb, offset + results_offset, results_length - results_offset, ENC_NA); - expert_add_info_format(pinfo, ti_findkinddata, PI_PROTOCOL, PI_ERROR, "Truncated FindKindData"); + expert_add_info_format_text(pinfo, ti_findkinddata, &ei_reload_truncated_field, "Truncated FindKindData"); break; } @@ -2858,7 +2865,7 @@ static int dissect_extensiveroutingmodeoption(tvbuff_t *tvb, packet_info *pinfo, int nDestinations = 0; destination_length = tvb_get_guint8(tvb, offset+local_offset); if (destination_length+1+local_offset>length) { - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated ExtensiveRoutingModeOption"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated ExtensiveRoutingModeOption"); destination_length = length -1-local_offset; } ti_destination = proto_tree_add_item(local_tree, hf_reload_extensiveroutingmode_destination, tvb,offset+local_offset, 1+destination_length, ENC_NA); @@ -2902,7 +2909,7 @@ static int dissect_forwardingoption(tvbuff_t *tvb, packet_info *pinfo, proto_tre proto_tree_add_uint(option_tree, hf_reload_length_uint16, tvb, offset+local_offset+2, 2, option_length); local_offset += 4; if (local_offset + option_length > length) { - expert_add_info_format(pinfo, ti_option, PI_PROTOCOL, PI_ERROR, "Truncated ForwardingOption"); + expert_add_info_format_text(pinfo, ti_option, &ei_reload_truncated_field, "Truncated ForwardingOption"); return length; } @@ -2980,7 +2987,7 @@ static int dissect_diagnosticrequest(int anchor, tvbuff_t *tvb, packet_info *pin local_offset += 4; if (local_offset+local_length > length) { - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated DiagnosticRequest"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated DiagnosticRequest"); local_length = length-local_offset; } if (local_length>0) { @@ -2994,7 +3001,7 @@ static int dissect_diagnosticrequest(int anchor, tvbuff_t *tvb, packet_info *pin extensions_tree = proto_item_add_subtree(ti_extensions, ett_reload_diagnosticrequest_extensions); extensions_length = tvb_get_ntohl(tvb, offset+local_offset); if (extensions_length+4 > local_length) { - expert_add_info_format(pinfo, ti_extensions, PI_PROTOCOL, PI_ERROR, "Truncated Diagnostic extensions"); + expert_add_info_format_text(pinfo, ti_extensions, &ei_reload_truncated_field, "Truncated Diagnostic extensions"); extensions_length = local_length-4; } proto_item_append_text(ti_extensions, " (DiagnosticExtension<%d>)",extensions_length); @@ -3221,7 +3228,7 @@ static int dissect_diagnosticresponse(int anchor, tvbuff_t *tvb, packet_info *pi diagnostics_length = tvb_get_ntohl(tvb, offset+local_offset); if (diagnostics_length+local_offset+4>length) { - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated Diagnostic Response"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated Diagnostic Response"); diagnostics_length = length -4 -local_offset; } ti_diagnostics = proto_tree_add_item(local_tree, hf_reload_diagnosticresponse_diagnostic_info_list, tvb, offset+local_offset, diagnostics_length, ENC_NA); @@ -3334,7 +3341,7 @@ static int dissect_probereq(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree_add_uint(requested_info_tree, hf_reload_length_uint8, tvb, offset, 1, info_list_length); if ((info_list_length+1) > length) { - expert_add_info_format(pinfo, ti_requested_info, PI_PROTOCOL, PI_ERROR, "Truncated requested_info"); + expert_add_info_format_text(pinfo, ti_requested_info, &ei_reload_truncated_field, "Truncated requested_info"); info_list_length = length - 1; } { @@ -3363,7 +3370,7 @@ static int dissect_probeans(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, info_list_length = tvb_get_ntohs(tvb, offset); if (info_list_length+2 >length) { - expert_add_info_format(pinfo, ti_local, PI_PROTOCOL, PI_ERROR, "Truncated ProbeAns"); + expert_add_info_format_text(pinfo, ti_local, &ei_reload_truncated_field, "Truncated ProbeAns"); info_list_length = length - 2; } ti_infos = proto_tree_add_item(local_tree, hf_reload_probeans_probe_info, tvb, offset, info_list_length, ENC_NA); @@ -3399,7 +3406,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr if (2 + 4 + message_body_length + 4 + extensions_length > length) { ti_message_contents = proto_tree_add_item(tree, hf_reload_message_contents, tvb, offset, length, ENC_NA); - expert_add_info_format(pinfo, ti_message_contents, PI_PROTOCOL, PI_ERROR, "Truncated MessageContents"); + expert_add_info_format_text(pinfo, ti_message_contents, &ei_reload_truncated_field, "Truncated MessageContents"); return length; } @@ -3517,7 +3524,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr else { message_type_str = "PingAns"; if (message_body_length < 16) { - expert_add_info_format(pinfo, ti_message_contents, PI_PROTOCOL, PI_ERROR, "Truncated ping answer"); + expert_add_info_format_text(pinfo, ti_message_contents, &ei_reload_truncated_field, "Truncated ping answer"); } else { proto_item *ti_local; @@ -3564,7 +3571,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr configupdate_length = tvb_get_ntohl(tvb, offset + local_offset); proto_tree_add_uint(configupdate_tree, hf_reload_length_uint32, tvb, offset + local_offset, 4, configupdate_length); if (5 + configupdate_length > message_body_length) { - expert_add_info_format(pinfo, ti_configupdate, PI_PROTOCOL, PI_ERROR, "Truncated ConfigUpdateReq"); + expert_add_info_format_text(pinfo, ti_configupdate, &ei_reload_truncated_field, "Truncated ConfigUpdateReq"); break; } local_offset += 4; @@ -3573,7 +3580,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr { if (xml_handle == NULL) { - expert_add_info_format(pinfo, ti_configupdate, PI_PROTOCOL, PI_WARN, "Can not find xml dissector"); + expert_add_info(pinfo, ti_configupdate, &ei_reload_no_xml_dissector); dissect_opaque_string(tvb, pinfo, configupdate_tree, hf_reload_configupdatereq_configdata, offset+local_offset, 3, configupdate_length); } else { @@ -3609,7 +3616,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr while (kinds_offset < kinds_length) { guint16 local_increment = tvb_get_ntohs(tvb,offset+local_offset+kinds_offset); if (xml_handle == NULL) { - expert_add_info_format(pinfo, ti_configupdate, PI_PROTOCOL, PI_WARN, "Can not find xml dissector"); + expert_add_info(pinfo, ti_configupdate, &ei_reload_no_xml_dissector); dissect_opaque_string(tvb, pinfo, configupdate_tree, hf_reload_kinddescription, offset+local_offset+kinds_offset, 2, configupdate_length); } @@ -3782,7 +3789,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr error_code = tvb_get_ntohs(tvb, offset); if (2 + 2 + error_length >length) { - expert_add_info_format(pinfo, ti_message_body, PI_PROTOCOL, PI_ERROR, "Truncated error message"); + expert_add_info_format_text(pinfo, ti_message_body, &ei_reload_truncated_field, "Truncated error message"); return length; } @@ -3844,7 +3851,7 @@ extern gint dissect_reload_messagecontents(tvbuff_t *tvb, packet_info *pinfo, pr proto_item *ti_extension; guint32 extension_content_length = tvb_get_ntohl(tvb, offset + extension_offset + 3); if ((extension_offset + 3 + 4 + extension_content_length) > extensions_length) { - expert_add_info_format(pinfo, ti_extensions, PI_PROTOCOL, PI_ERROR, "Truncated message extensions"); + expert_add_info_format_text(pinfo, ti_extensions, &ei_reload_truncated_field, "Truncated message extensions"); break; } ti_extension = proto_tree_add_item(extensions_tree, hf_reload_message_extension, tvb, offset+ extension_offset, 3 + 4 + extension_content_length, ENC_NA); @@ -4054,7 +4061,7 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += MIN_HDR_LENGTH; if (((guint)offset + via_list_length) > msg_length) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_ERROR, "Truncated RELOAD packet"); + expert_add_info(pinfo, ti, &ei_reload_truncated_packet); return MIN_HDR_LENGTH; } @@ -4071,7 +4078,7 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += via_list_length; if (((guint)offset + destination_list_length) > msg_length) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_ERROR, "Truncated RELOAD packet"); + expert_add_info(pinfo, ti, &ei_reload_truncated_packet); return offset; } @@ -4090,7 +4097,7 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) offset += destination_list_length; if (((guint)offset + options_length) > msg_length) { - expert_add_info_format(pinfo, ti, PI_PROTOCOL, PI_ERROR, "Truncated RELOAD packet"); + expert_add_info(pinfo, ti, &ei_reload_truncated_packet); return offset; } @@ -4151,7 +4158,7 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) effective_length = tvb_length(tvb); if (effective_length < msg_length) { /* The effective length is too small for the packet */ - expert_add_info_format(pinfo, NULL, PI_PROTOCOL, PI_ERROR, "Truncated RELOAD packet"); + expert_add_info(pinfo, NULL, &ei_reload_truncated_packet); return 0; } @@ -4296,7 +4303,7 @@ dissect_reload_message(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) certificate_length = tvb_get_ntohs(tvb, offset + security_block_offset + certificate_offset + 1); if (certificate_offset + 1 + 2 + certificate_length > certificates_length) { - expert_add_info_format(pinfo, ti_security_block, PI_PROTOCOL, PI_ERROR, "Truncated certificate"); + expert_add_info_format_text(pinfo, ti_security_block, &ei_reload_truncated_field, "Truncated certificate"); break; } ti_genericcertificate = @@ -4364,6 +4371,7 @@ void proto_register_reload(void) { module_t *reload_module; + expert_module_t* expert_reload; static hf_register_info hf[] = { { &hf_reload_response_in, { "Response in", "reload.response-in", FT_FRAMENUM, @@ -5862,6 +5870,15 @@ proto_register_reload(void) &ett_reload_leavereq, }; + static ei_register_info ei[] = { + { &ei_reload_truncated_field, { "reload.truncated_field", PI_PROTOCOL, PI_ERROR, "Truncated field", EXPFILL }}, + { &ei_reload_truncated_packet, { "reload.truncated_packet", PI_PROTOCOL, PI_ERROR, "Truncated RELOAD packet", EXPFILL }}, + { &ei_reload_computed_len_too_big, { "reload.computed_len_too_big", PI_PROTOCOL, PI_ERROR, "Computed length > max_field length", EXPFILL }}, + { &ei_reload_identity_type_unknown, { "reload.signature.identity.type.unknown", PI_PROTOCOL, PI_ERROR, "Unknown identity type", EXPFILL }}, + { &ei_reload_unknown_data_model, { "reload.unknown_data_model", PI_PROTOCOL, PI_ERROR, "Unknown Data Model", EXPFILL }}, + { &ei_reload_no_xml_dissector, { "reload.no_xml_dissector", PI_PROTOCOL, PI_ERROR, "Can not find xml dissector", EXPFILL }}, + }; + static uat_field_t reloadkindidlist_uats_flds[] = { UAT_FLD_DEC(kindidlist_uats,id,"Kind-ID Number","Custom Kind-ID Number"), UAT_FLD_CSTRING(kindidlist_uats,name,"Kind-ID Name","Custom Kind-ID Name"), @@ -5876,6 +5893,8 @@ proto_register_reload(void) /* Required function calls to register the header fields and subtrees used */ proto_register_field_array(proto_reload, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_reload = expert_register_protocol(proto_reload); + expert_register_field_array(expert_reload, ei, array_length(ei)); reload_module = prefs_register_protocol(proto_reload, NULL); diff --git a/epan/dissectors/packet-rpcap.c b/epan/dissectors/packet-rpcap.c index 4f4f248a51..c02fcf8d4c 100644 --- a/epan/dissectors/packet-rpcap.c +++ b/epan/dissectors/packet-rpcap.c @@ -220,6 +220,11 @@ static gint ett_findalldevs_ifaddr = -1; static gint ett_ifaddr = -1; static gint ett_sampling_request = -1; +static expert_field ei_error = EI_INIT; +static expert_field ei_if_unknown = EI_INIT; +static expert_field ei_no_more_data = EI_INIT; +static expert_field ei_caplen_too_big = EI_INIT; + static dissector_handle_t data_handle; /* User definable values */ @@ -386,13 +391,11 @@ dissect_rpcap_error (tvbuff_t *tvb, packet_info *pinfo, if (len <= 0) return; - if (check_col (pinfo->cinfo, COL_INFO)) { - col_append_fstr (pinfo->cinfo, COL_INFO, ": %s", + col_append_fstr (pinfo->cinfo, COL_INFO, ": %s", tvb_format_text_wsp (tvb, offset, len)); - } ti = proto_tree_add_item (parent_tree, hf_error, tvb, offset, len, ENC_ASCII|ENC_NA); - expert_add_info_format (pinfo, ti, PI_SEQUENCE, PI_NOTE, + expert_add_info_format_text(pinfo, ti, &ei_error, "Error: %s", tvb_format_text_wsp (tvb, offset, len)); } @@ -433,7 +436,7 @@ dissect_rpcap_ifaddr (tvbuff_t *tvb, packet_info *pinfo, } else { ti = proto_tree_add_item (tree, hf_if_unknown, tvb, offset, 126, ENC_NA); if (af != AF_UNSPEC) { - expert_add_info_format (pinfo, ti, PI_UNDECODED, PI_CHAT, + expert_add_info_format_text(pinfo, ti, &ei_if_unknown, "Unknown address family: %d", af); } offset += 126; @@ -510,7 +513,7 @@ dissect_rpcap_findalldevs_if (tvbuff_t *tvb, packet_info *pinfo _U_, offset = dissect_rpcap_findalldevs_ifaddr (tvb, pinfo, tree, offset); if (tvb_length_remaining (tvb, offset) < 0) { /* No more data in packet */ - expert_add_info_format (pinfo, ti, PI_MALFORMED, PI_ERROR, "No more data in packet"); + expert_add_info(pinfo, ti, &ei_no_more_data); break; } } @@ -536,7 +539,7 @@ dissect_rpcap_findalldevs_reply (tvbuff_t *tvb, packet_info *pinfo _U_, offset = dissect_rpcap_findalldevs_if (tvb, pinfo, tree, offset); if (tvb_length_remaining (tvb, offset) < 0) { /* No more data in packet */ - expert_add_info_format (pinfo, ti, PI_MALFORMED, PI_ERROR, "No more data in packet"); + expert_add_info(pinfo, ti, &ei_no_more_data); break; } } @@ -625,7 +628,7 @@ dissect_rpcap_filter (tvbuff_t *tvb, packet_info *pinfo, offset = dissect_rpcap_filterbpf_insn (tvb, pinfo, tree, offset); if (tvb_length_remaining (tvb, offset) < 0) { /* No more data in packet */ - expert_add_info_format (pinfo, ti, PI_MALFORMED, PI_ERROR, "No more data in packet"); + expert_add_info(pinfo, ti, &ei_no_more_data); break; } } @@ -878,8 +881,7 @@ dissect_rpcap_packet (tvbuff_t *tvb, packet_info *pinfo, proto_tree *top_tree, */ reported_length_remaining = tvb_length_remaining (tvb, offset); if (caplen > (guint)reported_length_remaining) { - expert_add_info_format (pinfo, ti, PI_MALFORMED, PI_ERROR, - "Caplen is bigger than the remaining message length"); + expert_add_info(pinfo, ti, &ei_caplen_too_big); return; } @@ -1430,10 +1432,20 @@ proto_register_rpcap (void) &ett_sampling_request }; + static ei_register_info ei[] = { + { &ei_error, { "rpcap.error.expert", PI_SEQUENCE, PI_NOTE, "Error", EXPFILL }}, + { &ei_if_unknown, { "rpcap.if_unknown", PI_SEQUENCE, PI_NOTE, "Unknown address family", EXPFILL }}, + { &ei_no_more_data, { "rpcap.no_more_data", PI_MALFORMED, PI_ERROR, "No more data in packet", EXPFILL }}, + { &ei_caplen_too_big, { "rpcap.caplen_too_big", PI_MALFORMED, PI_ERROR, "Caplen is bigger than the remaining message length", EXPFILL }}, + }; + module_t *rpcap_module; + expert_module_t* expert_rpcap; proto_rpcap = proto_register_protocol (PNAME, PSNAME, PFNAME); register_dissector (PFNAME, dissect_rpcap, proto_rpcap); + expert_rpcap = expert_register_protocol(proto_rpcap); + expert_register_field_array(expert_rpcap, ei, array_length(ei)); proto_register_field_array (proto_rpcap, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); |