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 <mmann78@netscape.net>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Anders Broman <a.broman58@gmail.com>
This commit is contained in:
Michael Mann 2016-07-21 10:21:25 -04:00 committed by Anders Broman
parent b7f1e99f7f
commit 8b0e9c6672
55 changed files with 673 additions and 225 deletions

View File

@ -1406,6 +1406,11 @@ protocol or field labels to the proto_tree:
proto_tree_add_eui64_format_value(tree, id, tvb, start, length,
value, format, ...);
proto_item *
proto_tree_add_checksum(proto_tree *tree, tvbuff_t *tvb, const guint offset,
const int hf_checksum, const int hf_checksum_status, struct expert_field* bad_checksum_expert,
packet_info *pinfo, guint32 computed_checksum, const guint encoding, const guint flags);
proto_item *
proto_tree_add_bitmask(tree, tvb, start, header, ett, fields,
encoding);
@ -1805,6 +1810,15 @@ With these routines, unlike the proto_tree_add_XXX_format() routines,
the name of the field is added automatically as in the
proto_tree_add_XXX() functions; only the value is added with the format.
proto_tree_add_checksum()
----------------------------
proto_tree_add_checksum is used to add a checksum field. The hf field
provided must be the correct size of the checksum (FT_UINT, FT_UINT16,
FT_UINT32, etc). Additional parameters are there to provide "status"
and expert info depending on whether the checksum matches the provided
value. The "status" and expert info can be used in cases except
where PROTO_CHECKSUM_NO_FLAGS is used.
proto_tree_add_subtree()
---------------------
proto_tree_add_subtree() is used to add a label to the GUI tree and create

View File

@ -26,6 +26,7 @@
#include <epan/packet.h>
#include <epan/ipproto.h>
#include <epan/expert.h>
#include <epan/in_cksum.h>
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

View File

@ -28,6 +28,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/in_cksum.h>
#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",

View File

@ -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");

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -49,6 +49,7 @@
#include <epan/packet.h>
#include <epan/etypes.h>
#include <epan/expert.h>
#include <epan/ppptypes.h>
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

View File

@ -39,6 +39,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#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

View File

@ -33,6 +33,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/etypes.h>
#include <epan/expert.h>
#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));

View File

@ -53,6 +53,7 @@
#include <epan/packet.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#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);

View File

@ -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 }},

View File

@ -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[] = {

View File

@ -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;

View File

@ -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;

View File

@ -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[] = {

View File

@ -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,

View File

@ -28,6 +28,7 @@
#include <epan/circuit.h>
#include <epan/conversation.h>
#include <epan/exceptions.h>
#include <epan/expert.h>
#include <epan/stream.h>
#include <epan/golay.h>
#include <epan/iax2_codec_type.h>
@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -43,6 +43,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#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

View File

@ -109,6 +109,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/range.h>
#include <epan/to_str.h>
#include <epan/ipproto.h>
@ -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);

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -27,6 +27,7 @@
#include <epan/packet.h>
#include <epan/conversation.h>
#include <epan/expert.h>
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));
}

View File

@ -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 }},

View File

@ -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[] = {

View File

@ -37,7 +37,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/exceptions.h>
#include <epan/expert.h>
#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

View File

@ -36,6 +36,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/to_str.h>
#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

View File

@ -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[] = {

View File

@ -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 }},

View File

@ -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, "<not shown>");
}
@ -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, "<not shown>");
}
@ -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;

View File

@ -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;

View File

@ -27,6 +27,7 @@
#include <epan/ipproto.h>
#include <epan/afn.h>
#include <epan/prefs.h>
#include <epan/expert.h>
#include <epan/in_cksum.h>
#include <epan/to_str.h>
#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",

View File

@ -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);

View File

@ -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.

View File

@ -43,6 +43,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#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

View File

@ -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,

View File

@ -30,6 +30,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#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);
}

View File

@ -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;

View File

@ -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[] = {

View File

@ -25,6 +25,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <wsutil/crc32.h>
#include <epan/crc32-tvb.h>
#include <epan/reassemble.h>
@ -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);

View File

@ -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 */

View File

@ -33,6 +33,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/xdlc.h>
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);
}

View File

@ -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,

View File

@ -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));
}

View File

@ -27,6 +27,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/crc32-tvb.h>
#include <wsutil/crc32.h>
#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

View File

@ -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 {

View File

@ -25,6 +25,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include <epan/crc16-tvb.h>
/** Serial infrared port. */
@ -60,6 +61,8 @@ static int hf_sir_fcs_status = -1;
static int hf_sir_length = -1;
static int hf_sir_preamble = -1;
static expert_field ei_sir_fcs = EI_INIT;
/* Copied and renamed from proto.c because global value_strings don't work for plugins */
static const value_string plugin_proto_checksum_vals[] = {
{ PROTO_CHECKSUM_E_BAD, "Bad" },
@ -101,13 +104,13 @@ unescape_data(tvbuff_t *tvb, packet_info *pinfo)
/** Checksums the data. */
static tvbuff_t *
checksum_data(tvbuff_t *tvb, proto_tree *tree)
checksum_data(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
{
int len = tvb_reported_length(tvb) - 2;
if (len < 0)
return tvb;
proto_tree_add_checksum(tree, tvb, len, hf_sir_fcs, hf_sir_fcs_status, NULL, NULL, crc16_ccitt_tvb(tvb, len),
proto_tree_add_checksum(tree, tvb, len, hf_sir_fcs, hf_sir_fcs_status, &ei_sir_fcs, pinfo, crc16_ccitt_tvb(tvb, len),
ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
return tvb_new_subset_length(tvb, 0, len);
@ -153,11 +156,11 @@ dissect_sir(tvbuff_t *tvb, packet_info *pinfo, proto_tree *root, void* data _U_)
bof_offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_uint(tree, hf_sir_length,
next_tvb, 0, data_len, data_len);
next_tvb = checksum_data(next_tvb, tree);
next_tvb = checksum_data(next_tvb, pinfo, tree);
proto_tree_add_item(tree, hf_sir_eof, tvb,
eof_offset, 1, ENC_BIG_ENDIAN);
} else {
next_tvb = checksum_data(next_tvb, NULL);
next_tvb = checksum_data(next_tvb, pinfo, NULL);
}
call_dissector(irda_handle, next_tvb, pinfo, root);
}
@ -216,12 +219,18 @@ proto_register_irsir(void)
NULL, HFILL }}
};
proto_sir = proto_register_protocol(
"Serial Infrared", "SIR", "sir");
static ei_register_info ei[] = {
{ &ei_sir_fcs, { "sir.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
expert_module_t* expert_sir;
proto_sir = proto_register_protocol("Serial Infrared", "SIR", "sir");
register_dissector("sir", dissect_sir, proto_sir);
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(
proto_sir, hf_sir, array_length(hf_sir));
proto_register_field_array( proto_sir, hf_sir, array_length(hf_sir));
expert_sir = expert_register_protocol(proto_sir);
expert_register_field_array(expert_sir, ei, array_length(ei));
}
/*

View File

@ -170,6 +170,7 @@ static int hf_mac_header_generic_len = -1;
static int hf_mac_header_generic_cid = -1;
static int hf_mac_header_generic_hcs = -1;
static int hf_mac_header_generic_crc = -1;
static int hf_mac_header_generic_crc_status = -1;
/* MAC Header types */
static const value_string ht_msgs[] =
@ -586,6 +587,7 @@ static gint hf_mac_header_payload_fragment = -1;
static expert_field ei_mac_crc_malformed = EI_INIT;
static expert_field ei_mac_crc_missing = EI_INIT;
static expert_field ei_mac_header_generic_crc = EI_INIT;
/* Last IE Indicators */
static const value_string last_ie_msgs[] =
@ -595,6 +597,16 @@ static const value_string last_ie_msgs[] =
{ 0, NULL}
};
/* Copied and renamed from proto.c because global value_strings don't work for plugins */
static const value_string plugin_proto_checksum_vals[] = {
{ PROTO_CHECKSUM_E_BAD, "Bad" },
{ PROTO_CHECKSUM_E_GOOD, "Good" },
{ PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" },
{ PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" },
{ 0, NULL }
};
/* Register Wimax defrag table init routine. */
static void wimax_defragment_init(void)
{
@ -1222,8 +1234,8 @@ check_crc:
/* calculate the CRC */
calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc));
/* display the CRC */
proto_tree_add_checksum(tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_generic_crc, -1, NULL, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
proto_tree_add_checksum(tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_generic_crc, hf_mac_header_generic_crc_status, &ei_mac_header_generic_crc,
pinfo, calculated_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
}
else
{ /* display error message */
@ -1612,7 +1624,17 @@ void proto_register_mac_header_generic(void)
FT_UINT32, BASE_HEX, NULL, 0x0,
NULL, HFILL
}
}
},
{
&hf_mac_header_generic_crc_status,
{
"CRC Status", "wmx.genericCrc.status",
FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0,
NULL, HFILL
}
},
};
/* Extended Subheader display */
@ -2238,6 +2260,7 @@ void proto_register_mac_header_generic(void)
static ei_register_info ei[] = {
{ &ei_mac_crc_malformed, { "wmx.genericCrc.missing", PI_MALFORMED, PI_ERROR, "CRC missing - the frame is too short", EXPFILL }},
{ &ei_mac_crc_missing, { "wmx.genericCrc.missing", PI_PROTOCOL, PI_NOTE, "CRC is not included in this frame!", EXPFILL }},
{ &ei_mac_header_generic_crc, { "wmx.genericCrc.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
expert_module_t* expert_mac_header_generic;

View File

@ -314,7 +314,9 @@ static gint hf_308a_type = -1;
static gint hf_308a_mult = -1;
static gint hf_308a_rsv = -1;
static gint hf_mac_header_compress_dlmap_crc = -1;
static gint hf_mac_header_compress_dlmap_crc_status = -1;
static gint hf_crc16 = -1;
static gint hf_crc16_status = -1;
static gint hf_padding = -1;
static gint hf_cid_mask = -1;
static gint hf_reserved = -1;
@ -601,6 +603,18 @@ static int hf_dlmap_reduced_aas_spid = -1;
static expert_field ei_dlmap_not_implemented = EI_INIT;
static expert_field ei_crc16 = EI_INIT;
static expert_field ei_mac_header_compress_dlmap_crc = EI_INIT;
/* Copied and renamed from proto.c because global value_strings don't work for plugins */
static const value_string plugin_proto_checksum_vals[] = {
{ PROTO_CHECKSUM_E_BAD, "Bad" },
{ PROTO_CHECKSUM_E_GOOD, "Good" },
{ PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" },
{ PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" },
{ 0, NULL }
};
/********************************************************************
* DL-MAP Miscellaneous IEs and TLVs
@ -818,7 +832,7 @@ static gint DL_HARQ_Chase_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
return (BIT_TO_NIB(bit) - offset);
}
static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@ -866,7 +880,7 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -874,7 +888,7 @@ static gint DL_HARQ_IR_CTC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
return (BIT_TO_NIB(bit) - offset);
}
static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@ -930,7 +944,7 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -938,7 +952,7 @@ static gint DL_HARQ_IR_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint
return (BIT_TO_NIB(bit) - offset);
}
static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@ -991,7 +1005,7 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset,
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -999,7 +1013,7 @@ static gint MIMO_DL_Chase_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset,
return (BIT_TO_NIB(bit) - offset);
}
static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@ -1045,7 +1059,7 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gin
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -1053,7 +1067,7 @@ static gint MIMO_DL_IR_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gin
return (BIT_TO_NIB(bit) - offset);
}
static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@ -1100,7 +1114,7 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offs
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -1108,7 +1122,7 @@ static gint MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(proto_tree *diuc_tree, gint offs
return (BIT_TO_NIB(bit) - offset);
}
static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* offset of IE in nibbles, length is variable */
gint bit;
@ -1153,7 +1167,7 @@ static gint MIMO_DL_STC_HARQ_sub_burst_IE(proto_tree *diuc_tree, gint offset, gi
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, NULL, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -1339,7 +1353,7 @@ static gint Skip_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *t
return BIT_TO_NIB(bit);
}
static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbuff_t *tvb)
static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, packet_info *pinfo, gint offset, gint length, tvbuff_t *tvb)
{
/* DL-MAP Extended-2 IE = 7 */
/* 8.4.5.3.21 [2] HARQ_DL_MAP_IE */
@ -1391,17 +1405,17 @@ static gint HARQ_DL_MAP_IE(proto_tree *diuc_tree, gint offset, gint length, tvbu
if (mode == 0) {
DL_HARQ_Chase_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 1) {
DL_HARQ_IR_CTC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
DL_HARQ_IR_CTC_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 2) {
DL_HARQ_IR_CC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
DL_HARQ_IR_CC_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 3) {
MIMO_DL_Chase_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
MIMO_DL_Chase_HARQ_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 4) {
MIMO_DL_IR_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
MIMO_DL_IR_HARQ_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 5) {
MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
MIMO_DL_IR_HARQ_for_CC_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else if (mode == 6) {
MIMO_DL_STC_HARQ_sub_burst_IE(tree, BIT_TO_NIB(bit), length, tvb);
MIMO_DL_STC_HARQ_sub_burst_IE(tree, pinfo, BIT_TO_NIB(bit), length, tvb);
} else {
proto_tree_add_bits_item(tree, hf_dlmap_harq_dl_map_reserved_mode, tvb, bit, 1, ENC_BIG_ENDIAN);
break; /* cannot continue */
@ -2068,7 +2082,7 @@ static gint dissect_dlmap_ie(proto_tree *ie_tree, packet_info *pinfo, gint offse
break;
case 0x07:
/* 8.4.5.3.21 HARQ_DL_MAP_IE */
nibble = HARQ_DL_MAP_IE(tree, nibble, len, tvb);
nibble = HARQ_DL_MAP_IE(tree, pinfo, nibble, len, tvb);
break;
case 0x08:
/* 8.4.5.3.22 HARQ_ACK IE */
@ -2385,8 +2399,8 @@ gint wimax_decode_dlmapc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *base_tre
{
/* calculate the CRC */
calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, mac_len - (int)sizeof(mac_crc)), mac_len - (int)sizeof(mac_crc));
proto_tree_add_checksum(base_tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_compress_dlmap_crc, -1, NULL, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
proto_tree_add_checksum(base_tree, tvb, mac_len - (int)sizeof(mac_crc), hf_mac_header_compress_dlmap_crc, hf_mac_header_compress_dlmap_crc_status, &ei_mac_header_compress_dlmap_crc,
pinfo, calculated_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
}
else
{ /* display error message */
@ -2464,7 +2478,7 @@ static gint wimax_decode_sub_dl_ul_map(tvbuff_t *tvb, packet_info *pinfo, proto_
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, NIB_TO_BYTE(nib)), NIB_TO_BYTE(nib));
proto_tree_add_checksum(tree, tvb, NIBHI(nib,4), hf_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, NIBHI(nib,4), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
/* nib += 4; */
@ -2584,7 +2598,7 @@ gint wimax_decode_dlmap_reduced_aas(tvbuff_t *tvb, packet_info *pinfo _U_, proto
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16(tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BIT_ADDR(bit), hf_crc16, hf_crc16_status, &ei_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@ -3055,6 +3069,13 @@ void proto_register_mac_mgmt_msg_dlmap(void)
FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL
}
},
{
&hf_mac_header_compress_dlmap_crc_status,
{
"CRC Status", "wmx.compress_dlmap_crc.status",
FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL
}
},
{
&hf_crc16,
{
@ -3062,6 +3083,13 @@ void proto_register_mac_mgmt_msg_dlmap(void)
FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL
}
},
{
&hf_crc16_status,
{
"CRC-16 Status", "wmx.dlmap.crc16.status",
FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL
}
},
{
&hf_padding,
{
@ -3418,6 +3446,8 @@ void proto_register_mac_mgmt_msg_dlmap(void)
static ei_register_info ei[] = {
{ &ei_dlmap_not_implemented, { "wmx.dlmap.not_implemented", PI_UNDECODED, PI_WARN, "Not implemented", EXPFILL }},
{ &ei_crc16, { "wmx.dlmap.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
{ &ei_mac_header_compress_dlmap_crc, { "wmx.compress_dlmap.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
expert_module_t* expert_mac_mgmt_msg_dlmap;

View File

@ -261,6 +261,7 @@ static gint hf_ulmap_uiuc13_papr = -1;
static gint hf_ulmap_uiuc13_zone = -1;
static gint hf_ulmap_uiuc13_rsv = -1;
/* static gint hf_ulmap_crc16 = -1; */
/* static gint hf_ulmap_crc16_status = -1; */
static gint hf_ulmap_padding = -1;
/* Generated via "one time" script to help create filterable fields */
@ -635,7 +636,7 @@ static gint UL_HARQ_Chase_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
if (include_cor2_changes)
{
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -676,7 +677,7 @@ static gint UL_HARQ_IR_CTC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
}
@ -718,7 +719,7 @@ static gint UL_HARQ_IR_CC_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gint
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@ -771,7 +772,7 @@ static gint MIMO_UL_Chase_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset,
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@ -824,7 +825,7 @@ static gint MIMO_UL_IR_HARQ__Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gi
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@ -878,7 +879,7 @@ static gint MIMO_UL_IR_HARQ_for_CC_Sub_Burst_UIE(proto_tree *uiuc_tree, gint off
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@ -924,7 +925,7 @@ static gint MIMO_UL_STC_HARQ_Sub_Burst_IE(proto_tree *uiuc_tree, gint offset, gi
{
/* CRC-16 is always appended */
calculated_crc = wimax_mac_calc_crc16((guint8 *)tvb_get_ptr(tvb, 0, BIT_TO_BYTE(bit)), BIT_TO_BYTE(bit));
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, -1, NULL, pinfo, calculated_crc,
proto_tree_add_checksum(tree, tvb, BITHI(bit,16), hf_ulmap_crc16, hf_ulmap_crc16_status, &ei_ulmap_crc16, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
bit += 16;
@ -2463,6 +2464,13 @@ void proto_register_mac_mgmt_msg_ulmap(void)
FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL
}
},
{
&hf_ulmap_crc16_status,
{
"CRC-16 Status", "wmx.ulmap.crc16.status",
FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL
}
},
#endif
{
&hf_ulmap_padding,

View File

@ -29,6 +29,7 @@
#include "config.h"
#include <epan/packet.h>
#include <epan/expert.h>
#include "crc.h"
#include "wimax_compact_dlmap_ie_decoder.h"
#include "wimax_compact_ulmap_ie_decoder.h"
@ -59,7 +60,20 @@ static gint hf_harq_map_reserved = -1;
static gint hf_harq_map_msg_length = -1;
static gint hf_harq_dl_ie_count = -1;
static gint hf_harq_map_msg_crc = -1;
static gint hf_harq_map_msg_crc_status = -1;
static expert_field ei_harq_map_msg_crc = EI_INIT;
/* Copied and renamed from proto.c because global value_strings don't work for plugins */
static const value_string plugin_proto_checksum_vals[] = {
{ PROTO_CHECKSUM_E_BAD, "Bad" },
{ PROTO_CHECKSUM_E_GOOD, "Good" },
{ PROTO_CHECKSUM_E_UNVERIFIED, "Unverified" },
{ PROTO_CHECKSUM_E_NOT_PRESENT, "Not present" },
{ 0, NULL }
};
/* HARQ MAP message decoder */
static int dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
@ -151,8 +165,8 @@ static int dissector_wimax_harq_map_decoder(tvbuff_t *tvb, packet_info *pinfo, p
proto_item_append_text(parent_item, ",CRC");
/* calculate the HARQ MAM Message CRC */
calculated_crc = wimax_mac_calc_crc32(tvb_get_ptr(tvb, 0, length - (int)sizeof(harq_map_msg_crc)), length - (int)sizeof(harq_map_msg_crc));
proto_tree_add_checksum(tree, tvb, length - (int)sizeof(harq_map_msg_crc), hf_harq_map_msg_crc, -1, NULL, pinfo, calculated_crc,
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
proto_tree_add_checksum(tree, tvb, length - (int)sizeof(harq_map_msg_crc), hf_harq_map_msg_crc, hf_harq_map_msg_crc_status, &ei_harq_map_msg_crc,
pinfo, calculated_crc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
}
return tvb_captured_length(tvb);
}
@ -186,19 +200,31 @@ void proto_register_wimax_harq_map(void)
{
&hf_harq_map_msg_crc,
{"HARQ MAP Message CRC", "wmx.harq_map.msg_crc", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL}
}
},
{
&hf_harq_map_msg_crc_status,
{"HARQ MAP Message CRC Status", "wmx.harq_map.msg_crc.status", FT_UINT8, BASE_NONE, VALS(plugin_proto_checksum_vals), 0x0, NULL, HFILL}
},
};
/* Setup protocol subtree array */
static gint *ett[] =
{
&ett_wimax_harq_map_decoder,
};
{
&ett_wimax_harq_map_decoder,
};
static ei_register_info ei[] = {
{ &ei_harq_map_msg_crc, { "wmx.harq_map.bad_checksum", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
};
expert_module_t* expert_harq_map;
proto_wimax_harq_map_decoder = proto_wimax;
proto_register_subtree_array(ett, array_length(ett));
proto_register_field_array(proto_wimax_harq_map_decoder, hf_harq_map, array_length(hf_harq_map));
expert_harq_map = expert_register_protocol(proto_wimax_harq_map_decoder);
expert_register_field_array(expert_harq_map, ei, array_length(ei));
register_dissector("wimax_harq_map_handler", dissector_wimax_harq_map_decoder, proto_wimax_harq_map_decoder);
}