From 8b0e9c66728f6a39bbe3ada1029e13ad1378013a Mon Sep 17 00:00:00 2001 From: Michael Mann Date: Thu, 21 Jul 2016 10:21:25 -0400 Subject: Follow up for proto_tree_add_checksum. Fill in the "gaps" so that all dissectors that verify checksums have both a status and expert info field. Also address comments from original proto_tree_add_checksum patch that didn't make it. Ping-Bug: 8859 Change-Id: I2e6640108fd6bb218cb959fe9e4ba98a13e43a2f Reviewed-on: https://code.wireshark.org/review/16590 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-carp.c | 24 ++++++++++++++++---- epan/dissectors/packet-cattp.c | 17 +++++++++++--- epan/dissectors/packet-cdp.c | 5 ++++- epan/dissectors/packet-chdlc.c | 2 +- epan/dissectors/packet-clnp.c | 12 +++++++--- epan/dissectors/packet-dccp.c | 6 +++-- epan/dissectors/packet-dec-dnart.c | 21 ++++++++++++++--- epan/dissectors/packet-dmx.c | 13 ++++++++++- epan/dissectors/packet-dvb-s2-bb.c | 22 ++++++++++++++++-- epan/dissectors/packet-dvmrp.c | 16 +++++++++++-- epan/dissectors/packet-eigrp.c | 5 ++++- epan/dissectors/packet-epon.c | 7 +++++- epan/dissectors/packet-esis.c | 10 +++++++-- epan/dissectors/packet-extreme.c | 6 +++-- epan/dissectors/packet-fc.c | 5 ++++- epan/dissectors/packet-gre.c | 10 +++++++-- epan/dissectors/packet-h223.c | 14 +++++++++++- epan/dissectors/packet-hip.c | 13 ++++++++--- epan/dissectors/packet-icmp.c | 12 +++++----- epan/dissectors/packet-ieee80211.c | 9 ++++++-- epan/dissectors/packet-igap.c | 12 +++++++++- epan/dissectors/packet-igmp.c | 32 +++++++++++++++++--------- epan/dissectors/packet-igmp.h | 2 +- epan/dissectors/packet-isis-hello.c | 10 ++++++--- epan/dissectors/packet-isis-snp.c | 12 +++++++--- epan/dissectors/packet-kingfisher.c | 16 ++++++++++++- epan/dissectors/packet-lmp.c | 10 ++++++--- epan/dissectors/packet-mbtcp.c | 10 +++++++-- epan/dissectors/packet-mrdisc.c | 18 +++++++++++---- epan/dissectors/packet-msnip.c | 20 ++++++++++++----- epan/dissectors/packet-mtp2.c | 4 +++- epan/dissectors/packet-nhrp.c | 15 ++++++++++--- epan/dissectors/packet-ositp.c | 21 ++++++++++++----- epan/dissectors/packet-pgm.c | 12 ++++++---- epan/dissectors/packet-pim.c | 40 ++++++++++++++++++++++++--------- epan/dissectors/packet-ppp.c | 27 +++++++++++++--------- epan/dissectors/packet-ppp.h | 2 +- epan/dissectors/packet-rdm.c | 16 ++++++++++--- epan/dissectors/packet-rfid-pn532-hci.c | 25 ++++++++++++++------- epan/dissectors/packet-rgmp.c | 13 ++++++++++- epan/dissectors/packet-synphasor.c | 8 +++++-- epan/dissectors/packet-sysex.c | 6 ++++- epan/dissectors/packet-teamspeak2.c | 34 +++++++++++++++++++--------- epan/dissectors/packet-udp.c | 11 ++++----- epan/dissectors/packet-v5dl.c | 18 +++++++++++---- epan/dissectors/packet-xip-serval.c | 7 +++++- epan/dissectors/packet-xtp.c | 19 +++++++++++----- epan/dissectors/packet-zrtp.c | 15 ++++++++++++- epan/proto.c | 28 +++-------------------- 49 files changed, 515 insertions(+), 177 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-carp.c b/epan/dissectors/packet-carp.c index a5a276d529..2243728cee 100644 --- a/epan/dissectors/packet-carp.c +++ b/epan/dissectors/packet-carp.c @@ -26,6 +26,7 @@ #include #include +#include #include void proto_register_carp(void); @@ -46,6 +47,9 @@ static gint hf_carp_advbase = -1; static gint hf_carp_counter = -1; static gint hf_carp_hmac = -1; static gint hf_carp_checksum = -1; +static gint hf_carp_checksum_status = -1; + +static expert_field ei_carp_checksum = EI_INIT; #define CARP_VERSION_MASK 0xf0 #define CARP_TYPE_MASK 0x0f @@ -137,10 +141,10 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) /* The packet isn't part of a fragmented datagram and isn't truncated, so we can checksum it. */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, carp_len); - proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, -1, NULL, pinfo, in_cksum(&cksum_vec[0], 1), + proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, hf_carp_checksum_status, &ei_carp_checksum, pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, hf_carp_checksum_status, &ei_carp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset+=2; @@ -222,6 +226,11 @@ void proto_register_carp(void) {"Checksum", "carp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + + { &hf_carp_checksum_status, + {"Checksum Status", "carp.checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL }}, }; static gint *ett[] = { @@ -229,10 +238,17 @@ void proto_register_carp(void) &ett_carp_ver_type }; - proto_carp = proto_register_protocol("Common Address Redundancy Protocol", - "CARP", "carp"); + static ei_register_info ei[] = { + { &ei_carp_checksum, { "carp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_carp; + + proto_carp = proto_register_protocol("Common Address Redundancy Protocol", "CARP", "carp"); proto_register_field_array(proto_carp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_carp = expert_register_protocol(proto_carp); + expert_register_field_array(expert_carp, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-cattp.c b/epan/dissectors/packet-cattp.c index 10e489c536..9237e5a4f5 100644 --- a/epan/dissectors/packet-cattp.c +++ b/epan/dissectors/packet-cattp.c @@ -28,6 +28,7 @@ #include #include +#include #include #define CATTP_SHORTNAME "CAT-TP" @@ -97,6 +98,8 @@ static int hf_cattp_rc = -1; static int hf_cattp_eaklen = -1; static int hf_cattp_eaks = -1; +static expert_field ei_cattp_checksum = EI_INIT; + /* Preference to control whether to check the CATTP checksum */ static gboolean cattp_check_checksum = TRUE; @@ -296,14 +299,15 @@ dissect_cattp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U cksum_data_len = hlen + plen; if (!cattp_check_checksum) { /* We have turned checksum checking off; we do NOT checksum it. */ - proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, &ei_cattp_checksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } else { /* We haven't turned checksum checking off; checksum it. */ /* Unlike TCP, CATTP does not make use of a pseudo-header for checksum */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, header_offset, cksum_data_len); - proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, NULL, pinfo, in_cksum(cksum_vec, 1), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(cattp_tree, tvb, offset, hf_cattp_checksum, hf_cattp_checksum_status, &ei_cattp_checksum, + pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } /* End of checksum code */ offset += 2; @@ -538,7 +542,12 @@ proto_register_cattp(void) &ett_cattp_eaks }; + static ei_register_info ei[] = { + { &ei_cattp_checksum, { "cattp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + module_t *cattp_module; + expert_module_t* expert_cattp; proto_cattp = proto_register_protocol ( "ETSI Card Application Toolkit Transport Protocol", /* name */ @@ -548,6 +557,8 @@ proto_register_cattp(void) proto_register_field_array(proto_cattp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_cattp = expert_register_protocol(proto_cattp); + expert_register_field_array(expert_cattp, ei, array_length(ei)); cattp_module = prefs_register_protocol(proto_cattp, proto_reg_handoff_cattp); prefs_register_bool_preference(cattp_module, "checksum", diff --git a/epan/dissectors/packet-cdp.c b/epan/dissectors/packet-cdp.c index b61a7097cc..9cd59d06cb 100644 --- a/epan/dissectors/packet-cdp.c +++ b/epan/dissectors/packet-cdp.c @@ -145,6 +145,7 @@ static gint ett_cdp_checksum = -1; static expert_field ei_cdp_invalid_data = EI_INIT; static expert_field ei_cdp_nrgyz_tlvlength = EI_INIT; +static expert_field ei_cdp_checksum = EI_INIT; static int dissect_address_tlv(tvbuff_t *tvb, int offset, int length, proto_tree *tree); @@ -336,7 +337,7 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, data_length); } - proto_tree_add_checksum(cdp_tree, tvb, offset, hf_cdp_checksum, hf_cdp_checksum_status, NULL, pinfo, in_cksum(cksum_vec, 1), + proto_tree_add_checksum(cdp_tree, tvb, offset, hf_cdp_checksum, hf_cdp_checksum_status, &ei_cdp_checksum, pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); offset += 2; @@ -1424,7 +1425,9 @@ proto_register_cdp(void) static ei_register_info ei[] = { { &ei_cdp_invalid_data, { "cdp.invalid_data", PI_MALFORMED, PI_ERROR, "Invalid bytes at end", EXPFILL }}, { &ei_cdp_nrgyz_tlvlength, { "cdp.nrgyz_tlv.length.invalid", PI_MALFORMED, PI_ERROR, "TLV with invalid length", EXPFILL }}, + { &ei_cdp_checksum, { "cdp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; + expert_module_t* expert_cdp; proto_cdp = proto_register_protocol("Cisco Discovery Protocol", "CDP", "cdp"); diff --git a/epan/dissectors/packet-chdlc.c b/epan/dissectors/packet-chdlc.c index be543d87b6..2576349bff 100644 --- a/epan/dissectors/packet-chdlc.c +++ b/epan/dissectors/packet-chdlc.c @@ -194,7 +194,7 @@ dissect_chdlc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U proto_tree_add_item(fh_tree, hf_chdlc_control, tvb, 1, 1, ENC_NA); } - decode_fcs(tvb, fh_tree, chdlc_fcs_decode, 2); + decode_fcs(tvb, pinfo, fh_tree, chdlc_fcs_decode, 2); chdlctype(proto, tvb, 4, pinfo, tree, fh_tree, hf_chdlc_proto); return tvb_captured_length(tvb); diff --git a/epan/dissectors/packet-clnp.c b/epan/dissectors/packet-clnp.c index 94b95cb54c..93774718b4 100644 --- a/epan/dissectors/packet-clnp.c +++ b/epan/dissectors/packet-clnp.c @@ -60,6 +60,7 @@ static int hf_clnp_data_unit_identifier = -1; static int hf_clnp_segment_offset = -1; static int hf_clnp_total_length = -1; static int hf_clnp_checksum = -1; +static int hf_clnp_checksum_status = -1; static int hf_clnp_dest_length = -1; static int hf_clnp_dest = -1; static int hf_clnp_src_length = -1; @@ -96,6 +97,7 @@ static const fragment_items clnp_frag_items = { }; static expert_field ei_clnp_length = EI_INIT; +static expert_field ei_clnp_checksum = EI_INIT; static dissector_handle_t clnp_handle; static dissector_handle_t ositp_handle; @@ -322,16 +324,16 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ cnf_cksum = tvb_get_ntohs(tvb, P_CLNP_CKSUM); if (cnf_cksum == 0) { /* No checksum present */ - proto_tree_add_checksum(clnp_tree, tvb, P_CLNP_CKSUM, hf_clnp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(clnp_tree, tvb, P_CLNP_CKSUM, hf_clnp_checksum, hf_clnp_checksum_status, &ei_clnp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); } else { guint32 c0 = 0, c1 = 0; if (osi_calc_checksum(tvb, 0, cnf_hdr_len, &c0, &c1)) { /* Successfully processed checksum, verify it */ - proto_tree_add_checksum(clnp_tree, tvb, P_CLNP_CKSUM, hf_clnp_checksum, -1, NULL, pinfo, c0 | c1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); + proto_tree_add_checksum(clnp_tree, tvb, P_CLNP_CKSUM, hf_clnp_checksum, hf_clnp_checksum_status, &ei_clnp_checksum, pinfo, c0 | c1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); cksum_valid = (c0 | c1) ? FALSE : TRUE; } else { - proto_tree_add_checksum(clnp_tree, tvb, P_CLNP_CKSUM, hf_clnp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(clnp_tree, tvb, P_CLNP_CKSUM, hf_clnp_checksum, hf_clnp_checksum_status, &ei_clnp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } @@ -635,6 +637,9 @@ proto_register_clnp(void) { &hf_clnp_checksum, { "Checksum", "clnp.checksum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, + { &hf_clnp_checksum_status, + { "Checksum Status", "clnp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, + { &hf_clnp_dest_length, { "DAL", "clnp.dsap.len", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -703,6 +708,7 @@ proto_register_clnp(void) static ei_register_info ei[] = { { &ei_clnp_length, { "clnp.len.bad", PI_MALFORMED, PI_ERROR, "Header length value bad", EXPFILL }}, + { &ei_clnp_checksum, { "clnp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; module_t *clnp_module; diff --git a/epan/dissectors/packet-dccp.c b/epan/dissectors/packet-dccp.c index 779845d001..571e354227 100644 --- a/epan/dissectors/packet-dccp.c +++ b/epan/dissectors/packet-dccp.c @@ -223,6 +223,7 @@ static gint ett_dccp_feature = -1; static expert_field ei_dccp_option_len_bad = EI_INIT; static expert_field ei_dccp_advertised_header_length_bad = EI_INIT; static expert_field ei_dccp_packet_type_reserved = EI_INIT; +static expert_field ei_dccp_checksum = EI_INIT; static dissector_table_t dccp_subdissector_table; static heur_dissector_list_t heur_subdissector_list; @@ -694,10 +695,10 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_ break; } SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, csum_coverage_len); - proto_tree_add_checksum(dccp_tree, tvb, offset, hf_dccp_checksum, hf_dccp_checksum_status, NULL, pinfo, in_cksum(&cksum_vec[0], 4), + proto_tree_add_checksum(dccp_tree, tvb, offset, hf_dccp_checksum, hf_dccp_checksum_status, &ei_dccp_checksum, pinfo, in_cksum(&cksum_vec[0], 4), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(dccp_tree, tvb, offset, hf_dccp_checksum, hf_dccp_checksum_status, NULL, pinfo, 0, + proto_tree_add_checksum(dccp_tree, tvb, offset, hf_dccp_checksum, hf_dccp_checksum_status, &ei_dccp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; @@ -1261,6 +1262,7 @@ proto_register_dccp(void) { &ei_dccp_option_len_bad, { "dccp.option.len.bad", PI_PROTOCOL, PI_WARN, "Bad option length", EXPFILL }}, { &ei_dccp_advertised_header_length_bad, { "dccp.advertised_header_length.bad", PI_MALFORMED, PI_ERROR, "Advertised header length bad", EXPFILL }}, { &ei_dccp_packet_type_reserved, { "dccp.packet_type.reserved", PI_PROTOCOL, PI_WARN, "Reserved packet type: unable to dissect further", EXPFILL }}, + { &ei_dccp_checksum, { "dccp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_dccp; diff --git a/epan/dissectors/packet-dec-dnart.c b/epan/dissectors/packet-dec-dnart.c index 6c476f94ad..6b13e79db6 100644 --- a/epan/dissectors/packet-dec-dnart.c +++ b/epan/dissectors/packet-dec-dnart.c @@ -49,6 +49,7 @@ #include #include +#include #include typedef enum { @@ -124,6 +125,7 @@ static int hf_dec_rt_fcnval = -1; static int hf_dec_rt_test_data = -1; static int hf_dec_rt_segment = -1; static int hf_dec_rt_checksum = -1; +static int hf_dec_rt_checksum_status = -1; static int hf_dec_rt_id = -1; static int hf_dec_rt_iinfo = -1; static int hf_dec_rt_iinfo_node_type = -1; @@ -170,6 +172,8 @@ static gint ett_dec_rt_state = -1; static gint ett_dec_flow_control = -1; static gint ett_dec_sess_contents = -1; +static expert_field ei_dec_rt_checksum = EI_INIT; + static gint dec_dna_total_bytes_this_segment = 0; static gint dec_dna_previous_total = 0; @@ -668,7 +672,7 @@ do_routing_msg( while (my_checksum>>16) my_checksum = (my_checksum & 0xffff) + (my_checksum >> 16); - proto_tree_add_checksum(tree, tvb, my_offset, hf_dec_rt_checksum, -1, NULL, pinfo, my_checksum, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(tree, tvb, my_offset, hf_dec_rt_checksum, hf_dec_rt_checksum_status, &ei_dec_rt_checksum, pinfo, my_checksum, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); my_offset += 2; return (my_offset); } @@ -1337,6 +1341,10 @@ proto_register_dec_rt(void) { "Checksum", "dec_dna.ctl.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_dec_rt_checksum_status, + { "Checksum Status", "dec_dna.ctl.checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL }}, { &hf_dec_rt_id, { "Transmitting system ID", "dec_dna.ctl.id", FT_ETHER, BASE_NONE, NULL, 0x0, @@ -1450,10 +1458,17 @@ proto_register_dec_rt(void) &ett_dec_sess_contents, }; - proto_dec_rt = proto_register_protocol("DEC DNA Routing Protocol", - "DEC_DNA", "dec_dna"); + static ei_register_info ei[] = { + { &ei_dec_rt_checksum, { "dec_dna.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_dec_rt; + + proto_dec_rt = proto_register_protocol("DEC DNA Routing Protocol", "DEC_DNA", "dec_dna"); proto_register_field_array(proto_dec_rt, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dec_rt = expert_register_protocol(proto_dec_rt); + expert_register_field_array(expert_dec_rt, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-dmx.c b/epan/dissectors/packet-dmx.c index 7b3fe46414..0980a2d888 100644 --- a/epan/dissectors/packet-dmx.c +++ b/epan/dissectors/packet-dmx.c @@ -39,6 +39,7 @@ #include #include +#include #define DMX_SC_DMX 0x00 #define DMX_SC_TEXT 0x17 @@ -108,6 +109,8 @@ static int ett_dmx_sip = -1; static int ett_dmx_test = -1; static int ett_dmx_text = -1; +static expert_field ei_dmx_sip_checksum = EI_INIT; + static dissector_table_t dmx_dissector_table; static dissector_handle_t dmx_text_handle; @@ -269,7 +272,7 @@ dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data offset += (byte_count - offset); } - proto_tree_add_checksum(dmx_sip_tree, tvb, offset, hf_dmx_sip_checksum, hf_dmx_sip_checksum_status, NULL, pinfo, dmx_sip_checksum(tvb, offset), ENC_NA, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(dmx_sip_tree, tvb, offset, hf_dmx_sip_checksum, hf_dmx_sip_checksum_status, &ei_dmx_sip_checksum, pinfo, dmx_sip_checksum(tvb, offset), ENC_NA, PROTO_CHECKSUM_VERIFY); offset += 1; if (offset < tvb_reported_length(tvb)) @@ -584,9 +587,17 @@ proto_register_dmx_sip(void) &ett_dmx_sip }; + static ei_register_info ei[] = { + { &ei_dmx_sip_checksum, { "dmx_sip.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_dmx_sip; + proto_dmx_sip = proto_register_protocol("DMX SIP", "DMX SIP", "dmx_sip"); proto_register_field_array(proto_dmx_sip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dmx_sip = expert_register_protocol(proto_dmx_sip); + expert_register_field_array(expert_dmx_sip, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-dvb-s2-bb.c b/epan/dissectors/packet-dvb-s2-bb.c index 71d4c1dbd1..fda51b1f56 100644 --- a/epan/dissectors/packet-dvb-s2-bb.c +++ b/epan/dissectors/packet-dvb-s2-bb.c @@ -33,6 +33,7 @@ #include #include #include +#include #define BIT_IS_SET(var, bit) ((var) & (1 << (bit))) #define BIT_IS_CLEAR(var, bit) !BIT_IS_SET(var, bit) @@ -95,6 +96,7 @@ static int hf_dvb_s2_bb_dfl = -1; static int hf_dvb_s2_bb_sync = -1; static int hf_dvb_s2_bb_syncd = -1; static int hf_dvb_s2_bb_crc = -1; +static int hf_dvb_s2_bb_crc_status = -1; static int proto_dvb_s2_gse = -1; static int hf_dvb_s2_gse_hdr = -1; @@ -121,6 +123,9 @@ static gint ett_dvb_s2_bb_matype1 = -1; static gint ett_dvb_s2_gse = -1; static gint ett_dvb_s2_gse_hdr = -1; +static expert_field ei_dvb_s2_bb_crc = EI_INIT; + + /* *** DVB-S2 Modeadaption Header *** */ /* first byte */ @@ -785,7 +790,7 @@ static int dissect_dvb_s2_bb(tvbuff_t *tvb, int cur_off, proto_tree *tree, packe input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_CRC); new_off += 1; - proto_tree_add_checksum(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, -1, NULL, pinfo, + proto_tree_add_checksum(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, hf_dvb_s2_bb_crc_status, &ei_dvb_s2_bb_crc, pinfo, check_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, cur_off, input8), ENC_NA, PROTO_CHECKSUM_VERIFY); while (bb_data_len) { @@ -986,7 +991,12 @@ void proto_register_dvb_s2_modeadapt(void) "Checksum", "dvb-s2_bb.crc", FT_UINT8, BASE_HEX, NULL, 0x0, "CRC-8", HFILL} - } + }, + {&hf_dvb_s2_bb_crc_status, { + "Checksum Status", "dvb-s2_bb.crc.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL} + }, }; static gint *ett_bb[] = { @@ -1068,6 +1078,12 @@ void proto_register_dvb_s2_modeadapt(void) &ett_dvb_s2_gse_hdr }; + static ei_register_info ei[] = { + { &ei_dvb_s2_bb_crc, { "dvb-s2_bb.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_dvb_s2_bb; + proto_dvb_s2_modeadapt = proto_register_protocol("DVB-S2 Modeadaption Header", "DVB-S2", "dvb-s2_modeadapt"); proto_dvb_s2_bb = proto_register_protocol("DVB-S2 Baseband Frame", "DVB-S2-BB", "dvb-s2_bb"); @@ -1079,6 +1095,8 @@ void proto_register_dvb_s2_modeadapt(void) proto_register_field_array(proto_dvb_s2_bb, hf_bb, array_length(hf_bb)); proto_register_subtree_array(ett_bb, array_length(ett_bb)); + expert_dvb_s2_bb = expert_register_protocol(proto_dvb_s2_bb); + expert_register_field_array(expert_dvb_s2_bb, ei, array_length(ei)); proto_register_field_array(proto_dvb_s2_gse, hf_gse, array_length(hf_gse)); proto_register_subtree_array(ett_gse, array_length(ett_gse)); diff --git a/epan/dissectors/packet-dvmrp.c b/epan/dissectors/packet-dvmrp.c index fead40077f..54a85eb372 100644 --- a/epan/dissectors/packet-dvmrp.c +++ b/epan/dissectors/packet-dvmrp.c @@ -53,6 +53,7 @@ #include #include +#include #include "packet-igmp.h" void proto_register_dvmrp(void); @@ -109,6 +110,8 @@ static int ett_capabilities = -1; static int ett_flags = -1; static int ett_route = -1; +static expert_field ei_checksum = EI_INIT; + static int strict_v3 = FALSE; #define DVMRP_TYPE 0x13 @@ -336,7 +339,7 @@ dissect_dvmrp_v3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int "Unknown Type:0x%02x")); /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* skip unused byte */ @@ -525,7 +528,7 @@ dissect_dvmrp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int "Unknown Type:0x%02x")); /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* decode all the v1 commands */ @@ -883,11 +886,20 @@ proto_register_dvmrp(void) &ett_flags, &ett_route }; + + static ei_register_info ei[] = { + { &ei_checksum, { "dvmrp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_dvmrp; + module_t *module_dvmrp; proto_dvmrp = proto_register_protocol("Distance Vector Multicast Routing Protocol", "DVMRP", "dvmrp"); proto_register_field_array(proto_dvmrp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_dvmrp = expert_register_protocol(proto_dvmrp); + expert_register_field_array(expert_dvmrp, ei, array_length(ei)); module_dvmrp = prefs_register_protocol(proto_dvmrp, NULL); diff --git a/epan/dissectors/packet-eigrp.c b/epan/dissectors/packet-eigrp.c index a925930b6e..d6db7cfe54 100644 --- a/epan/dissectors/packet-eigrp.c +++ b/epan/dissectors/packet-eigrp.c @@ -516,6 +516,7 @@ static int hf_eigrp_cable_range = -1; static int hf_eigrp_metric_delay = -1; static int hf_eigrp_metric_bandwidth = -1; static int hf_eigrp_checksum = -1; +static int hf_eigrp_checksum_status = -1; static int hf_eigrp_metric_comm_type = -1; static int ett_metric_comm_type = -1; static int hf_eigrp_extcomm_eigrp_flag = -1; @@ -2463,7 +2464,8 @@ dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _ ENC_BIG_ENDIAN); size = tvb_captured_length(tvb); - proto_tree_add_checksum(eigrp_tree, tvb, 2, hf_eigrp_checksum, -1, &ei_eigrp_checksum_bad, pinfo, ip_checksum_tvb(tvb, 0, size), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(eigrp_tree, tvb, 2, hf_eigrp_checksum, hf_eigrp_checksum_status, &ei_eigrp_checksum_bad, + pinfo, ip_checksum_tvb(tvb, 0, size), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); /* Decode the EIGRP Flags Field */ proto_tree_add_bitmask(eigrp_tree, tvb, 4, hf_eigrp_flags, ett_eigrp_flags, @@ -3302,6 +3304,7 @@ proto_register_eigrp(void) { &hf_eigrp_metric_delay, { "Delay", "eigrp.metric.delay", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_eigrp_metric_bandwidth, { "Bandwidth", "eigrp.metric.bandwidth", FT_UINT64, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_eigrp_checksum, { "Checksum", "eigrp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_eigrp_checksum_status, { "Checksum Status", "eigrp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_eigrp_metric_comm_type, { "Type", "eigrp.metric.comm_type", FT_UINT16, BASE_DEC, VALS(eigrp_metric_comm_type_vals), 0x0, NULL, HFILL }}, { &hf_eigrp_extcomm_eigrp_flag, { "FLAG", "eigrp.extcomm.flag", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_eigrp_extcomm_eigrp_tag, { "TAG", "eigrp.extcomm.tag", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-epon.c b/epan/dissectors/packet-epon.c index be29d7ba18..fcd6ce6b4c 100644 --- a/epan/dissectors/packet-epon.c +++ b/epan/dissectors/packet-epon.c @@ -47,6 +47,7 @@ static int hf_epon_dpoe_keyid = -1; static int hf_epon_mode = -1; static int hf_epon_llid = -1; static int hf_epon_checksum = -1; +static int hf_epon_checksum_status = -1; static expert_field ei_epon_sld_bad = EI_INIT; static expert_field ei_epon_dpoe_reserved_bad = EI_INIT; @@ -172,7 +173,7 @@ dissect_epon(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, sent_checksum = tvb_get_guint8(tvb, 5+offset); checksum = get_crc8_ieee8023_epon(tvb, 5, 0+offset); - proto_tree_add_checksum(epon_tree, tvb, 5+offset, hf_epon_checksum, -1, &ei_epon_checksum_bad, pinfo, checksum, ENC_NA, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(epon_tree, tvb, 5+offset, hf_epon_checksum, hf_epon_checksum_status, &ei_epon_checksum_bad, pinfo, checksum, ENC_NA, PROTO_CHECKSUM_VERIFY); if (sent_checksum != checksum) { col_append_str(pinfo->cinfo, COL_INFO, " [EPON PREAMBLE CHECKSUM INCORRECT]"); } @@ -236,6 +237,10 @@ proto_register_epon(void) { "Frame check sequence", "epon.checksum", FT_UINT8, BASE_HEX, NULL, 0x0, "EPON preamble checksum", HFILL } }, + { &hf_epon_checksum_status, + { "Frame check sequence Status", "epon.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), + 0x0, NULL, HFILL } + }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-esis.c b/epan/dissectors/packet-esis.c index 67e7ea4d41..6403822d4a 100644 --- a/epan/dissectors/packet-esis.c +++ b/epan/dissectors/packet-esis.c @@ -55,6 +55,7 @@ static int hf_esis_reserved = -1; static int hf_esis_type = -1; static int hf_esis_holdtime = -1; static int hf_esis_checksum = -1; +static int hf_esis_checksum_status = -1; /* Generated from convert_proto_tree_add_text.pl */ static int hf_esis_dal = -1; static int hf_esis_number_of_source_addresses = -1; @@ -76,6 +77,7 @@ static gint ett_esis_subnetwork = -1; static expert_field ei_esis_version = EI_INIT; static expert_field ei_esis_length = EI_INIT; static expert_field ei_esis_type = EI_INIT; +static expert_field ei_esis_checksum = EI_INIT; static const value_string esis_vals[] = { { ESIS_ESH_PDU, "ES HELLO"}, @@ -292,9 +294,9 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ if (osi_calc_checksum(tvb, 0, length, &c0, &c1)) { /* Successfully processed checksum, verify it */ - proto_tree_add_checksum(esis_tree, tvb, 7, hf_esis_checksum, -1, NULL, pinfo, c0 | c1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); + proto_tree_add_checksum(esis_tree, tvb, 7, hf_esis_checksum, hf_esis_checksum_status, &ei_esis_checksum, pinfo, c0 | c1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); } else { - proto_tree_add_checksum(esis_tree, tvb, 7, hf_esis_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(esis_tree, tvb, 7, hf_esis_checksum, hf_esis_checksum_status, &ei_esis_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } @@ -367,6 +369,9 @@ proto_register_esis(void) { { &hf_esis_checksum, { "Checksum", "esis.chksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_esis_checksum_status, + { "Checksum Status", "esis.chksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, + /* Generated from convert_proto_tree_add_text.pl */ { &hf_esis_number_of_source_addresses, { "Number of Source Addresses (SA, Format: NSAP)", "esis.number_of_source_addresses", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_esis_sal, { "SAL", "esis.sal", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -391,6 +396,7 @@ proto_register_esis(void) { { &ei_esis_version, { "esis.ver.unknown", PI_PROTOCOL, PI_WARN, "Unknown ESIS version", EXPFILL }}, { &ei_esis_length, { "esis.length.invalid", PI_MALFORMED, PI_ERROR, "Bogus ESIS length", EXPFILL }}, { &ei_esis_type, { "esis.type.unknown", PI_PROTOCOL, PI_WARN, "Unknown ESIS packet type", EXPFILL }}, + { &ei_esis_checksum, { "esis.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_esis; diff --git a/epan/dissectors/packet-extreme.c b/epan/dissectors/packet-extreme.c index 17a39e52e5..4d7d34a9ee 100644 --- a/epan/dissectors/packet-extreme.c +++ b/epan/dissectors/packet-extreme.c @@ -252,6 +252,7 @@ static int hf_edp_unknown_data = -1; static int hf_edp_null = -1; static expert_field ei_edp_short_tlv = EI_INIT; +static expert_field ei_edp_checksum = EI_INIT; static gint ett_edp = -1; static gint ett_edp_tlv_header = -1; @@ -983,10 +984,10 @@ dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) /* Checksum from version to null tlv */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, data_length); - proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, NULL, pinfo, in_cksum(&cksum_vec[0], 1), + proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, &ei_edp_checksum, pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, &ei_edp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; @@ -1440,6 +1441,7 @@ proto_register_edp(void) static ei_register_info ei[] = { { &ei_edp_short_tlv, { "edp.short_tlv", PI_MALFORMED, PI_ERROR, "TLV is too short", EXPFILL }}, + { &ei_edp_checksum, { "edp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_edp; diff --git a/epan/dissectors/packet-fc.c b/epan/dissectors/packet-fc.c index 7bfb35d79a..127219c3ff 100644 --- a/epan/dissectors/packet-fc.c +++ b/epan/dissectors/packet-fc.c @@ -126,6 +126,7 @@ static int proto_fcsof = -1; static int hf_fcsof = -1; static int hf_fceof = -1; static int hf_fccrc = -1; +static int hf_fccrc_status = -1; static int ett_fcsof = -1; static int ett_fceof = -1; @@ -1305,7 +1306,7 @@ dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U proto_tree_add_uint(fcsof_tree, hf_fcsof, tvb, sof_offset, 4, sof); - proto_tree_add_checksum(fcsof_tree, tvb, crc_offset, hf_fccrc, -1, &ei_fccrc, pinfo, crc_computed, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(fcsof_tree, tvb, crc_offset, hf_fccrc, hf_fccrc_status, &ei_fccrc, pinfo, crc_computed, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); proto_tree_add_uint(fcsof_tree, hf_fceof, tvb, eof_offset, 4, eof); @@ -1530,6 +1531,8 @@ proto_register_fc(void) NULL, HFILL }}, { &hf_fccrc, { "CRC", "fc.crc", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, + { &hf_fccrc_status, + { "CRC Status", "fc.crc.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0, NULL, HFILL }}, }; static gint *sof_ett[] = { diff --git a/epan/dissectors/packet-gre.c b/epan/dissectors/packet-gre.c index 4d60a57370..3fdcff0835 100644 --- a/epan/dissectors/packet-gre.c +++ b/epan/dissectors/packet-gre.c @@ -59,6 +59,7 @@ static int hf_gre_flags_reserved_ppp = -1; static int hf_gre_flags_reserved = -1; static int hf_gre_flags_version = -1; static int hf_gre_checksum = -1; +static int hf_gre_checksum_status = -1; static int hf_gre_offset = -1; static int hf_gre_key = -1; static int hf_gre_key_payload_length = -1; @@ -419,10 +420,10 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) fragmented datagram and isn't truncated, so we can checksum it. */ if ((flags_and_ver & GRE_CHECKSUM) && !pinfo->fragmented && length >= reported_length) { SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, reported_length); - proto_tree_add_checksum(gre_tree, tvb, offset, hf_gre_checksum, -1, &ei_gre_checksum_incorrect, pinfo, in_cksum(cksum_vec, 1), + proto_tree_add_checksum(gre_tree, tvb, offset, hf_gre_checksum, hf_gre_checksum_status, &ei_gre_checksum_incorrect, pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(gre_tree, tvb, offset, hf_gre_checksum, -1, &ei_gre_checksum_incorrect, pinfo, 0, + proto_tree_add_checksum(gre_tree, tvb, offset, hf_gre_checksum, hf_gre_checksum_status, &ei_gre_checksum_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; @@ -583,6 +584,11 @@ proto_register_gre(void) FT_UINT16, BASE_HEX, NULL, 0x0, "The Checksum field contains the IP (one's complement) checksum of the GRE header and the payload packet", HFILL } }, + { &hf_gre_checksum_status, + { "Checksum Status", "gre.checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL } + }, { &hf_gre_offset, { "Offset", "gre.offset", FT_UINT16, BASE_DEC, NULL, 0x0, diff --git a/epan/dissectors/packet-h223.c b/epan/dissectors/packet-h223.c index 7d942f83df..3e2e35996d 100644 --- a/epan/dissectors/packet-h223.c +++ b/epan/dissectors/packet-h223.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -116,6 +117,8 @@ static gint ett_h223_al1 = -1; static gint ett_h223_al2 = -1; static gint ett_h223_al_payload = -1; +static expert_field ei_h223_al2_crc = EI_INIT; + /* These are the handles of our subdissectors */ static dissector_handle_t data_handle; static dissector_handle_t srp_handle; @@ -697,7 +700,7 @@ dissect_mux_al_pdu( tvbuff_t *tvb, packet_info *pinfo, proto_tree *vc_tree, calc_checksum = h223_al2_crc8bit(tvb); real_checksum = tvb_get_guint8(tvb, len - 1); - proto_tree_add_checksum(al_tree, tvb, len - 1, hf_h223_al2_crc, hf_h223_al2_crc_status, NULL, pinfo, calc_checksum, ENC_NA, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(al_tree, tvb, len - 1, hf_h223_al2_crc, hf_h223_al2_crc_status, &ei_h223_al2_crc, pinfo, calc_checksum, ENC_NA, PROTO_CHECKSUM_VERIFY); if( calc_checksum != real_checksum ) { /* don't pass pdus which fail checksums on to the subdissector */ @@ -1632,6 +1635,12 @@ void proto_register_h223 (void) &ett_h223_al_payload }; + static ei_register_info ei[] = { + { &ei_h223_al2_crc, { "h223.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_h223; + proto_h223 = proto_register_protocol ("ITU-T Recommendation H.223", "H.223", "h223"); /* Create a H.223 "placeholder" to remove confusion with Decode As" */ @@ -1640,6 +1649,9 @@ void proto_register_h223 (void) proto_register_field_array (proto_h223, hf, array_length (hf)); proto_register_subtree_array (ett, array_length (ett)); + expert_h223 = expert_register_protocol(proto_h223); + expert_register_field_array(expert_h223, ei, array_length(ei)); + register_dissector("h223", dissect_h223_circuit_data, proto_h223); register_dissector("h223_bitswapped", dissect_h223_bitswapped, proto_h223_bitswapped); diff --git a/epan/dissectors/packet-hip.c b/epan/dissectors/packet-hip.c index c98a52956b..463e73507f 100644 --- a/epan/dissectors/packet-hip.c +++ b/epan/dissectors/packet-hip.c @@ -308,6 +308,7 @@ static int hf_hip_shim6_fixed_bit_s = -1; static int hf_hip_controls = -1; static int hf_hip_controls_anon = -1; static int hf_hip_checksum = -1; +static int hf_hip_checksum_status = -1; static int hf_hip_hit_sndr = -1; static int hf_hip_hit_rcvr = -1; @@ -413,6 +414,7 @@ static gint ett_hip_locator_data = -1; static expert_field ei_hip_tlv_host_id_len = EI_INIT; /* static expert_field ei_hip_tlv_host_id_e_len = EI_INIT; */ static expert_field ei_hip_tlv_host_id_hdr_alg = EI_INIT; +static expert_field ei_hip_checksum = EI_INIT; /* Dissect the HIP packet */ static void @@ -511,14 +513,14 @@ dissect_hip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean /* pointer to the HIP header (packet data) */ SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, reported_len); if (checksum_h == 0 && udp) { - proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, -1, NULL, pinfo, 0, + proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, hf_hip_checksum_status, &ei_hip_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { - proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, -1, NULL, pinfo, in_cksum(cksum_vec, 4), + proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, hf_hip_checksum_status, &ei_hip_checksum, pinfo, in_cksum(cksum_vec, 4), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } } else { - proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, -1, NULL, pinfo, 0, + proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, hf_hip_checksum_status, &ei_hip_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } @@ -1198,6 +1200,10 @@ proto_register_hip(void) { "Checksum", "hip.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_hip_checksum_status, + { "Checksum Status", "hip.checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, + { &hf_hip_hit_sndr, { "Sender's HIT", "hip.hit_sndr", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, @@ -1578,6 +1584,7 @@ proto_register_hip(void) { &ei_hip_tlv_host_id_e_len, { "hip.tlv.host_id_e_length.invalid", PI_PROTOCOL, PI_WARN, "e_len too large", EXPFILL }}, #endif { &ei_hip_tlv_host_id_hdr_alg, { "hip.tlv.host_id_header_algo.invalid", PI_PROTOCOL, PI_WARN, "Unknown algorithm type", EXPFILL }}, + { &ei_hip_checksum, { "hip.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_hip; diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 229c6d38e0..c271070cab 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -172,6 +172,7 @@ static gint ett_icmp_mpls_stack_object = -1; static expert_field ei_icmp_resp_not_found = EI_INIT; static expert_field ei_icmp_checksum = EI_INIT; +static expert_field ei_icmp_ext_checksum = EI_INIT; /* ICMP definitions */ @@ -755,7 +756,7 @@ dissect_interface_information_object(tvbuff_t * tvb, gint offset, } /*end dissect_interface_information_object */ static void -dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree) +dissect_extensions(tvbuff_t * tvb, packet_info *pinfo, gint offset, proto_tree * tree) { guint8 version; guint8 class_num; @@ -797,8 +798,8 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree) tvb, offset, 2, ENC_BIG_ENDIAN); /* Checksum */ - proto_tree_add_checksum(ext_tree, tvb, offset + 2, hf_icmp_ext_checksum, hf_icmp_ext_checksum_status, NULL, NULL, ip_checksum_tvb(tvb, 0, reported_length), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(ext_tree, tvb, offset + 2, hf_icmp_ext_checksum, hf_icmp_ext_checksum_status, &ei_icmp_ext_checksum, + pinfo, ip_checksum_tvb(tvb, 0, reported_length), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); if (version != 1 && version != 2) { /* Unsupported version */ @@ -1435,7 +1436,7 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data) if ((tvb_reported_length(tvb) > 8 + 128) && (tvb_get_ntohs(tvb, 8 + 2) <= 128 || favor_icmp_mpls_ext)) { - dissect_extensions(tvb, 8 + 128, icmp_tree); + dissect_extensions(tvb, pinfo, 8 + 128, icmp_tree); } break; case ICMP_ECHOREPLY: @@ -1984,7 +1985,8 @@ void proto_register_icmp(void) static ei_register_info ei[] = { { &ei_icmp_resp_not_found, { "icmp.resp_not_found", PI_SEQUENCE, PI_WARN, "Response not found", EXPFILL }}, - { &ei_icmp_checksum, { "icmp.checksum_bad.expert", PI_CHECKSUM, PI_WARN, "Bad checksum", EXPFILL }}, + { &ei_icmp_checksum, { "icmp.checksum_bad", PI_CHECKSUM, PI_WARN, "Bad checksum", EXPFILL }}, + { &ei_icmp_ext_checksum, { "icmp.ext.checksum_bad", PI_CHECKSUM, PI_WARN, "Bad checksum", EXPFILL }}, }; module_t *icmp_module; diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index af72ea161a..efb3e37ad2 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -4992,6 +4992,7 @@ static expert_field ei_ieee80211_tag_wnm_sleep_mode_no_key_data = EI_INIT; static expert_field ei_ieee80211_dmg_subtype = EI_INIT; static expert_field ei_ieee80211_vht_action = EI_INIT; static expert_field ei_ieee80211_mesh_peering_unexpected = EI_INIT; +static expert_field ei_ieee80211_fcs = EI_INIT; /* 802.11ad trees */ static gint ett_dynamic_alloc_tree = -1; @@ -17537,9 +17538,9 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo, flag_str[8] = '.'; } - proto_tree_add_checksum(hdr_tree, tvb, hdr_len + len, hf_ieee80211_fcs, hf_ieee80211_fcs_status, NULL, pinfo, fcs, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(hdr_tree, tvb, hdr_len + len, hf_ieee80211_fcs, hf_ieee80211_fcs_status, &ei_ieee80211_fcs, pinfo, fcs, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { - proto_tree_add_checksum(hdr_tree, tvb, hdr_len + len, hf_ieee80211_fcs, hf_ieee80211_fcs_status, NULL, pinfo, 0, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(hdr_tree, tvb, hdr_len + len, hf_ieee80211_fcs, hf_ieee80211_fcs_status, &ei_ieee80211_fcs, pinfo, 0, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } } @@ -27126,6 +27127,10 @@ proto_register_ieee80211(void) { &ei_ieee80211_mesh_peering_unexpected, { "wlan.peering.unexpected", PI_MALFORMED, PI_ERROR, "Unexpected Self-protected action", EXPFILL }}, + + { &ei_ieee80211_fcs, + { "wlan.fcs.bad_checksum", PI_MALFORMED, PI_ERROR, + NULL, EXPFILL }}, }; expert_module_t *expert_ieee80211; diff --git a/epan/dissectors/packet-igap.c b/epan/dissectors/packet-igap.c index 6df6ff498f..22afe9a6ff 100644 --- a/epan/dissectors/packet-igap.c +++ b/epan/dissectors/packet-igap.c @@ -43,6 +43,7 @@ #include "config.h" #include +#include #include "packet-igmp.h" void proto_register_igap(void); @@ -71,6 +72,7 @@ static int hf_igap_unknown_message = -1; static int ett_igap = -1; +static expert_field ei_checksum = EI_INIT; static const value_string igap_types[] = { {IGMP_IGAP_JOIN, "Membership Report (Join)"}, @@ -157,7 +159,7 @@ dissect_igap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d "%.1f sec (0x%02x)", tsecs * 0.1, tsecs); offset += 1; - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -330,6 +332,12 @@ proto_register_igap(void) }, }; + static ei_register_info ei[] = { + { &ei_checksum, { "igap.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_igap; + static gint *ett[] = { &ett_igap }; @@ -337,6 +345,8 @@ proto_register_igap(void) proto_igap = proto_register_protocol("Internet Group membership Authentication Protocol", "IGAP", "igap"); proto_register_field_array(proto_igap, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_igap = expert_register_protocol(proto_igap); + expert_register_field_array(expert_igap, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-igmp.c b/epan/dissectors/packet-igmp.c index f976130c24..c6483434c2 100644 --- a/epan/dissectors/packet-igmp.c +++ b/epan/dissectors/packet-igmp.c @@ -109,6 +109,7 @@ #include "config.h" #include +#include #include #include #include @@ -169,6 +170,8 @@ static int ett_group_record = -1; static int ett_max_resp = -1; static int ett_mtrace_block = -1; +static expert_field ei_checksum = EI_INIT; + static dissector_table_t subdissector_table; #define IGMP_TRACEROUTE_HDR_LEN 24 @@ -282,7 +285,7 @@ static const value_string mtrace_fwd_code_vals[] = { }; void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index, - int hf_index_status, packet_info *pinfo, guint len) + int hf_index_status, expert_field* ei_index, packet_info *pinfo, guint len) { vec_t cksum_vec[1]; @@ -299,10 +302,10 @@ void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index, * truncated, so we can checksum it. */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, len); - proto_tree_add_checksum(tree, tvb, 2, hf_index, hf_index_status, NULL, pinfo, in_cksum(&cksum_vec[0], 1), + proto_tree_add_checksum(tree, tvb, 2, hf_index, hf_index_status, ei_index, pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else - proto_tree_add_checksum(tree, tvb, 2, hf_index, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(tree, tvb, 2, hf_index, hf_index_status, ei_index, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); return; } @@ -548,7 +551,7 @@ dissect_igmp_v3_report(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tre offset += 1; /* checksum */ - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; proto_tree_add_item(tree, hf_reserved, tvb, offset, 2, ENC_NA); @@ -583,7 +586,7 @@ dissect_igmp_v3_query(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree offset = dissect_v3_max_resp(tvb, tree, offset); /* checksum */ - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* group address */ @@ -638,7 +641,7 @@ dissect_igmp_v2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void offset += 1; /* checksum */ - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 8); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 8); offset += 2; /* group address */ @@ -680,7 +683,7 @@ dissect_igmp_v1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void offset += 1; /* checksum */ - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 8); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 8); offset += 2; /* group address */ @@ -715,7 +718,7 @@ dissect_igmp_v0(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void offset += 1; /* checksum */ - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 20); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 20); offset += 2; /* identifier */ @@ -798,7 +801,7 @@ dissect_igmp_mtrace(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, offset += 1; /* checksum */ - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* group address to be traced */ @@ -1089,10 +1092,17 @@ proto_register_igmp(void) &ett_mtrace_block, }; - proto_igmp = proto_register_protocol("Internet Group Management Protocol", - "IGMP", "igmp"); + static ei_register_info ei[] = { + { &ei_checksum, { "igmp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_igmp; + + proto_igmp = proto_register_protocol("Internet Group Management Protocol", "IGMP", "igmp"); proto_register_field_array(proto_igmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_igmp = expert_register_protocol(proto_igmp); + expert_register_field_array(expert_igmp, ei, array_length(ei)); subdissector_table = register_dissector_table("igmp.type", "IGMP commands", proto_igmp, FT_UINT32, BASE_HEX, DISSECTOR_TABLE_ALLOW_DUPLICATE); diff --git a/epan/dissectors/packet-igmp.h b/epan/dissectors/packet-igmp.h index 8709dd8013..32835c9074 100644 --- a/epan/dissectors/packet-igmp.h +++ b/epan/dissectors/packet-igmp.h @@ -55,7 +55,7 @@ #define IGMP_RGMP_HELLO 0xFF void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index, - int hf_index_status, packet_info *pinfo, guint len); + int hf_index_status, expert_field* ei_checksum, packet_info *pinfo, guint len); #endif diff --git a/epan/dissectors/packet-isis-hello.c b/epan/dissectors/packet-isis-hello.c index 5371667c4d..5038096a77 100644 --- a/epan/dissectors/packet-isis-hello.c +++ b/epan/dissectors/packet-isis-hello.c @@ -106,6 +106,7 @@ static int hf_isis_hello_mcid = -1; static int hf_isis_hello_is_neighbor = -1; static int hf_isis_hello_mtid = -1; static int hf_isis_hello_checksum = -1; +static int hf_isis_hello_checksum_status = -1; static int hf_isis_hello_trill_neighbor_sf = -1; static int hf_isis_hello_trill_neighbor_lf = -1; static int hf_isis_hello_trill_neighbor_ff = -1; @@ -169,6 +170,7 @@ static expert_field ei_isis_hello_authentication = EI_INIT; static expert_field ei_isis_hello_subtlv = EI_INIT; static expert_field ei_isis_hello_clv_mt = EI_INIT; static expert_field ei_isis_hello_clv_unknown = EI_INIT; +static expert_field ei_isis_hello_checksum = EI_INIT; static const value_string isis_hello_circuit_type_vals[] = { { ISIS_HELLO_TYPE_RESERVED, "Reserved 0 (discard PDU)"}, @@ -767,13 +769,13 @@ dissect_hello_checksum_clv(tvbuff_t *tvb, packet_info* pinfo, if (checksum == 0) { /* No checksum present */ - proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, hf_isis_hello_checksum_status, &ei_isis_hello_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); } else { if (osi_check_and_get_checksum(tvb, 0, pdu_length, offset, &cacl_checksum)) { /* Successfully processed checksum, verify it */ - proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, -1, NULL, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, hf_isis_hello_checksum_status, &ei_isis_hello_checksum, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { - proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(tree, tvb, offset, hf_isis_hello_checksum, hf_isis_hello_checksum_status, &ei_isis_hello_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); proto_tree_add_expert_format(tree, pinfo, &ei_isis_hello_long_packet, tvb, offset, -1, "Packet length %d went beyond packet", tvb_captured_length(tvb) ); } @@ -1418,6 +1420,7 @@ proto_register_isis_hello(void) { &hf_isis_hello_trill_neighbor_mtu, { "Tested MTU", "isis.hello.trill_neighbor.mtu", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_isis_hello_trill_neighbor_snpa, { "SNPA", "isis.hello.trill_neighbor.snpa", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_isis_hello_checksum, { "Checksum", "isis.hello.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_isis_hello_checksum_status, { "Checksum Status", "isis.hello.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_isis_hello_adjacency_state, { "Adjacency State", "isis.hello.adjacency_state", FT_UINT8, BASE_DEC, VALS(adj_state_vals), 0x0, NULL, HFILL }}, { &hf_isis_hello_extended_local_circuit_id, { "Extended Local circuit ID", "isis.hello.extended_local_circuit_id", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_isis_hello_neighbor_systemid, { "Neighbor SystemID", "isis.hello.neighbor_systemid", FT_SYSTEM_ID, BASE_NONE, NULL, 0x0, NULL, HFILL }}, @@ -1481,6 +1484,7 @@ proto_register_isis_hello(void) { &ei_isis_hello_authentication, { "isis.hello.authentication.unknown", PI_PROTOCOL, PI_WARN, "Unknown authentication type", EXPFILL }}, { &ei_isis_hello_clv_mt, { "isis.hello.clv_mt.malformed", PI_MALFORMED, PI_ERROR, "malformed MT-ID", EXPFILL }}, { &ei_isis_hello_clv_unknown, { "isis.hello.clv.unknown", PI_UNDECODED, PI_NOTE, "Unknown option", EXPFILL }}, + { &ei_isis_hello_checksum, { "isis.hello.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_isis_hello; diff --git a/epan/dissectors/packet-isis-snp.c b/epan/dissectors/packet-isis-snp.c index 9041de3c61..eda2d3bd25 100644 --- a/epan/dissectors/packet-isis-snp.c +++ b/epan/dissectors/packet-isis-snp.c @@ -52,6 +52,7 @@ static int hf_isis_csnp_lsp_seq_num = -1; static int hf_isis_csnp_lsp_remain_life = -1; static int hf_isis_csnp_lsp_checksum = -1; static int hf_isis_csnp_checksum = -1; +static int hf_isis_csnp_checksum_status = -1; static int hf_isis_csnp_clv_type = -1; static int hf_isis_csnp_clv_length = -1; static int hf_isis_csnp_ip_authentication = -1; @@ -71,6 +72,7 @@ static expert_field ei_isis_csnp_short_packet = EI_INIT; static expert_field ei_isis_csnp_long_packet = EI_INIT; static expert_field ei_isis_csnp_authentication = EI_INIT; static expert_field ei_isis_csnp_clv_unknown = EI_INIT; +static expert_field ei_isis_csnp_checksum = EI_INIT; /* psnp packets */ static int hf_isis_psnp_pdu_length = -1; @@ -146,13 +148,13 @@ dissect_snp_checksum_clv(tvbuff_t *tvb, packet_info* pinfo, if (checksum == 0) { /* No checksum present */ - proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, hf_isis_csnp_checksum_status, &ei_isis_csnp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); } else { if (osi_check_and_get_checksum(tvb, 0, pdu_length, offset, &cacl_checksum)) { /* Successfully processed checksum, verify it */ - proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, -1, NULL, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, hf_isis_csnp_checksum_status, &ei_isis_csnp_checksum, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { - ti = proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + ti = proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, hf_isis_csnp_checksum_status, &ei_isis_csnp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); expert_add_info_format(pinfo, ti, &ei_isis_csnp_long_packet, "Packet length %d went beyond packet", tvb_captured_length(tvb)); } @@ -513,6 +515,9 @@ proto_register_isis_csnp(void) { &hf_isis_csnp_checksum, { "Checksum", "isis.csnp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_isis_csnp_checksum_status, + { "Checksum Status", "isis.csnp.checksum.status", FT_UINT8, + BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_isis_csnp_clv_type, { "Type", "isis.csnp.clv.type", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -549,6 +554,7 @@ proto_register_isis_csnp(void) { &ei_isis_csnp_long_packet, { "isis.csnp.long_packet", PI_MALFORMED, PI_ERROR, "Long packet", EXPFILL }}, { &ei_isis_csnp_authentication, { "isis.csnp.authentication.unknown", PI_PROTOCOL, PI_WARN, "Unknown authentication type", EXPFILL }}, { &ei_isis_csnp_clv_unknown, { "isis.csnp.clv.unknown", PI_UNDECODED, PI_NOTE, "Unknown option", EXPFILL }}, + { &ei_isis_csnp_checksum, { "isis.csnp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_isis_csnp; diff --git a/epan/dissectors/packet-kingfisher.c b/epan/dissectors/packet-kingfisher.c index 5686bb7350..57b3c91127 100644 --- a/epan/dissectors/packet-kingfisher.c +++ b/epan/dissectors/packet-kingfisher.c @@ -27,6 +27,7 @@ #include #include +#include void proto_register_kingfisher(void); void proto_reg_handoff_kingfisher(void); @@ -50,8 +51,11 @@ static int hf_kingfisher_via = -1; static int hf_kingfisher_message = -1; static int hf_kingfisher_function = -1; static int hf_kingfisher_checksum = -1; +static int hf_kingfisher_checksum_status = -1; static int hf_kingfisher_message_data = -1; +static expert_field ei_kingfisher_checksum = EI_INIT; + static dissector_handle_t kingfisher_conv_handle; @@ -302,7 +306,8 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean } /* checksum */ - proto_tree_add_checksum(kingfisher_tree, tvb, kfp.length-1, hf_kingfisher_checksum, -1, NULL, pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(kingfisher_tree, tvb, kfp.length-1, hf_kingfisher_checksum, hf_kingfisher_checksum_status, &ei_kingfisher_checksum, + pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); return TRUE; } @@ -351,6 +356,7 @@ proto_register_kingfisher( void ) { &hf_kingfisher_message, { "Message Number", "kingfisher.message", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } }, { &hf_kingfisher_function, { "Message Function Code", "kingfisher.function", FT_UINT8, BASE_DEC, VALS( function_code_vals ), 0x0, NULL, HFILL } }, { &hf_kingfisher_checksum, { "Checksum", "kingfisher.checksum", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL } }, + { &hf_kingfisher_checksum_status, { "Checksum Status", "kingfisher.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL } }, { &hf_kingfisher_message_data, { "Message Data", "kingfisher.message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } }, }; @@ -358,9 +364,17 @@ proto_register_kingfisher( void ) &ett_kingfisher }; + static ei_register_info ei[] = { + { &ei_kingfisher_checksum, { "kingfisher.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_kingfisher; + proto_kingfisher = proto_register_protocol( "Kingfisher", "Kingfisher", "kf" ); proto_register_field_array( proto_kingfisher, hf, array_length( hf ) ); proto_register_subtree_array( ett, array_length( ett ) ); + expert_kingfisher = expert_register_protocol(proto_kingfisher); + expert_register_field_array(expert_kingfisher, ei, array_length(ei)); } diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c index 9b93e235aa..9f0a4e2920 100644 --- a/epan/dissectors/packet-lmp.c +++ b/epan/dissectors/packet-lmp.c @@ -493,6 +493,7 @@ enum hf_lmp_filter_keys { LMPF_VAL_LAD_INFO_SUBOBJ_LSP_ENCODING, LMPF_CHECKSUM, + LMPF_CHECKSUM_STATUS, LMPF_MAX }; @@ -761,13 +762,13 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) if (!pinfo->fragmented && (int) tvb_captured_length(tvb) >= msg_length) { /* The packet isn't part of a fragmented datagram and isn't truncated, so we can checksum it. */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, msg_length); - proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], -1, &ei_lmp_checksum_incorrect, pinfo, + proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], hf_lmp_filter[LMPF_CHECKSUM_STATUS], &ei_lmp_checksum_incorrect, pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], -1, &ei_lmp_checksum_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], hf_lmp_filter[LMPF_CHECKSUM_STATUS], &ei_lmp_checksum_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } else { - proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], -1, &ei_lmp_checksum_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], hf_lmp_filter[LMPF_CHECKSUM_STATUS], &ei_lmp_checksum_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); } offset += 8; @@ -2579,6 +2580,9 @@ proto_register_lmp(void) {&hf_lmp_filter[LMPF_CHECKSUM], { "Message Checksum", "lmp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + {&hf_lmp_filter[LMPF_CHECKSUM_STATUS], + { "Checksum Status", "lmp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL }}, {&hf_lmp_data, { "Data", "lmp.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-mbtcp.c b/epan/dissectors/packet-mbtcp.c index a1b0b80ae2..a6960d2d9c 100644 --- a/epan/dissectors/packet-mbtcp.c +++ b/epan/dissectors/packet-mbtcp.c @@ -144,6 +144,7 @@ static int hf_modbus_reg16 = -1; static int hf_modbus_reg32 = -1; static int hf_mbrtu_unitid = -1; static int hf_mbrtu_crc16 = -1; +static int hf_mbrtu_crc16_status = -1; /* Initialize the subtree pointers */ static gint ett_mbtcp = -1; @@ -622,11 +623,11 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat if (mbrtu_crc) { calc_crc16 = crc16_plain_tvb_offset_seed(tvb, offset, len-2, 0xFFFF); - proto_tree_add_checksum(mbrtu_tree, tvb, len-2, hf_mbrtu_crc16, -1, &ei_mbrtu_crc16_incorrect, pinfo, g_htons(calc_crc16), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(mbrtu_tree, tvb, len-2, hf_mbrtu_crc16, hf_mbrtu_crc16_status, &ei_mbrtu_crc16_incorrect, pinfo, g_htons(calc_crc16), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); } else { - proto_tree_add_checksum(mbrtu_tree, tvb, len-2, hf_mbrtu_crc16, -1, &ei_mbrtu_crc16_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(mbrtu_tree, tvb, len-2, hf_mbrtu_crc16, hf_mbrtu_crc16_status, &ei_mbrtu_crc16_incorrect, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } /* when determining payload length, make sure to ignore the unit ID header & CRC-16 footer bytes */ @@ -1587,6 +1588,11 @@ proto_register_modbus(void) FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_mbrtu_crc16_status, + { "CRC-16 Status", "mbrtu.crc16.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL } + }, }; static ei_register_info mbrtu_ei[] = { diff --git a/epan/dissectors/packet-mrdisc.c b/epan/dissectors/packet-mrdisc.c index 45fa7f4349..8268bae7c4 100644 --- a/epan/dissectors/packet-mrdisc.c +++ b/epan/dissectors/packet-mrdisc.c @@ -37,7 +37,7 @@ #include "config.h" #include -#include +#include #include "packet-igmp.h" @@ -60,6 +60,8 @@ static int hf_option_bytes = -1; static int ett_mrdisc = -1; static int ett_options = -1; +static expert_field ei_checksum = EI_INIT; + #define MC_ALL_ROUTERS 0xe0000002 #define MRDISC_MRA 0x24 @@ -91,7 +93,7 @@ dissect_mrdisc_mra(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, i offset += 1; /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* skip unused bytes */ @@ -160,7 +162,7 @@ dissect_mrdisc_mrst(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, offset += 1; /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; return offset; @@ -179,7 +181,7 @@ dissect_mrdisc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* /* Shouldn't be destined for us */ if (memcmp(pinfo->dst.data, &dst, 4)) - return 0; + return 0; col_set_str(pinfo->cinfo, COL_PROTOCOL, "MRDISC"); col_clear(pinfo->cinfo, COL_INFO); @@ -264,9 +266,17 @@ proto_register_mrdisc(void) &ett_options, }; + static ei_register_info ei[] = { + { &ei_checksum, { "mrdisc.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_mrdisc; + proto_mrdisc = proto_register_protocol("Multicast Router DISCovery protocol", "MRDISC", "mrdisc"); proto_register_field_array(proto_mrdisc, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_mrdisc = expert_register_protocol(proto_mrdisc); + expert_register_field_array(expert_mrdisc, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-msnip.c b/epan/dissectors/packet-msnip.c index 46ea45e359..21553942fd 100644 --- a/epan/dissectors/packet-msnip.c +++ b/epan/dissectors/packet-msnip.c @@ -36,6 +36,7 @@ #include "config.h" #include +#include #include #include "packet-igmp.h" @@ -58,6 +59,8 @@ static int hf_rec_type = -1; static int ett_msnip = -1; static int ett_groups = -1; +static expert_field ei_checksum = EI_INIT; + #define MC_ALL_IGMPV3_ROUTERS 0xe0000016 #define MSNIP_GM 0x23 @@ -89,7 +92,7 @@ dissect_msnip_rmr(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, in offset += 1; /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; while (count--) { @@ -135,7 +138,7 @@ dissect_msnip_is(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset += 1; /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* 16 bit holdtime */ @@ -161,7 +164,7 @@ dissect_msnip_gm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, int offset += 1; /* checksum */ - igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; /* holdtime */ @@ -306,10 +309,17 @@ proto_register_msnip(void) &ett_groups, }; - proto_msnip = proto_register_protocol("MSNIP: Multicast Source Notification of Interest Protocol", - "MSNIP", "msnip"); + static ei_register_info ei[] = { + { &ei_checksum, { "msnip.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_msnip; + + proto_msnip = proto_register_protocol("MSNIP: Multicast Source Notification of Interest Protocol", "MSNIP", "msnip"); proto_register_field_array(proto_msnip, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_msnip = expert_register_protocol(proto_msnip); + expert_register_field_array(expert_msnip, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-mtp2.c b/epan/dissectors/packet-mtp2.c index bc82b455c5..b8081a658e 100644 --- a/epan/dissectors/packet-mtp2.c +++ b/epan/dissectors/packet-mtp2.c @@ -57,6 +57,7 @@ static int hf_mtp2_ext_spare = -1; static int hf_mtp2_sf = -1; static int hf_mtp2_sf_extra = -1; static int hf_mtp2_fcs_16 = -1; +static int hf_mtp2_fcs_16_status = -1; static expert_field ei_mtp2_checksum_error = EI_INIT; @@ -187,7 +188,7 @@ mtp2_decode_crc16(tvbuff_t *tvb, proto_tree *fh_tree, packet_info *pinfo) /* * Compute the FCS and put it into the tree. */ - proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_mtp2_fcs_16, -1, &ei_mtp2_checksum_error, pinfo, mtp2_fcs16(tvb), + proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_mtp2_fcs_16, hf_mtp2_fcs_16_status, &ei_mtp2_checksum_error, pinfo, mtp2_fcs16(tvb), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); } return next_tvb; @@ -387,6 +388,7 @@ proto_register_mtp2(void) { &hf_mtp2_sf, { "Status field", "mtp2.sf", FT_UINT8, BASE_DEC, VALS(status_field_vals), 0x0, NULL, HFILL } }, { &hf_mtp2_sf_extra, { "Status field extra octet", "mtp2.sf_extra", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } }, { &hf_mtp2_fcs_16, { "FCS 16", "mtp2.fcs_16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_mtp2_fcs_16_status, { "FCS 16", "mtp2.fcs_16.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL } }, }; static gint *ett[] = { diff --git a/epan/dissectors/packet-nhrp.c b/epan/dissectors/packet-nhrp.c index a09b730840..45601cb782 100644 --- a/epan/dissectors/packet-nhrp.c +++ b/epan/dissectors/packet-nhrp.c @@ -58,6 +58,7 @@ static int hf_nhrp_hdr_pro_snap_pid = -1; static int hf_nhrp_hdr_hopcnt = -1; static int hf_nhrp_hdr_pktsz = -1; static int hf_nhrp_hdr_chksum = -1; +static int hf_nhrp_hdr_chksum_status = -1; static int hf_nhrp_hdr_extoff = -1; static int hf_nhrp_hdr_version = -1; static int hf_nhrp_hdr_op_type = -1; @@ -149,6 +150,7 @@ static gint ett_nhrp_devcap_ext_dstcap = -1; static expert_field ei_nhrp_ext_not_allowed = EI_INIT; static expert_field ei_nhrp_hdr_extoff = EI_INIT; +static expert_field ei_nhrp_hdr_chksum = EI_INIT; static expert_field ei_nhrp_ext_malformed = EI_INIT; static expert_field ei_nhrp_ext_extra = EI_INIT; @@ -374,10 +376,11 @@ static void dissect_nhrp_hdr(tvbuff_t *tvb, vec_t cksum_vec[1]; SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, total_len); - proto_tree_add_checksum(nhrp_tree, tvb, offset, hf_nhrp_hdr_chksum, -1, NULL, pinfo, in_cksum(&cksum_vec[0], 1), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(nhrp_tree, tvb, offset, hf_nhrp_hdr_chksum, hf_nhrp_hdr_chksum_status, &ei_nhrp_hdr_chksum, + pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(nhrp_tree, tvb, offset, hf_nhrp_hdr_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(nhrp_tree, tvb, offset, hf_nhrp_hdr_chksum, hf_nhrp_hdr_chksum_status, &ei_nhrp_hdr_chksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; @@ -1031,6 +1034,11 @@ proto_register_nhrp(void) FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_nhrp_hdr_chksum_status, + { "NHRP Packet Checksum Status", "nhrp.hdr.chksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL } + }, { &hf_nhrp_hdr_extoff, { "Extension Offset", "nhrp.hdr.extoff", FT_UINT16, BASE_DEC, NULL, 0x0, @@ -1358,6 +1366,7 @@ proto_register_nhrp(void) static ei_register_info ei[] = { { &ei_nhrp_hdr_extoff, { "nhrp.hdr.extoff.invalid", PI_MALFORMED, PI_ERROR, "Extension offset is less than the fixed header length", EXPFILL }}, + { &ei_nhrp_hdr_chksum, { "nhrp.hdr.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, { &ei_nhrp_ext_not_allowed, { "nhrp.ext.not_allowed", PI_MALFORMED, PI_ERROR, "Extensions not allowed per RFC2332 section 5.2.7", EXPFILL }}, { &ei_nhrp_ext_malformed, { "nhrp.ext.malformed", PI_MALFORMED, PI_ERROR, "Incomplete Authentication Extension", EXPFILL }}, { &ei_nhrp_ext_extra, { "nhrp.ext.extra", PI_MALFORMED, PI_ERROR, "Superfluous data follows End Extension", EXPFILL }}, diff --git a/epan/dissectors/packet-ositp.c b/epan/dissectors/packet-ositp.c index 08c671211d..789e7fb73f 100644 --- a/epan/dissectors/packet-ositp.c +++ b/epan/dissectors/packet-ositp.c @@ -70,6 +70,7 @@ static int hf_cotp_parameter_length = -1; static int hf_cotp_parameter_value = -1; static int hf_cotp_atn_extended_checksum16 = -1; static int hf_cotp_atn_extended_checksum32 = -1; +static int hf_cotp_atn_extended_checksum_status = -1; static int hf_cotp_ack_time = -1; static int hf_cotp_res_error_rate_target_value = -1; static int hf_cotp_res_error_rate_min_accept = -1; @@ -93,6 +94,7 @@ static int hf_cotp_lower_window_edge = -1; static int hf_cotp_credit = -1; static int hf_cotp_tpdu_size = -1; static int hf_cotp_checksum = -1; +static int hf_cotp_checksum_status = -1; static int hf_cotp_vp_version_nr = -1; static int hf_cotp_network_expedited_data = -1; static int hf_cotp_vp_opt_sel_class1_use = -1; @@ -122,6 +124,9 @@ static expert_field ei_cotp_reject = EI_INIT; static expert_field ei_cotp_connection = EI_INIT; static expert_field ei_cotp_disconnect_request = EI_INIT; static expert_field ei_cotp_preferred_maximum_tpdu_size = EI_INIT; +static expert_field ei_cotp_atn_extended_checksum = EI_INIT; +static expert_field ei_cotp_checksum = EI_INIT; + static int proto_cltp = -1; static gint ett_cltp = -1; @@ -481,7 +486,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length, offset_iso8073_checksum, pinfo->dst.len, (const guint8 *)pinfo->dst.data, pinfo->src.len, (const guint8 *)pinfo->src.data); - proto_tree_add_checksum(tree, tvb, offset, hf_cotp_atn_extended_checksum16, -1, NULL, pinfo, sum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); + proto_tree_add_checksum(tree, tvb, offset, hf_cotp_atn_extended_checksum16, hf_cotp_atn_extended_checksum_status, &ei_cotp_atn_extended_checksum, + pinfo, sum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); } else { proto_tree_add_bytes_format_value(tree, hf_cotp_parameter_value, tvb, offset, length, NULL, ""); } @@ -511,7 +517,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length, offset_iso8073_checksum, pinfo->dst.len, (const guint8 *)pinfo->dst.data, pinfo->src.len, (const guint8 *)pinfo->src.data); - proto_tree_add_checksum(tree, tvb, offset, hf_cotp_atn_extended_checksum32, -1, NULL, pinfo, sum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); + proto_tree_add_checksum(tree, tvb, offset, hf_cotp_atn_extended_checksum32, hf_cotp_atn_extended_checksum_status, &ei_cotp_atn_extended_checksum, + pinfo, sum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); } else { proto_tree_add_bytes_format_value(tree, hf_cotp_parameter_value, tvb, offset, length, NULL, ""); } @@ -693,15 +700,15 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length, if (tvb_get_ntohs(tvb, offset) == 0) { /* No checksum present */ - proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, hf_cotp_checksum_status, &ei_cotp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); } else { guint32 calc_c0 = 0, calc_c1 = 0; if (osi_calc_checksum(tvb, 0, length, &calc_c0, &calc_c1)) { /* Successfully processed checksum, verify it */ - proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, -1, NULL, pinfo, calc_c0 | calc_c1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); + proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, hf_cotp_checksum_status, &ei_cotp_checksum, pinfo, calc_c0 | calc_c1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); } else { - proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, hf_cotp_checksum_status, &ei_cotp_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } @@ -2324,6 +2331,7 @@ void proto_register_cotp(void) { &hf_cotp_parameter_value, { "Parameter value", "cotp.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_atn_extended_checksum16, { "ATN extended checksum", "cotp.atn_extended_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_atn_extended_checksum32, { "ATN extended checksum", "cotp.atn_extended_checksum", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_cotp_atn_extended_checksum_status, { "ATN extended checksum Status", "cotp.atn_extended_checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_cotp_ack_time, { "Ack time (ms)", "cotp.ack_time", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_res_error_rate_target_value, { "Residual error rate, target value", "cotp.res_error_rate.target_value", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_res_error_rate_min_accept, { "Residual error rate, minimum acceptable", "cotp.res_error_rate.min_accept", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -2347,6 +2355,7 @@ void proto_register_cotp(void) { &hf_cotp_credit, { "Credit", "cotp.credit", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_tpdu_size, { "TPDU size", "cotp.tpdu_size", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_checksum, { "Checksum", "cotp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_cotp_checksum_status, { "Checksum Status", "cotp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_cotp_vp_version_nr, { "Version", "cotp.vp_version_nr", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_cotp_network_expedited_data, { "Use of network expedited data", "cotp.network_expedited_data", FT_BOOLEAN, 8, TFS(&tfs_used_notused), 0x08, NULL, HFILL }}, { &hf_cotp_vp_opt_sel_class1_use, { "Use", "cotp.vp_opt_sel_class1_use", FT_BOOLEAN, 8, TFS(&tfs_vp_opt_sel_class1_use), 0x04, NULL, HFILL }}, @@ -2371,6 +2380,8 @@ void proto_register_cotp(void) { &ei_cotp_disconnect_confirm, { "cotp.disconnect_confirm", PI_SEQUENCE, PI_CHAT, "Disconnect Confirm(DC): 0x%x -> 0x%x", EXPFILL }}, { &ei_cotp_multiple_tpdus, { "cotp.multiple_tpdus", PI_SEQUENCE, PI_NOTE, "Multiple TPDUs in one packet", EXPFILL }}, { &ei_cotp_preferred_maximum_tpdu_size, { "cotp.preferred_maximum_tpdu_size.invalid", PI_PROTOCOL, PI_WARN, "Preferred maximum TPDU size: bogus length", EXPFILL }}, + { &ei_cotp_atn_extended_checksum, { "cotp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + { &ei_cotp_checksum, { "cotp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; module_t *cotp_module; diff --git a/epan/dissectors/packet-pgm.c b/epan/dissectors/packet-pgm.c index d97d1fe31b..254ee615ed 100644 --- a/epan/dissectors/packet-pgm.c +++ b/epan/dissectors/packet-pgm.c @@ -243,6 +243,7 @@ static expert_field ei_pgm_genopt_len = EI_INIT; static expert_field ei_pgm_opt_tlen = EI_INIT; static expert_field ei_pgm_opt_type = EI_INIT; static expert_field ei_address_format_invalid = EI_INIT; +static expert_field ei_pgm_main_cksum = EI_INIT; static dissector_table_t subdissector_table; static heur_dissector_list_t heur_subdissector_list; @@ -910,7 +911,8 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) if ((pgmhdr_type != PGM_RDATA_PCKT) && (pgmhdr_type != PGM_ODATA_PCKT) && (pgmhdr_cksum == 0)) { - proto_tree_add_checksum(pgm_tree, tvb, ptvcursor_current_offset(cursor), hf_pgm_main_cksum, hf_pgm_main_cksum_status, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(pgm_tree, tvb, ptvcursor_current_offset(cursor), hf_pgm_main_cksum, hf_pgm_main_cksum_status, &ei_pgm_main_cksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); } else { reportedlen = tvb_reported_length(tvb); pgmlen = tvb_captured_length(tvb); @@ -918,10 +920,11 @@ dissect_pgm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) vec_t cksum_vec[1]; SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, pgmlen); - proto_tree_add_checksum(pgm_tree, tvb, ptvcursor_current_offset(cursor), hf_pgm_main_cksum_status, -1, NULL, pinfo, - in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(pgm_tree, tvb, ptvcursor_current_offset(cursor), hf_pgm_main_cksum_status, hf_pgm_main_cksum_status, &ei_pgm_main_cksum, + pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(pgm_tree, tvb, ptvcursor_current_offset(cursor), hf_pgm_main_cksum, hf_pgm_main_cksum_status, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(pgm_tree, tvb, ptvcursor_current_offset(cursor), hf_pgm_main_cksum, hf_pgm_main_cksum_status, &ei_pgm_main_cksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } ptvcursor_advance(cursor, 2); @@ -1374,6 +1377,7 @@ proto_register_pgm(void) { &ei_pgm_opt_tlen, { "pgm.opts.tlen.invalid", PI_PROTOCOL, PI_WARN, "Total Length invalid", EXPFILL }}, { &ei_pgm_genopt_len, { "pgm.genopts.len.invalid", PI_PROTOCOL, PI_WARN, "Option length invalid", EXPFILL }}, { &ei_address_format_invalid, { "pgm.address_format_invalid", PI_PROTOCOL, PI_WARN, "Can't handle this address format", EXPFILL }}, + { &ei_pgm_main_cksum, { "pgm.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; module_t *pgm_module; diff --git a/epan/dissectors/packet-pim.c b/epan/dissectors/packet-pim.c index 1f216e6f54..bc51e92c4c 100644 --- a/epan/dissectors/packet-pim.c +++ b/epan/dissectors/packet-pim.c @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "packet-igmp.h" @@ -135,6 +136,7 @@ static int hf_pim_igmp_type = -1; static int hf_pim_df_elect_subtype = -1; static int hf_pim_df_elect_rsvd = -1; static int hf_pim_cksum = -1; +static int hf_pim_cksum_status = -1; static int hf_pim_res_bytes = -1; /* PIM Hello options (RFC 4601, section 4.9.2 and RFC 3973, section 4.7.5) */ static int hf_pim_option = -1; @@ -217,6 +219,9 @@ static gint ett_pim = -1; static gint ett_pim_opts = -1; static gint ett_pim_opt = -1; +static expert_field ei_pim_cksum = EI_INIT; + + static dissector_handle_t ip_handle; static dissector_handle_t ipv6_handle; @@ -353,7 +358,7 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U pim_ver = PIM_VER(tvb_get_guint8(tvb, offset + 2)); if (pim_ver != 1) { - proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); /* * Not PIMv1; should we bother dissecting the PIM drafts @@ -401,10 +406,11 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U * truncated, so we can checksum it. */ SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, pim_length); - proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, -1, NULL, pinfo, in_cksum(&cksum_vec[0], 1), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, + pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; @@ -843,7 +849,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) } if (PIM_VER(pim_typever) != 2) { - proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); /* * We don't know this version, so we don't know how much of the * packet the checksum covers. @@ -885,8 +892,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) switch (pinfo->src.type) { case AT_IPv4: SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, pim_length); - proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, -1, NULL, pinfo, in_cksum(&cksum_vec[0], 1), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, + pinfo, in_cksum(&cksum_vec[0], 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); break; case AT_IPv6: /* Set up the fields of the pseudo-header. */ @@ -896,8 +903,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) phdr[1] = g_htonl(IP_PROTO_PIM); SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 8); SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, pim_length); - proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, -1, NULL, pinfo, in_cksum(&cksum_vec[0], 4), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, + pinfo, in_cksum(&cksum_vec[0], 4), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); break; default: /* PIM is available for IPv4 and IPv6 right now */ @@ -905,7 +912,8 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) break; } } else { - proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, hf_pim_cksum_status, &ei_pim_cksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 4; @@ -1446,6 +1454,11 @@ proto_register_pim(void) FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_pim_cksum_status, + { "Checksum Status", "pim.cksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, + NULL, HFILL } + }, { &hf_pim_res_bytes, { "Reserved byte(s)", "pim.res_bytes", FT_BYTES, BASE_NONE, NULL, 0x0, @@ -1833,12 +1846,19 @@ proto_register_pim(void) &ett_pim_opt /* Tree for each option */ }; + static ei_register_info ei[] = { + { &ei_pim_cksum, { "pim.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_pim; module_t *pim_module; proto_pim = proto_register_protocol("Protocol Independent Multicast", "PIM", "pim"); proto_register_field_array(proto_pim, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_pim = expert_register_protocol(proto_pim); + expert_register_field_array(expert_pim, ei, array_length(ei)); pim_module = prefs_register_protocol(proto_pim, NULL); prefs_register_bool_preference(pim_module, "payload_tree", diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index a3ca67883b..5e6e2b1863 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -114,14 +114,15 @@ static int hf_ppp_opt_type = -1; static int hf_ppp_opt_type_copy = -1; static int hf_ppp_opt_type_class = -1; static int hf_ppp_opt_type_number = -1; -/* Generated from convert_proto_tree_add_text.pl */ static int hf_ppp_fcs_16 = -1; static int hf_ppp_fcs_32 = -1; +static int hf_ppp_fcs_status = -1; static gint ett_ppp = -1; static gint ett_ppp_opt_type = -1; static expert_field ei_ppp_opt_len_invalid = EI_INIT; +static expert_field ei_ppp_fcs = EI_INIT; static int proto_ppp_hdlc = -1; @@ -1825,7 +1826,7 @@ fcs32(tvbuff_t *tvbuff) } tvbuff_t * -decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) +decode_fcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *fh_tree, int fcs_decode, int proto_offset) { tvbuff_t *next_tvb; gint len, reported_len; @@ -1877,7 +1878,7 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) /* * Compute the FCS and put it into the tree. */ - proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_ppp_fcs_16, -1, NULL, NULL, fcs16(tvb), + proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_ppp_fcs_16, hf_ppp_fcs_status, &ei_ppp_fcs, pinfo, fcs16(tvb), ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); } break; @@ -1919,7 +1920,7 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset) /* * Compute the FCS and put it into the tree. */ - proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_ppp_fcs_32, -1, NULL, NULL, fcs32(tvb), + proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_ppp_fcs_32, hf_ppp_fcs_status, &ei_ppp_fcs, pinfo, fcs32(tvb), ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); } break; @@ -5310,7 +5311,7 @@ dissect_ppp_hdlc_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) } } - next_tvb = decode_fcs(tvb, fh_tree, ppp_fcs_decode, proto_offset); + next_tvb = decode_fcs(tvb, pinfo, fh_tree, ppp_fcs_decode, proto_offset); dissect_ppp_common(next_tvb, pinfo, tree, fh_tree, ti, proto_offset); } @@ -5889,9 +5890,15 @@ proto_register_ppp(void) { &hf_ppp_opt_type_number, { "Number", "ppp.opt.type.number", FT_UINT8, BASE_DEC, VALS(ipopt_type_number_vals), IPOPT_NUMBER_MASK, NULL, HFILL}}, - /* Generated from convert_proto_tree_add_text.pl */ - { &hf_ppp_fcs_16, { "FCS 16", "ppp.fcs_16", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, - { &hf_ppp_fcs_32, { "FCS 32", "ppp.fcs_32", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_ppp_fcs_16, + { "FCS 16", "ppp.fcs_16", FT_UINT16, BASE_HEX, + NULL, 0x0, NULL, HFILL }}, + { &hf_ppp_fcs_32, + { "FCS 32", "ppp.fcs_32", FT_UINT32, BASE_HEX, + NULL, 0x0, NULL, HFILL }}, + { &hf_ppp_fcs_status, + { "FCS Status", "ppp.fcs.status", FT_UINT8, BASE_NONE, + VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, }; static gint *ett[] = { &ett_ppp, @@ -5899,13 +5906,13 @@ proto_register_ppp(void) }; static ei_register_info ei[] = { { &ei_ppp_opt_len_invalid, { "ppp.opt.len.invalid", PI_PROTOCOL, PI_WARN, "Invalid length for option", EXPFILL }}, + { &ei_ppp_fcs, { "ppp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; module_t *ppp_module; expert_module_t* expert_ppp; - proto_ppp = proto_register_protocol("Point-to-Point Protocol", "PPP", - "ppp"); + proto_ppp = proto_register_protocol("Point-to-Point Protocol", "PPP", "ppp"); proto_register_field_array(proto_ppp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_ppp = expert_register_protocol(proto_ppp); diff --git a/epan/dissectors/packet-ppp.h b/epan/dissectors/packet-ppp.h index 40c056d06b..e8a4090e19 100644 --- a/epan/dissectors/packet-ppp.h +++ b/epan/dissectors/packet-ppp.h @@ -28,7 +28,7 @@ extern gboolean capture_ppp_hdlc(const guchar *, int, int, capture_packet_info_t *cpinfo, const union wtap_pseudo_header *pseudo_header _U_); -tvbuff_t *decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset); +tvbuff_t *decode_fcs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *fh_tree, int fcs_decode, int proto_offset); /* * Used by the GTP dissector as well. diff --git a/epan/dissectors/packet-rdm.c b/epan/dissectors/packet-rdm.c index 19b8ee5e9b..bdc146a0a8 100644 --- a/epan/dissectors/packet-rdm.c +++ b/epan/dissectors/packet-rdm.c @@ -43,6 +43,7 @@ #include "config.h" #include +#include #include "packet-rdm.h" void proto_register_rdm(void); @@ -663,6 +664,8 @@ static int hf_rdm_pd_rec_value_support = -1; static int ett_rdm = -1; +static expert_field ei_rdm_checksum = EI_INIT; + static guint16 rdm_checksum(tvbuff_t *tvb, guint length) { @@ -2093,7 +2096,7 @@ dissect_rdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) offset += padding_size; } - proto_tree_add_checksum(rdm_tree, tvb, offset, hf_rdm_checksum, hf_rdm_checksum_status, NULL, pinfo, rdm_checksum(tvb, offset), + proto_tree_add_checksum(rdm_tree, tvb, offset, hf_rdm_checksum, hf_rdm_checksum_status, &ei_rdm_checksum, pinfo, rdm_checksum(tvb, offset), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); offset += 2; @@ -2744,11 +2747,18 @@ proto_register_rdm(void) &ett_rdm }; - proto_rdm = proto_register_protocol("Remote Device Management", - "RDM", "rdm"); + static ei_register_info ei[] = { + { &ei_rdm_checksum, { "rdm.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_rdm; + + proto_rdm = proto_register_protocol("Remote Device Management", "RDM", "rdm"); proto_register_field_array(proto_rdm, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); register_dissector("rdm", dissect_rdm, proto_rdm); + expert_rdm = expert_register_protocol(proto_rdm); + expert_register_field_array(expert_rdm, ei, array_length(ei)); } void diff --git a/epan/dissectors/packet-rfid-pn532-hci.c b/epan/dissectors/packet-rfid-pn532-hci.c index cbc3f2e475..3ec5a2655a 100644 --- a/epan/dissectors/packet-rfid-pn532-hci.c +++ b/epan/dissectors/packet-rfid-pn532-hci.c @@ -36,11 +36,13 @@ static int hf_preamble = -1; static int hf_start_code = -1; static int hf_length = -1; static int hf_length_checksum = -1; +static int hf_length_checksum_status = -1; static int hf_extended_length = -1; static int hf_packet_code = -1; static int hf_postable = -1; static int hf_specific_application_level_error_code = -1; static int hf_data_checksum = -1; +static int hf_data_checksum_status = -1; static int hf_ignored = -1; static gint ett_pn532_hci = -1; @@ -126,11 +128,9 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat length = tvb_get_ntohs(tvb, offset); offset += 2; - proto_tree_add_item(main_tree, hf_length_checksum, tvb, offset, 1, ENC_BIG_ENDIAN); checksum = (length >> 8) + (length & 0xFF) + tvb_get_guint8(tvb, offset); - if (checksum != 0) { - proto_tree_add_expert(main_tree, pinfo, &ei_invalid_length_checksum, tvb, offset, 1); - } + proto_tree_add_checksum(main_tree, tvb, offset, hf_length_checksum, hf_length_checksum_status, &ei_invalid_length_checksum, + pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); offset += 1; next_tvb = tvb_new_subset_length(tvb, offset, length); @@ -142,7 +142,7 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat checksum += tvb_get_guint8(tvb, offset - length); length -= 1; } - proto_tree_add_checksum(main_tree, tvb, offset, hf_data_checksum, -1, &ei_invalid_data_checksum, pinfo, 0, + proto_tree_add_checksum(main_tree, tvb, offset, hf_data_checksum, hf_data_checksum_status, &ei_invalid_data_checksum, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); offset += 1; } else { /* Normal Information Frame */ @@ -152,10 +152,9 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat length = tvb_get_guint8(tvb, offset); offset += 1; - proto_tree_add_item(main_tree, hf_length_checksum, tvb, offset, 1, ENC_BIG_ENDIAN); checksum = length + tvb_get_guint8(tvb, offset); - if (checksum != 0) - proto_tree_add_expert(main_tree, pinfo, &ei_invalid_length_checksum, tvb, offset, 1); + proto_tree_add_checksum(main_tree, tvb, offset, hf_length_checksum, hf_length_checksum_status, &ei_invalid_length_checksum, + pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); offset += 1; next_tvb = tvb_new_subset_length(tvb, offset, length); @@ -230,11 +229,21 @@ proto_register_pn532_hci(void) FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL } }, + { &hf_length_checksum_status, + { "Length Checksum Status", "pn532_hci.length_checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x00, + NULL, HFILL } + }, { &hf_data_checksum, { "Data Checksum", "pn532_hci.data_checksum", FT_UINT8, BASE_HEX, NULL, 0x00, NULL, HFILL } }, + { &hf_data_checksum_status, + { "Data Checksum Status", "pn532_hci.data_checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x00, + NULL, HFILL } + }, { &hf_specific_application_level_error_code, { "Specific Application Level Error Code","pn532_hci.specific_application_level_error_code", FT_UINT8, BASE_HEX, NULL, 0x00, diff --git a/epan/dissectors/packet-rgmp.c b/epan/dissectors/packet-rgmp.c index dc0401d22b..3ff8b0e13f 100644 --- a/epan/dissectors/packet-rgmp.c +++ b/epan/dissectors/packet-rgmp.c @@ -30,6 +30,7 @@ #include "config.h" #include +#include #include "packet-igmp.h" void proto_register_rgmp(void); @@ -44,6 +45,8 @@ static int hf_maddr = -1; static int ett_rgmp = -1; +static expert_field ei_checksum = EI_INIT; + static dissector_handle_t rgmp_handle; #define MC_RGMP 0xe0000019 @@ -86,7 +89,7 @@ dissect_rgmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void* d proto_tree_add_item(tree, hf_reserved, tvb, offset, 1, ENC_NA); offset += 1; - igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0); + igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, &ei_checksum, pinfo, 0); offset += 2; proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN); @@ -130,9 +133,17 @@ proto_register_rgmp(void) &ett_rgmp }; + static ei_register_info ei[] = { + { &ei_checksum, { "rgmp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_rgmp; + proto_rgmp = proto_register_protocol("Router-port Group Management Protocol", "RGMP", "rgmp"); proto_register_field_array(proto_rgmp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_rgmp = expert_register_protocol(proto_rgmp); + expert_register_field_array(expert_rgmp, ei, array_length(ei)); rgmp_handle = register_dissector("rgmp", dissect_rgmp, proto_rgmp); } diff --git a/epan/dissectors/packet-synphasor.c b/epan/dissectors/packet-synphasor.c index 47760b50ee..07f6a58dc4 100644 --- a/epan/dissectors/packet-synphasor.c +++ b/epan/dissectors/packet-synphasor.c @@ -110,6 +110,7 @@ static int hf_command = -1; /* Generated from convert_proto_tree_add_text.pl */ static int hf_synphasor_data = -1; static int hf_synphasor_checksum = -1; +static int hf_synphasor_checksum_status = -1; static int hf_synphasor_num_phasors = -1; static int hf_synphasor_num_analog_values = -1; static int hf_synphasor_num_digital_status_words = -1; @@ -129,6 +130,7 @@ static int hf_synphasor_status_word_mask_normal_state = -1; static int hf_synphasor_status_word_mask_valid_bits = -1; static expert_field ei_synphasor_extended_frame_data = EI_INIT; +static expert_field ei_synphasor_checksum = EI_INIT; static dissector_handle_t synphasor_udp_handle; @@ -546,8 +548,8 @@ static int dissect_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v /* check CRC, call appropriate subdissector for the rest of the frame if CRC is correct*/ sub_item = proto_tree_add_item(synphasor_tree, hf_synphasor_data, tvb, offset, tvbsize - 16, ENC_NA); crc_good = check_crc(tvb, &crc); - proto_tree_add_checksum(synphasor_tree, tvb, tvbsize - 2, hf_synphasor_checksum, -1, NULL, pinfo, crc16_x25_ccitt_tvb(tvb, tvb_get_ntohs(tvb, 2) - 2), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(synphasor_tree, tvb, tvbsize - 2, hf_synphasor_checksum, hf_synphasor_checksum_status, &ei_synphasor_checksum, + pinfo, crc16_x25_ccitt_tvb(tvb, tvb_get_ntohs(tvb, 2) - 2), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); if (!crc_good) { proto_item_append_text(sub_item, ", not dissected because of wrong checksum"); } @@ -1297,6 +1299,7 @@ void proto_register_synphasor(void) /* Generated from convert_proto_tree_add_text.pl */ { &hf_synphasor_data, { "Data", "synphasor.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_synphasor_checksum, { "Checksum", "synphasor.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_synphasor_checksum_status, { "Checksum Status", "synphasor.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, { &hf_synphasor_num_phasors, { "Number of phasors", "synphasor.num_phasors", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_synphasor_num_analog_values, { "Number of analog values", "synphasor.num_analog_values", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_synphasor_num_digital_status_words, { "Number of digital status words", "synphasor.num_digital_status_words", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, @@ -1342,6 +1345,7 @@ void proto_register_synphasor(void) static ei_register_info ei[] = { { &ei_synphasor_extended_frame_data, { "synphasor.extended_frame_data.unaligned", PI_PROTOCOL, PI_WARN, "Size not multiple of 16-bit word", EXPFILL }}, + { &ei_synphasor_checksum, { "synphasor.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; module_t *synphasor_module; diff --git a/epan/dissectors/packet-sysex.c b/epan/dissectors/packet-sysex.c index e5e827bdbb..8a807ee31a 100644 --- a/epan/dissectors/packet-sysex.c +++ b/epan/dissectors/packet-sysex.c @@ -89,6 +89,7 @@ static int hf_digitech_ack_request_proc_id = -1; static int hf_digitech_nack_request_proc_id = -1; static int hf_digitech_checksum = -1; +static int hf_digitech_checksum_status = -1; static gint ett_sysex = -1; @@ -1186,7 +1187,7 @@ dissect_sysex_command(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree digitech_helper ^= *data_ptr++; } - proto_tree_add_checksum(tree, tvb, offset, hf_digitech_checksum, -1, &ei_digitech_checksum_bad, pinfo, digitech_helper, + proto_tree_add_checksum(tree, tvb, offset, hf_digitech_checksum, hf_digitech_checksum_status, &ei_digitech_checksum_bad, pinfo, digitech_helper, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO); offset++; break; @@ -1382,6 +1383,9 @@ proto_register_sysex(void) { &hf_digitech_checksum, { "Checksum", "sysex.digitech.checksum", FT_UINT8, BASE_HEX, NULL, 0, NULL, HFILL }}, + { &hf_digitech_checksum_status, + { "Checksum Status", "sysex.digitech.checksum.status", FT_UINT8, BASE_NONE, + VALS(proto_checksum_vals), 0, NULL, HFILL }}, }; static gint *sysex_subtrees[] = { diff --git a/epan/dissectors/packet-teamspeak2.c b/epan/dissectors/packet-teamspeak2.c index 388dd4dba1..c3e5916908 100644 --- a/epan/dissectors/packet-teamspeak2.c +++ b/epan/dissectors/packet-teamspeak2.c @@ -25,6 +25,7 @@ #include "config.h" #include +#include #include #include #include @@ -119,6 +120,8 @@ static int hf_msg_reassembled_length = -1; static gint ett_msg_fragment = -1; static gint ett_msg_fragments = -1; +static expert_field ei_ts2_crc32 = EI_INIT; + static const fragment_items msg_frag_items = { /* Fragment subtrees */ &ett_msg_fragment, @@ -230,6 +233,7 @@ static int hf_ts2_class = -1; static int hf_ts2_clientid = -1; static int hf_ts2_sessionkey = -1; static int hf_ts2_crc32 = -1; +static int hf_ts2_crc32_status = -1; static int hf_ts2_ackto = -1; static int hf_ts2_seqnum = -1; static int hf_ts2_protocol_string = -1; @@ -304,7 +308,7 @@ typedef struct static reassembly_table msg_reassembly_table; /* forward reference */ -static void ts2_add_checked_crc32(proto_tree *tree, int hf_item, tvbuff_t *tvb, guint16 offset); +static void ts2_add_checked_crc32(proto_tree *tree, int hf_item, int hf_item_status, expert_field* ei_item, tvbuff_t *tvb, packet_info *pinfo, guint16 offset); static void ts2_parse_playerlist(tvbuff_t *tvb, proto_tree *ts2_tree); static void ts2_parse_channellist(tvbuff_t *tvb, proto_tree *ts2_tree); static void ts2_parse_newplayerjoined(tvbuff_t *tvb, proto_tree *ts2_tree); @@ -421,7 +425,7 @@ static void ts2_standard_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree * proto_tree_add_item(ts2_tree, hf_ts2_resend_count, tvb, 16, 2, ENC_LITTLE_ENDIAN); proto_tree_add_item(ts2_tree, hf_ts2_fragmentnumber, tvb, 18, 2, ENC_LITTLE_ENDIAN); - ts2_add_checked_crc32(ts2_tree, hf_ts2_crc32, tvb, 20); + ts2_add_checked_crc32(ts2_tree, hf_ts2_crc32, hf_ts2_crc32_status, &ei_ts2_crc32, tvb, pinfo, 20); /* Reassemble the packet if it's fragmented */ new_tvb = NULL; @@ -764,7 +768,7 @@ static int dissect_ts2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void { case TS2C_CONNECTION: proto_tree_add_item(ts2_tree, hf_ts2_seqnum, tvb, 12, 4, ENC_LITTLE_ENDIAN); - ts2_add_checked_crc32(ts2_tree, hf_ts2_crc32, tvb, 16); + ts2_add_checked_crc32(ts2_tree, hf_ts2_crc32, hf_ts2_crc32_status, &ei_ts2_crc32, tvb, pinfo, 16); switch(type) { @@ -816,7 +820,7 @@ static int dissect_ts2(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void /* Calculates a CRC32 checksum from the tvb zeroing out four bytes at the offset and checks it with the given crc32 and adds the result to the tree * Returns true if the calculated CRC32 matches the passed CRC32. * */ -static void ts2_add_checked_crc32(proto_tree *tree, int hf_item, tvbuff_t *tvb, guint16 offset) +static void ts2_add_checked_crc32(proto_tree *tree, int hf_item, int hf_item_status, expert_field* ei_item, tvbuff_t *tvb, packet_info *pinfo, guint16 offset) { guint32 zero = 0; gint len = tvb_reported_length_remaining(tvb, offset+4); @@ -829,7 +833,7 @@ static void ts2_add_checked_crc32(proto_tree *tree, int hf_item, tvbuff_t *tvb, ocrc32 = crc32_ccitt_seed((guint8*)&zero, 4, 0xffffffff-ocrc32); ocrc32 = crc32_ccitt_tvb_offset_seed(tvb, offset+4, (guint)len, 0xffffffff-ocrc32); - proto_tree_add_checksum(tree, tvb, offset, hf_item, -1, NULL, NULL, ocrc32, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(tree, tvb, offset, hf_item, hf_item_status, ei_item, pinfo, ocrc32, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY); } static void ts2_init(void) @@ -885,6 +889,12 @@ void proto_register_ts2(void) NULL, 0x0, NULL, HFILL } }, + { &hf_ts2_crc32_status, + { "CRC32 Checksum Status", "ts2.crc32.status", + FT_UINT8, BASE_NONE, + VALS(proto_checksum_vals), 0x0, + NULL, HFILL } + }, { &hf_ts2_seqnum, { "Sequence Number", "ts2.sequencenum", FT_UINT32, BASE_DEC, @@ -1204,14 +1214,18 @@ void proto_register_ts2(void) &ett_ts2_channel_flags }; + static ei_register_info ei[] = { + { &ei_ts2_crc32, { "ts2.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_ts2; + /* Setup protocol subtree array */ - proto_ts2 = proto_register_protocol ( - "Teamspeak2 Protocol", /* name */ - "TeamSpeak2", /* short name */ - "ts2" /* abbrev */ - ); + proto_ts2 = proto_register_protocol ("Teamspeak2 Protocol", "TeamSpeak2", "ts2"); proto_register_field_array(proto_ts2, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_ts2 = expert_register_protocol(proto_ts2); + expert_register_field_array(expert_ts2, ei, array_length(ei)); register_init_routine(ts2_init); register_cleanup_routine(ts2_cleanup); diff --git a/epan/dissectors/packet-udp.c b/epan/dissectors/packet-udp.c index ce4ad54507..9335f17fa1 100644 --- a/epan/dissectors/packet-udp.c +++ b/epan/dissectors/packet-udp.c @@ -885,7 +885,8 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) if (udph->uh_sum == 0) { /* No checksum supplied in the packet. */ if (((ip_proto == IP_PROTO_UDP) && (pinfo->src.type == AT_IPv4)) || pinfo->flags.in_error_pkt) { - proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT); + proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } else { item = proto_tree_add_uint_format_value(udp_tree, hfi_udp_checksum.id, tvb, offset + 6, 2, 0, "0 (Illegal)"); checksum_tree = proto_item_add_subtree(item, ett_udp_checksum); @@ -938,8 +939,8 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, offset, udph->uh_sum_cov); computed_cksum = in_cksum(&cksum_vec[0], 4); - item = proto_tree_add_checksum(udp_tree, tvb, offset+6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, computed_cksum, - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + item = proto_tree_add_checksum(udp_tree, tvb, offset+6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, + pinfo, computed_cksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); checksum_tree = proto_item_add_subtree(item, ett_udp_checksum); if (computed_cksum != 0) { @@ -954,10 +955,10 @@ dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint32 ip_proto) PROTO_ITEM_SET_GENERATED(calc_item); } else { - proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } } else { - proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(udp_tree, tvb, offset + 6, hfi_udp_checksum.id, hfi_udp_checksum_status.id, &ei_udp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } /* Skip over header */ diff --git a/epan/dissectors/packet-v5dl.c b/epan/dissectors/packet-v5dl.c index 1c4ed88e12..6dc1603142 100644 --- a/epan/dissectors/packet-v5dl.c +++ b/epan/dissectors/packet-v5dl.c @@ -33,6 +33,7 @@ #include "config.h" #include +#include #include void proto_register_v5dl(void); @@ -68,6 +69,8 @@ static gint ett_v5dl_address = -1; static gint ett_v5dl_control = -1; /* static gint ett_v5dl_checksum = -1; */ +static expert_field ei_v5dl_checksum = EI_INIT; + static dissector_handle_t v52_handle; /* @@ -243,8 +246,8 @@ dissect_v5dl(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ checksum_calculated = crc16_ccitt_tvb(tvb, checksum_offset); checksum_calculated = g_htons(checksum_calculated); /* Note: g_htons() macro may eval arg multiple times */ - proto_tree_add_checksum(v5dl_tree, tvb, checksum_offset, hf_v5dl_checksum, hf_v5dl_checksum_status, NULL, pinfo, checksum_calculated, - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); + proto_tree_add_checksum(v5dl_tree, tvb, checksum_offset, hf_v5dl_checksum, hf_v5dl_checksum_status, &ei_v5dl_checksum, + pinfo, checksum_calculated, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); /* * Remove the V5DL header *and* the checksum. */ @@ -401,10 +404,17 @@ proto_register_v5dl(void) /* &ett_v5dl_checksum */ }; - proto_v5dl = proto_register_protocol("V5 Data Link Layer", - "V5DL", "v5dl"); + static ei_register_info ei[] = { + { &ei_v5dl_checksum, { "v5dl.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_v5dl; + + proto_v5dl = proto_register_protocol("V5 Data Link Layer", "V5DL", "v5dl"); proto_register_field_array (proto_v5dl, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); + expert_v5dl = expert_register_protocol(proto_v5dl); + expert_register_field_array(expert_v5dl, ei, array_length(ei)); register_dissector("v5dl", dissect_v5dl, proto_v5dl); } diff --git a/epan/dissectors/packet-xip-serval.c b/epan/dissectors/packet-xip-serval.c index ae1219ff1d..b8f458dd6c 100644 --- a/epan/dissectors/packet-xip-serval.c +++ b/epan/dissectors/packet-xip-serval.c @@ -41,6 +41,7 @@ static gint proto_xip_serval = -1; static gint hf_xip_serval_hl = -1; static gint hf_xip_serval_proto = -1; static gint hf_xip_serval_check = -1; +static gint hf_xip_serval_check_status = -1; /* XIP Serval general extension header. */ static gint hf_xip_serval_ext_type = -1; @@ -216,7 +217,7 @@ display_xip_serval(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) /* Compute checksum. */ SET_CKSUM_VEC_TVB(cksum_vec, tvb, 0, xsh_len); - proto_tree_add_checksum(xip_serval_tree, tvb, XSRVL_CHK, hf_xip_serval_check, -1, &ei_xip_serval_bad_checksum, pinfo, in_cksum(&cksum_vec, 1), + proto_tree_add_checksum(xip_serval_tree, tvb, XSRVL_CHK, hf_xip_serval_check, hf_xip_serval_check_status, &ei_xip_serval_bad_checksum, pinfo, in_cksum(&cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); offset = XSRVL_EXT; @@ -293,6 +294,10 @@ proto_register_xip_serval(void) { "Checksum", "xip_serval.check", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }}, + { &hf_xip_serval_check_status, + { "Checksum Status", "xip_serval.check.status", FT_UINT8, + BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }}, + /* Serval Extension Header. */ { &hf_xip_serval_ext_type, diff --git a/epan/dissectors/packet-xtp.c b/epan/dissectors/packet-xtp.c index 7f36a1b304..3cf097edfd 100644 --- a/epan/dissectors/packet-xtp.c +++ b/epan/dissectors/packet-xtp.c @@ -301,6 +301,7 @@ static int hf_xtp_diag_code = -1; static int hf_xtp_diag_val = -1; static int hf_xtp_diag_msg = -1; static int hf_xtp_checksum = -1; +static int hf_xtp_checksum_status = -1; static int hf_xtp_data = -1; /* Initialize the subtree pointers */ @@ -319,6 +320,7 @@ static gint ett_xtp_data = -1; static gint ett_xtp_diag = -1; static expert_field ei_xtp_spans_bad = EI_INIT; +static expert_field ei_xtp_checksum = EI_INIT; /* dissector of each payload */ static int @@ -1017,12 +1019,12 @@ dissect_xtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_) if (!(xtph->cmd_options & XTP_CMD_OPTIONS_NOCHECK)) check_len += xtph->dlen; SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, check_len); - proto_tree_add_checksum(xtp_tree, tvb, offset, hf_xtp_checksum, -1, NULL, pinfo, in_cksum(cksum_vec, 1), - ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); + proto_tree_add_checksum(xtp_tree, tvb, offset, hf_xtp_checksum, hf_xtp_checksum_status, &ei_xtp_checksum, + pinfo, in_cksum(cksum_vec, 1), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM); } else { - proto_tree_add_checksum(xtp_tree, tvb, offset, hf_xtp_checksum, -1, NULL, pinfo, 0, - ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); + proto_tree_add_checksum(xtp_tree, tvb, offset, hf_xtp_checksum, hf_xtp_checksum_status, &ei_xtp_checksum, + pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); } offset += 2; /* sort(2) */ @@ -1341,6 +1343,10 @@ proto_register_xtp(void) { "Checksum", "xtp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } }, + { &hf_xtp_checksum_status, + { "Checksum Status", "xtp.checksum.status", + FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL } + }, { &hf_xtp_data, { "Data", "xtp.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } @@ -1366,6 +1372,8 @@ proto_register_xtp(void) static ei_register_info ei[] = { { &ei_xtp_spans_bad, { "xtp.spans_bad", PI_MALFORMED, PI_ERROR, "Number of spans incorrect", EXPFILL }}, + { &ei_xtp_checksum, + { "xtp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, }; expert_module_t* expert_xtp; @@ -1373,8 +1381,7 @@ proto_register_xtp(void) expert_xtp = expert_register_protocol(proto_xtp); expert_register_field_array(expert_xtp, ei, array_length(ei)); - proto_xtp = proto_register_protocol("Xpress Transport Protocol", - "XTP", "xtp"); + proto_xtp = proto_register_protocol("Xpress Transport Protocol", "XTP", "xtp"); proto_register_field_array(proto_xtp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } diff --git a/epan/dissectors/packet-zrtp.c b/epan/dissectors/packet-zrtp.c index b73509193a..ef1ba3382f 100644 --- a/epan/dissectors/packet-zrtp.c +++ b/epan/dissectors/packet-zrtp.c @@ -27,6 +27,7 @@ #include "config.h" #include +#include #include #include #include "packet-rtp.h" @@ -130,6 +131,10 @@ static gint ett_zrtp_msg_sc = -1; static gint ett_zrtp_checksum = -1; + +static expert_field ei_zrtp_checksum = EI_INIT; + + /* Definitions */ @@ -416,7 +421,7 @@ dissect_zrtp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_ calc_crc = ~crc32c_tvb_offset_calculate(tvb, 0, msg_offset+checksum_offset, CRC32C_PRELOAD); - proto_tree_add_checksum(zrtp_tree, tvb, msg_offset+checksum_offset, hf_zrtp_checksum, hf_zrtp_checksum_status, NULL, pinfo, calc_crc, + proto_tree_add_checksum(zrtp_tree, tvb, msg_offset+checksum_offset, hf_zrtp_checksum, hf_zrtp_checksum_status, &ei_zrtp_checksum, pinfo, calc_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY); return tvb_captured_length(tvb); } @@ -1128,10 +1133,18 @@ proto_register_zrtp(void) &ett_zrtp_checksum }; + static ei_register_info ei[] = { + { &ei_zrtp_checksum, { "zrtp.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }}, + }; + + expert_module_t* expert_zrtp; + proto_zrtp = proto_register_protocol("ZRTP", "ZRTP", "zrtp"); proto_register_field_array(proto_zrtp, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); register_dissector("zrtp", dissect_zrtp, proto_zrtp); + expert_zrtp = expert_register_protocol(proto_zrtp); + expert_register_field_array(expert_zrtp, ei, array_length(ei)); } void diff --git a/epan/proto.c b/epan/proto.c index 86c15bcd39..fbf0b70bc4 100644 --- a/epan/proto.c +++ b/epan/proto.c @@ -10118,31 +10118,9 @@ proto_tree_add_checksum(proto_tree *tree, tvbuff_t *tvb, const guint offset, if (bad_checksum_expert != NULL) expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum"); } else { - switch(hfinfo->type) - { - case FT_UINT8: - proto_item_append_text(ti, " [incorrect, should be 0x%02x]", computed_checksum); - if (bad_checksum_expert != NULL) - expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%02x]", computed_checksum); - break; - case FT_UINT16: - proto_item_append_text(ti, " [incorrect, should be 0x%04x]", computed_checksum); - if (bad_checksum_expert != NULL) - expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%04x]", computed_checksum); - break; - case FT_UINT24: - proto_item_append_text(ti, " [incorrect, should be 0x%06x]", computed_checksum); - if (bad_checksum_expert != NULL) - expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%06x]", computed_checksum); - break; - case FT_UINT32: - proto_item_append_text(ti, " [incorrect, should be 0x%08x]", computed_checksum); - if (bad_checksum_expert != NULL) - expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%08x]", computed_checksum); - break; - default: - DISSECTOR_ASSERT_NOT_REACHED(); - } + proto_item_append_text(ti, " incorrect, should be 0x%0*x", len*2, computed_checksum); + if (bad_checksum_expert != NULL) + expert_add_info_format(pinfo, ti, bad_checksum_expert, "Bad checksum [should be 0x%0*x]", len*2, computed_checksum); } } } else { -- cgit v1.2.3