forked from osmocom/wireshark
Add proto_tree_add_checksum.
This is an attempt to standardize display/handling of checksum fields for all dissectors. The main target is for dissectors that do validation, but dissectors that just report the checksum were also included just to make them easier to find in the future. Bug: 10620 Bug: 12058 Ping-Bug: 8859 Change-Id: Ia8abd86e42eaf8ed50de6b173409e914b17993bf Reviewed-on: https://code.wireshark.org/review/16380 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Jeff Morriss <jeff.morriss.ws@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>
This commit is contained in:
parent
1e19f55f0c
commit
ad6fc87d64
|
@ -9,7 +9,7 @@
|
|||
@TCP RST@tcp.flags.reset eq 1@[42148,0,0][65535,64764,40092]
|
||||
@SCTP ABORT@sctp.chunk_type eq ABORT@[42148,0,0][65535,64764,40092]
|
||||
@TTL low or unexpected@( ! ip.dst == 224.0.0.0/4 && ip.ttl < 5 && !pim && !ospf) || (ip.dst == 224.0.0.0/24 && ip.dst != 224.0.0.251 && ip.ttl != 1 && !(vrrp || carp))@[42148,0,0][60652,61680,60395]
|
||||
@Checksum Errors@eth.fcs_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1 || sctp.checksum_bad==1 || mstp.checksum_bad==1 || cdp.checksum_bad==1 || edp.checksum_bad==1 || wlan.fcs_bad==1 || stt.checksum.bad==1@[4718,10030,11796][63479,34695,34695]
|
||||
@Checksum Errors@eth.fcs.status=="Bad" || ip.checksum.status=="Bad" || tcp.checksum.status=="Bad" || udp.checksum.status=="Bad" || sctp.checksum.status=="Bad" || mstp.checksum.status=="Bad" || cdp.checksum.status=="Bad" || edp.checksum.status=="Bad" || wlan.fcs.status=="Bad" || stt.checksum.status=="Bad"@[4718,10030,11796][63479,34695,34695]
|
||||
@SMB@smb || nbss || nbns || nbipx || ipxsap || netbios@[65278,65535,53456][4718,10030,11796]
|
||||
@HTTP@http || tcp.port == 80 || http2@[58596,65535,51143][4718,10030,11796]
|
||||
@IPX@ipx || spx@[65534,58325,58808][4718,10030,11796]
|
||||
|
|
|
@ -1053,6 +1053,7 @@ libwireshark.so.0 libwireshark0 #MINVER#
|
|||
proto_tree_add_bytes_format_value@Base 1.9.1
|
||||
proto_tree_add_bytes_item@Base 1.12.0~rc1
|
||||
proto_tree_add_bytes_with_length@Base 1.99.3
|
||||
proto_tree_add_checksum@Base 2.1.1
|
||||
proto_tree_add_debug_text@Base 1.9.1
|
||||
proto_tree_add_double@Base 1.9.1
|
||||
proto_tree_add_double_format@Base 1.9.1
|
||||
|
|
|
@ -1996,8 +1996,7 @@ presented as a subtree, where the result is enclosed in square brackets
|
|||
indicating a generated field.
|
||||
|
||||
Header checksum: 0x3d42 [correct]
|
||||
[Good: True]
|
||||
[Bad: False]
|
||||
[Checksum Status: Good (1)]
|
||||
|
||||
PROTO_ITEM_SET_HIDDEN()
|
||||
-----------------------
|
||||
|
|
|
@ -41,6 +41,13 @@ since version 2.1.0:
|
|||
* The RTP player now allows up to 30 minutes of silence frames.
|
||||
* Packet bytes can now be displayed as EBCDIC.
|
||||
* The Qt UI loads captures faster on Windows.
|
||||
* proto_tree_add_checksum was added as an API. This attempts to
|
||||
standardize how checksums are reported and filtered for within
|
||||
*Shark. There are no more individual "good" and "bad" filter
|
||||
fields, protocols now have a "checksum.status" field that records
|
||||
"Good", "Bad" and "Unverified" (neither good or bad). Color filters
|
||||
provided with Wireshark have been adjusted to the new display filter
|
||||
names, but custom ones may need to be updated.
|
||||
|
||||
The following features are new (or have been significantly updated)
|
||||
since version 2.0.0:
|
||||
|
|
|
@ -123,6 +123,7 @@ static int hf_c1222_write_size = -1;
|
|||
static int hf_c1222_write_data = -1;
|
||||
static int hf_c1222_procedure_num = -1;
|
||||
static int hf_c1222_write_chksum = -1;
|
||||
static int hf_c1222_write_chksum_status = -1;
|
||||
static int hf_c1222_wait_secs = -1;
|
||||
static int hf_c1222_neg_pkt_size = -1;
|
||||
static int hf_c1222_neg_nbr_pkts = -1;
|
||||
|
@ -380,7 +381,6 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
gchar *auth_req = NULL;
|
||||
guint16 table = 0;
|
||||
guint16 tblsize = 0;
|
||||
guint8 chksum = 0;
|
||||
guint16 calcsum = 0;
|
||||
guint8 wait_seconds = 0;
|
||||
int numrates = 0;
|
||||
|
@ -392,7 +392,6 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
guint8 inter_char;
|
||||
guint8 resp_to;
|
||||
guint8 nbr_retries;
|
||||
proto_item *item = NULL;
|
||||
|
||||
/* special case to simplify handling of Negotiate service */
|
||||
if ((cmd & 0xF0) == C1222_CMD_NEGOTIATE) {
|
||||
|
@ -509,16 +508,14 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
proto_tree_add_item(tree, hf_c1222_write_data, tvb, *offset, tblsize, ENC_NA);
|
||||
*offset += tblsize;
|
||||
*length -= tblsize;
|
||||
chksum = tvb_get_guint8(tvb, *offset);
|
||||
item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum);
|
||||
if (table == 7) {/* is it a procedure call? */
|
||||
calcsum = c1222_cksum(tvb, (*offset)-tblsize-2, tblsize+2);
|
||||
} else {
|
||||
calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize);
|
||||
}
|
||||
if (chksum != calcsum) {
|
||||
expert_add_info_format(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum);
|
||||
}
|
||||
proto_tree_add_checksum(tree, tvb, *offset, hf_c1222_write_chksum, hf_c1222_write_chksum_status,
|
||||
&ei_c1222_bad_checksum, pinfo, calcsum, ENC_NA, PROTO_CHECKSUM_VERIFY);
|
||||
|
||||
if (table == 7) {/* is it a procedure call? */
|
||||
proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d, %s-%d)",
|
||||
val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
|
||||
|
@ -555,12 +552,9 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
proto_tree_add_item(tree, hf_c1222_write_data, tvb, *offset, tblsize, ENC_NA);
|
||||
*offset += tblsize;
|
||||
*length -= tblsize;
|
||||
chksum = tvb_get_guint8(tvb, *offset);
|
||||
item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum);
|
||||
calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize);
|
||||
if (chksum != calcsum) {
|
||||
expert_add_info_format(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum);
|
||||
}
|
||||
proto_tree_add_checksum(tree, tvb, *offset, hf_c1222_write_chksum, hf_c1222_write_chksum_status,
|
||||
&ei_c1222_bad_checksum, pinfo, calcsum, ENC_NA, PROTO_CHECKSUM_VERIFY);
|
||||
proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d)",
|
||||
val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
|
||||
val_to_str((table >> 8) & 0xF8, tableflags,"Unknown (0x%04x)"), table & 0x7FF);
|
||||
|
@ -1259,6 +1253,12 @@ void proto_register_c1222(void) {
|
|||
NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_c1222_write_chksum_status,
|
||||
{ "C12.22 Table Data Checksum Status", "c1222.write.chksum.status",
|
||||
FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_c1222_procedure_num,
|
||||
{ "C12.22 Procedure Number", "c1222.procedure.num",
|
||||
FT_UINT16, BASE_DEC,
|
||||
|
|
|
@ -2088,9 +2088,8 @@ dissect_6lowpan_iphc_nhc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gi
|
|||
if (!(udp_flags & LOWPAN_NHC_UDP_CHECKSUM)) {
|
||||
/* Parse the checksum. */
|
||||
udp.checksum = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint(tree, hf_6lowpan_udp_checksum, tvb, offset, 2, udp.checksum);
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_6lowpan_udp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
udp.checksum = g_ntohs(udp.checksum);
|
||||
}
|
||||
else {
|
||||
udp.checksum = 0;
|
||||
|
|
|
@ -226,7 +226,7 @@ static int dissect_aol_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
|
||||
/* Add the first few P3 fields */
|
||||
proto_tree_add_item(aol_tree,hf_aol_start,tvb,offset,1,ENC_NA); offset += 1;
|
||||
proto_tree_add_item(aol_tree,hf_aol_crc, tvb,offset,2,ENC_BIG_ENDIAN); offset += 2;
|
||||
proto_tree_add_checksum(aol_tree, tvb, offset, hf_aol_crc, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS); offset += 2;
|
||||
proto_tree_add_item(aol_tree,hf_aol_len, tvb,offset,2,ENC_BIG_ENDIAN); offset += 2;
|
||||
|
||||
/* Add sequence fields */
|
||||
|
|
|
@ -3141,8 +3141,7 @@ dissect_artnet_file_tn_master(tvbuff_t *tvb, guint offset, proto_tree *tree)
|
|||
offset, 14, ENC_ASCII|ENC_NA);
|
||||
offset += 14;
|
||||
|
||||
proto_tree_add_item(tree, hf_artnet_file_tn_master_checksum, tvb,
|
||||
offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_artnet_file_tn_master_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(tree, hf_artnet_file_tn_master_spare, tvb,
|
||||
|
|
|
@ -567,13 +567,12 @@ dissect_pe_identifier_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_t
|
|||
proto_item_append_text(parameter_item, " (0x%x)", tvb_get_ntohl(parameter_tvb, PE_IDENTIFIER_OFFSET));
|
||||
}
|
||||
|
||||
#define PE_CHECKSUM_LENGTH 2
|
||||
#define PE_CHECKSUM_OFFSET PARAMETER_VALUE_OFFSET
|
||||
|
||||
static void
|
||||
dissect_pe_checksum_parameter(tvbuff_t *parameter_tvb, proto_tree *parameter_tree, proto_item *parameter_item)
|
||||
{
|
||||
proto_tree_add_item(parameter_tree, hf_pe_checksum, parameter_tvb, PE_CHECKSUM_OFFSET, PE_CHECKSUM_LENGTH, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(parameter_tree, parameter_tvb, PE_CHECKSUM_OFFSET, hf_pe_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_item_append_text(parameter_item, " (0x%x)", tvb_get_ntohs(parameter_tvb, PE_CHECKSUM_OFFSET));
|
||||
}
|
||||
|
||||
|
@ -893,7 +892,7 @@ proto_register_asap(void)
|
|||
{ &hf_reg_life, { "Registration Life", "asap.pool_element_registration_life", FT_INT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_cookie, { "Cookie", "asap.cookie", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_pe_identifier, { "PE Identifier", "asap.pe_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_pe_checksum, { "PE Checksum", "asap.pe_checksum", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_pe_checksum, { "PE Checksum", "asap.pe_checksum", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_hropt_items, { "Items", "asap.hropt_items", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_server_identifier, { "Server Identifier", "asap.server_identifier", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_home_enrp_server_bit, { "H Bit", "asap.h_bit", FT_BOOLEAN, 8, TFS(&home_enrp_server_bit_value), HOME_ENRP_SERVER_BIT_MASK, NULL, HFILL } },
|
||||
|
|
|
@ -367,23 +367,6 @@ static dissector_table_t ddp_dissector_table;
|
|||
|
||||
#define DDP_SHORT_HEADER_SIZE 5
|
||||
|
||||
/*
|
||||
* P = Padding, H = Hops, L = Len
|
||||
*
|
||||
* PPHHHHLL LLLLLLLL
|
||||
*
|
||||
* Assumes the argument is in host byte order.
|
||||
*/
|
||||
#define ddp_hops(x) ( ( x >> 10) & 0x3C )
|
||||
#define ddp_len(x) ( x & 0x03ff )
|
||||
typedef struct _e_ddp {
|
||||
guint16 hops_len; /* combines pad, hops, and len */
|
||||
guint16 sum,dnet,snet;
|
||||
guint8 dnode,snode;
|
||||
guint8 dport,sport;
|
||||
guint8 type;
|
||||
} e_ddp;
|
||||
|
||||
#define DDP_HEADER_SIZE 13
|
||||
|
||||
|
||||
|
@ -1484,76 +1467,55 @@ dissect_ddp_short(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
|
|||
static int
|
||||
dissect_ddp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
||||
{
|
||||
e_ddp ddp;
|
||||
proto_tree *ddp_tree;
|
||||
proto_item *ti, *hidden_item;
|
||||
struct atalk_ddp_addr *src = wmem_new0(pinfo->pool, struct atalk_ddp_addr),
|
||||
*dst = wmem_new0(pinfo->pool, struct atalk_ddp_addr);
|
||||
tvbuff_t *new_tvb;
|
||||
guint type;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "DDP");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
tvb_memcpy(tvb, (guint8 *)&ddp, 0, sizeof(e_ddp));
|
||||
ddp.dnet=g_ntohs(ddp.dnet);
|
||||
ddp.snet=g_ntohs(ddp.snet);
|
||||
ddp.sum=g_ntohs(ddp.sum);
|
||||
ddp.hops_len=g_ntohs(ddp.hops_len);
|
||||
pinfo->ptype = PT_DDP;
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_ddp, tvb, 0, DDP_HEADER_SIZE, ENC_NA);
|
||||
ddp_tree = proto_item_add_subtree(ti, ett_ddp);
|
||||
|
||||
hidden_item = proto_tree_add_string(ddp_tree, hf_ddp_src, tvb,
|
||||
4, 3, address_to_str(wmem_packet_scope(), &pinfo->src));
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
hidden_item = proto_tree_add_string(ddp_tree, hf_ddp_dst, tvb,
|
||||
6, 3, address_to_str(wmem_packet_scope(), &pinfo->dst));
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
proto_tree_add_item(ddp_tree, hf_ddp_hopcount, tvb, 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(ddp_tree, hf_ddp_len, tvb, 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(ddp_tree, tvb, 0, hf_ddp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
dst->net = tvb_get_ntohs(tvb, 4);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_dst_net, tvb, 4, 2, dst->net);
|
||||
src->net = tvb_get_ntohs(tvb, 6);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_src_net, tvb, 6, 2, src->net);
|
||||
dst->node = tvb_get_guint8(tvb, 8);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_dst_node, tvb, 8, 1, dst->node);
|
||||
src->node = tvb_get_guint8(tvb, 9);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_src_node, tvb, 9, 1, src->node);
|
||||
proto_tree_add_item_ret_uint(ddp_tree, hf_ddp_dst_socket, tvb, 10, 1, ENC_NA, &pinfo->destport);
|
||||
proto_tree_add_item_ret_uint(ddp_tree, hf_ddp_src_socket, tvb, 11, 1, ENC_NA, &pinfo->srcport);
|
||||
proto_tree_add_item_ret_uint(ddp_tree, hf_ddp_type, tvb, 12, 1, ENC_NA, &type);
|
||||
|
||||
col_add_str(pinfo->cinfo, COL_INFO,
|
||||
val_to_str_ext(type, &op_vals_ext, "Unknown DDP protocol (%02x)"));
|
||||
|
||||
src->net = ddp.snet;
|
||||
src->node = ddp.snode;
|
||||
dst->net = ddp.dnet;
|
||||
dst->node = ddp.dnode;
|
||||
set_address(&pinfo->net_src, atalk_address_type, sizeof(struct atalk_ddp_addr), src);
|
||||
copy_address_shallow(&pinfo->src, &pinfo->net_src);
|
||||
set_address(&pinfo->net_dst, atalk_address_type, sizeof(struct atalk_ddp_addr), dst);
|
||||
copy_address_shallow(&pinfo->dst, &pinfo->net_dst);
|
||||
|
||||
pinfo->ptype = PT_DDP;
|
||||
pinfo->destport = ddp.dport;
|
||||
pinfo->srcport = ddp.sport;
|
||||
|
||||
col_add_str(pinfo->cinfo, COL_INFO,
|
||||
val_to_str_ext(ddp.type, &op_vals_ext, "Unknown DDP protocol (%02x)"));
|
||||
|
||||
if (tree) {
|
||||
ti = proto_tree_add_item(tree, proto_ddp, tvb, 0, DDP_HEADER_SIZE,
|
||||
ENC_NA);
|
||||
ddp_tree = proto_item_add_subtree(ti, ett_ddp);
|
||||
|
||||
hidden_item = proto_tree_add_string(ddp_tree, hf_ddp_src, tvb,
|
||||
4, 3, address_to_str(wmem_packet_scope(), &pinfo->src));
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
hidden_item = proto_tree_add_string(ddp_tree, hf_ddp_dst, tvb,
|
||||
6, 3, address_to_str(wmem_packet_scope(), &pinfo->dst));
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_hopcount, tvb, 0, 1,
|
||||
ddp_hops(ddp.hops_len));
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_len, tvb, 0, 2,
|
||||
ddp_len(ddp.hops_len));
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_checksum, tvb, 2, 2,
|
||||
ddp.sum);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_dst_net, tvb, 4, 2,
|
||||
ddp.dnet);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_src_net, tvb, 6, 2,
|
||||
ddp.snet);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_dst_node, tvb, 8, 1,
|
||||
ddp.dnode);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_src_node, tvb, 9, 1,
|
||||
ddp.snode);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_dst_socket, tvb, 10, 1,
|
||||
ddp.dport);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_src_socket, tvb, 11, 1,
|
||||
ddp.sport);
|
||||
proto_tree_add_uint(ddp_tree, hf_ddp_type, tvb, 12, 1,
|
||||
ddp.type);
|
||||
}
|
||||
|
||||
new_tvb = tvb_new_subset_remaining(tvb, DDP_HEADER_SIZE);
|
||||
|
||||
if (!dissector_try_uint(ddp_dissector_table, ddp.type, new_tvb, pinfo, tree))
|
||||
if (!dissector_try_uint(ddp_dissector_table, type, new_tvb, pinfo, tree))
|
||||
{
|
||||
call_data_dissector(new_tvb, pinfo, tree);
|
||||
}
|
||||
|
@ -1666,11 +1628,11 @@ proto_register_atalk(void)
|
|||
|
||||
static hf_register_info hf_ddp[] = {
|
||||
{ &hf_ddp_hopcount,
|
||||
{ "Hop count", "ddp.hopcount", FT_UINT8, BASE_DEC, NULL, 0x0,
|
||||
{ "Hop count", "ddp.hopcount", FT_UINT16, BASE_DEC, NULL, 0x3C00,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_ddp_len,
|
||||
{ "Datagram length", "ddp.len", FT_UINT16, BASE_DEC, NULL, 0x0,
|
||||
{ "Datagram length", "ddp.len", FT_UINT16, BASE_DEC, NULL, 0x0300,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_ddp_checksum,
|
||||
|
|
|
@ -335,17 +335,17 @@ dissect_ax25_kiss( tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, v
|
|||
}
|
||||
|
||||
if ( gPREF_CKSUM_MODE )
|
||||
{
|
||||
{
|
||||
kiss_cksum = 0;
|
||||
kiss_tvb_length = tvb_captured_length_remaining( tvb, 0 ) - 1;
|
||||
kiss_tvb_length = tvb_captured_length(tvb) - 1;
|
||||
if ( kiss_tvb_length > 0 )
|
||||
{
|
||||
{
|
||||
for ( kiss_cksum_index = 0; kiss_cksum_index < kiss_tvb_length; kiss_cksum_index++ )
|
||||
kiss_cksum ^= (tvb_get_guint8( tvb, kiss_cksum_index ) & 0xff);
|
||||
proto_tree_add_uint( kiss_tree, hf_ax25_kiss_cksum,
|
||||
tvb, kiss_cksum_index, 1, kiss_cksum );
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(kiss_tree, tvb, 0, hf_ax25_kiss_cksum, -1, NULL, pinfo, kiss_cksum, ENC_NA, PROTO_CHECKSUM_GENERATED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Call sub-dissectors here */
|
||||
|
|
|
@ -1554,7 +1554,7 @@ static int dissect_bitcoin_tcp_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
proto_tree_add_item(tree, &hfi_bitcoin_magic, tvb, 0, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item_ret_string(tree, hfi_bitcoin_command.id, tvb, 4, 12, ENC_ASCII|ENC_NA, wmem_packet_scope(), &command);
|
||||
proto_tree_add_item(tree, &hfi_bitcoin_length, tvb, 16, 4, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_item(tree, &hfi_bitcoin_checksum, tvb, 20, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tvb, 20, hfi_bitcoin_checksum.id, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
offset = 24;
|
||||
|
||||
|
|
|
@ -8960,7 +8960,7 @@ dissect_attribute_value(proto_tree *tree, proto_item *patron_item, packet_info *
|
|||
|
||||
break;
|
||||
case 0x03: /* Calculate Checksum */
|
||||
proto_tree_add_item(tree, hf_btatt_ots_checksum, tvb, offset, 4, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_btatt_ots_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 4;
|
||||
|
||||
break;
|
||||
|
|
|
@ -161,6 +161,7 @@ static int hf_c1222_write_size = -1;
|
|||
static int hf_c1222_write_data = -1;
|
||||
static int hf_c1222_procedure_num = -1;
|
||||
static int hf_c1222_write_chksum = -1;
|
||||
static int hf_c1222_write_chksum_status = -1;
|
||||
static int hf_c1222_wait_secs = -1;
|
||||
static int hf_c1222_neg_pkt_size = -1;
|
||||
static int hf_c1222_neg_nbr_pkts = -1;
|
||||
|
@ -224,7 +225,7 @@ static gint ett_c1222_Calling_authentication_value_c1222_U = -1;
|
|||
static gint ett_c1222_Calling_authentication_value_c1221_U = -1;
|
||||
|
||||
/*--- End of included file: packet-c1222-ett.c ---*/
|
||||
#line 177 "./asn1/c1222/packet-c1222-template.c"
|
||||
#line 178 "./asn1/c1222/packet-c1222-template.c"
|
||||
|
||||
static expert_field ei_c1222_command_truncated = EI_INIT;
|
||||
static expert_field ei_c1222_bad_checksum = EI_INIT;
|
||||
|
@ -431,7 +432,6 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
gchar *auth_req = NULL;
|
||||
guint16 table = 0;
|
||||
guint16 tblsize = 0;
|
||||
guint8 chksum = 0;
|
||||
guint16 calcsum = 0;
|
||||
guint8 wait_seconds = 0;
|
||||
int numrates = 0;
|
||||
|
@ -443,7 +443,6 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
guint8 inter_char;
|
||||
guint8 resp_to;
|
||||
guint8 nbr_retries;
|
||||
proto_item *item = NULL;
|
||||
|
||||
/* special case to simplify handling of Negotiate service */
|
||||
if ((cmd & 0xF0) == C1222_CMD_NEGOTIATE) {
|
||||
|
@ -560,16 +559,14 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
proto_tree_add_item(tree, hf_c1222_write_data, tvb, *offset, tblsize, ENC_NA);
|
||||
*offset += tblsize;
|
||||
*length -= tblsize;
|
||||
chksum = tvb_get_guint8(tvb, *offset);
|
||||
item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum);
|
||||
if (table == 7) {/* is it a procedure call? */
|
||||
calcsum = c1222_cksum(tvb, (*offset)-tblsize-2, tblsize+2);
|
||||
} else {
|
||||
calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize);
|
||||
}
|
||||
if (chksum != calcsum) {
|
||||
expert_add_info_format(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum);
|
||||
}
|
||||
proto_tree_add_checksum(tree, tvb, *offset, hf_c1222_write_chksum, hf_c1222_write_chksum_status,
|
||||
&ei_c1222_bad_checksum, pinfo, calcsum, ENC_NA, PROTO_CHECKSUM_VERIFY);
|
||||
|
||||
if (table == 7) {/* is it a procedure call? */
|
||||
proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d, %s-%d)",
|
||||
val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
|
||||
|
@ -606,12 +603,9 @@ parse_c1222_detailed(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int cm
|
|||
proto_tree_add_item(tree, hf_c1222_write_data, tvb, *offset, tblsize, ENC_NA);
|
||||
*offset += tblsize;
|
||||
*length -= tblsize;
|
||||
chksum = tvb_get_guint8(tvb, *offset);
|
||||
item = proto_tree_add_uint(tree, hf_c1222_write_chksum, tvb, *offset, 1, chksum);
|
||||
calcsum = c1222_cksum(tvb, (*offset)-tblsize, tblsize);
|
||||
if (chksum != calcsum) {
|
||||
expert_add_info_format(pinfo, item, &ei_c1222_bad_checksum, "Bad checksum [should be 0x%02x]", calcsum);
|
||||
}
|
||||
proto_tree_add_checksum(tree, tvb, *offset, hf_c1222_write_chksum, hf_c1222_write_chksum_status,
|
||||
&ei_c1222_bad_checksum, pinfo, calcsum, ENC_NA, PROTO_CHECKSUM_VERIFY);
|
||||
proto_item_set_text(tree, "C12.22 EPSEM: %s (%s-%d)",
|
||||
val_to_str(cmd,commandnames,"Unknown (0x%02x)"),
|
||||
val_to_str((table >> 8) & 0xF8, tableflags,"Unknown (0x%04x)"), table & 0x7FF);
|
||||
|
@ -1566,7 +1560,7 @@ static int dissect_MESSAGE_PDU(tvbuff_t *tvb _U_, packet_info *pinfo _U_, proto_
|
|||
|
||||
|
||||
/*--- End of included file: packet-c1222-fn.c ---*/
|
||||
#line 1048 "./asn1/c1222/packet-c1222-template.c"
|
||||
#line 1042 "./asn1/c1222/packet-c1222-template.c"
|
||||
|
||||
/**
|
||||
* Dissects a a full (reassembled) C12.22 message.
|
||||
|
@ -1781,6 +1775,12 @@ void proto_register_c1222(void) {
|
|||
NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_c1222_write_chksum_status,
|
||||
{ "C12.22 Table Data Checksum Status", "c1222.write.chksum.status",
|
||||
FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_c1222_procedure_num,
|
||||
{ "C12.22 Procedure Number", "c1222.procedure.num",
|
||||
FT_UINT16, BASE_DEC,
|
||||
|
|
|
@ -90,7 +90,6 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
|||
proto_item *ti, *tv;
|
||||
proto_tree *carp_tree, *ver_type_tree;
|
||||
guint8 ver_type;
|
||||
guint16 cksum, computed_cksum;
|
||||
|
||||
/* Make sure it's a CARP packet */
|
||||
if (!test_carp_packet(tvb, pinfo, tree, data))
|
||||
|
@ -133,20 +132,15 @@ dissect_carp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
|||
proto_tree_add_item(carp_tree, hf_carp_advbase, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset++;
|
||||
|
||||
cksum = tvb_get_ntohs(tvb, offset);
|
||||
ti = proto_tree_add_item(carp_tree, hf_carp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
carp_len = tvb_reported_length(tvb);
|
||||
if (!pinfo->fragmented && tvb_captured_length(tvb) >= carp_len) {
|
||||
/* 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);
|
||||
computed_cksum = in_cksum(&cksum_vec[0], 1);
|
||||
if (computed_cksum == 0) {
|
||||
proto_item_append_text(ti, " [correct]");
|
||||
} else {
|
||||
proto_item_append_text(ti, " [incorrect, should be 0x%04x]",
|
||||
in_cksum_shouldbe(cksum, computed_cksum));
|
||||
}
|
||||
proto_tree_add_checksum(carp_tree, tvb, offset, hf_carp_checksum, -1, NULL, 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);
|
||||
}
|
||||
|
||||
offset+=2;
|
||||
|
|
|
@ -87,6 +87,7 @@ static int hf_cattp_seq = -1;
|
|||
static int hf_cattp_ack = -1;
|
||||
static int hf_cattp_windowsize = -1;
|
||||
static int hf_cattp_checksum = -1;
|
||||
static int hf_cattp_checksum_status = -1;
|
||||
static int hf_cattp_identification = -1;
|
||||
static int hf_cattp_iccid = -1;
|
||||
static int hf_cattp_idlen = -1;
|
||||
|
@ -218,12 +219,11 @@ dissect_cattp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
|
|||
const char *pdutype = "[Unknown PDU]";
|
||||
proto_item *ti, *cattp_tree;
|
||||
guint32 offset;
|
||||
gushort computed_chksum;
|
||||
vec_t cksum_vec[1];
|
||||
int header_offset;
|
||||
guint cksum_data_len;
|
||||
guint8 flags, first_byte, hlen, ver;
|
||||
guint16 plen, chksum, ackno, seqno, wsize, sport, dport;
|
||||
guint16 plen, ackno, seqno, wsize, sport, dport;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, CATTP_SHORTNAME);
|
||||
|
||||
|
@ -294,28 +294,16 @@ dissect_cattp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
|
|||
/* Parse and verify checksum */
|
||||
header_offset = 0;
|
||||
cksum_data_len = hlen + plen;
|
||||
chksum = tvb_get_ntohs(tvb, offset);
|
||||
if (!cattp_check_checksum) {
|
||||
/* We have turned checksum checking off; we do NOT checksum it. */
|
||||
proto_tree_add_uint_format_value(cattp_tree, hf_cattp_checksum, tvb, offset, 2,
|
||||
chksum, "0x%X [validation disabled]", chksum);
|
||||
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);
|
||||
} 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);
|
||||
computed_chksum = in_cksum(cksum_vec, 1);
|
||||
|
||||
if (computed_chksum == 0) {
|
||||
/* Checksum is valid */
|
||||
proto_tree_add_uint_format_value(cattp_tree, hf_cattp_checksum, tvb, offset, 2,
|
||||
chksum, "0x%X [validated]", chksum);
|
||||
} else {
|
||||
/* Checksum is invalid. Let's compute the expected checksum, based on the data we have */
|
||||
proto_tree_add_uint_format_value(cattp_tree, hf_cattp_checksum, tvb, offset, 2, chksum,
|
||||
"0x%X [incorrect, correct: 0x%X]", chksum,
|
||||
in_cksum_shouldbe(chksum, computed_chksum));
|
||||
}
|
||||
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);
|
||||
} /* End of checksum code */
|
||||
offset += 2;
|
||||
|
||||
|
@ -477,6 +465,13 @@ proto_register_cattp(void)
|
|||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
{
|
||||
&hf_cattp_checksum_status,
|
||||
{
|
||||
"Checksum Status", "cattp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
{
|
||||
&hf_cattp_identification,
|
||||
{
|
||||
|
|
|
@ -53,8 +53,7 @@ void proto_reg_handoff_cdp(void);
|
|||
static int proto_cdp = -1;
|
||||
static int hf_cdp_version = -1;
|
||||
static int hf_cdp_checksum = -1;
|
||||
static int hf_cdp_checksum_good = -1;
|
||||
static int hf_cdp_checksum_bad = -1;
|
||||
static int hf_cdp_checksum_status = -1;
|
||||
static int hf_cdp_ttl = -1;
|
||||
static int hf_cdp_tlvtype = -1;
|
||||
static int hf_cdp_tlvlength = -1;
|
||||
|
@ -271,12 +270,11 @@ static const value_string type_nrgyz_vals[] = {
|
|||
static int
|
||||
dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
||||
{
|
||||
proto_item *ti, *checksum_item;
|
||||
proto_tree *cdp_tree = NULL, *checksum_tree;
|
||||
proto_item *ti;
|
||||
proto_tree *cdp_tree;
|
||||
int offset = 0;
|
||||
guint16 type;
|
||||
guint16 length, packet_checksum, computed_checksum, data_length;
|
||||
gboolean checksum_good, checksum_bad;
|
||||
guint16 length, data_length;
|
||||
proto_item *tlvi = NULL;
|
||||
proto_tree *tlv_tree = NULL;
|
||||
int real_length;
|
||||
|
@ -289,25 +287,20 @@ dissect_cdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "CDP");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
if (tree) {
|
||||
ti = proto_tree_add_item(tree, proto_cdp, tvb, offset, -1, ENC_NA);
|
||||
cdp_tree = proto_item_add_subtree(ti, ett_cdp);
|
||||
ti = proto_tree_add_item(tree, proto_cdp, tvb, offset, -1, ENC_NA);
|
||||
cdp_tree = proto_item_add_subtree(ti, ett_cdp);
|
||||
|
||||
/* CDP header */
|
||||
proto_tree_add_item(cdp_tree, hf_cdp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
/* CDP header */
|
||||
proto_tree_add_item(cdp_tree, hf_cdp_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_uint_format_value(cdp_tree, hf_cdp_ttl, tvb, offset, 1,
|
||||
tvb_get_guint8(tvb, offset),
|
||||
"%u seconds",
|
||||
tvb_get_guint8(tvb, offset));
|
||||
offset += 1;
|
||||
} else {
|
||||
offset += 2; /* The version/ttl fields from above */
|
||||
}
|
||||
proto_tree_add_uint_format_value(cdp_tree, hf_cdp_ttl, tvb, offset, 1,
|
||||
tvb_get_guint8(tvb, offset),
|
||||
"%u seconds",
|
||||
tvb_get_guint8(tvb, offset));
|
||||
offset += 1;
|
||||
|
||||
/* Checksum display & verification code */
|
||||
packet_checksum = tvb_get_ntohs(tvb, offset);
|
||||
|
||||
data_length = tvb_reported_length(tvb);
|
||||
|
||||
|
@ -343,29 +336,8 @@ 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);
|
||||
}
|
||||
|
||||
computed_checksum = in_cksum(cksum_vec, 1);
|
||||
checksum_good = (computed_checksum == 0);
|
||||
checksum_bad = !checksum_good;
|
||||
if (checksum_good) {
|
||||
checksum_item = proto_tree_add_uint_format_value(cdp_tree,
|
||||
hf_cdp_checksum, tvb, offset, 2, packet_checksum,
|
||||
"0x%04x [correct]", packet_checksum);
|
||||
} else {
|
||||
checksum_item = proto_tree_add_uint_format_value(cdp_tree,
|
||||
hf_cdp_checksum, tvb, offset, 2, packet_checksum,
|
||||
"0x%04x [incorrect, should be 0x%04x]",
|
||||
packet_checksum,
|
||||
in_cksum_shouldbe(packet_checksum, computed_checksum));
|
||||
}
|
||||
|
||||
checksum_tree = proto_item_add_subtree(checksum_item, ett_cdp_checksum);
|
||||
checksum_item = proto_tree_add_boolean(checksum_tree, hf_cdp_checksum_good,
|
||||
tvb, offset, 2, checksum_good);
|
||||
PROTO_ITEM_SET_GENERATED(checksum_item);
|
||||
checksum_item = proto_tree_add_boolean(checksum_tree, hf_cdp_checksum_bad,
|
||||
tvb, offset, 2, checksum_bad);
|
||||
PROTO_ITEM_SET_GENERATED(checksum_item);
|
||||
|
||||
proto_tree_add_checksum(cdp_tree, tvb, offset, hf_cdp_checksum, hf_cdp_checksum_status, NULL, pinfo, in_cksum(cksum_vec, 1),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
offset += 2;
|
||||
|
||||
while (tvb_reported_length_remaining(tvb, offset) != 0) {
|
||||
|
@ -1290,13 +1262,9 @@ proto_register_cdp(void)
|
|||
{ "Checksum", "cdp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_cdp_checksum_good,
|
||||
{ "Good", "cdp.checksum_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
|
||||
|
||||
{ &hf_cdp_checksum_bad,
|
||||
{ "Bad", "cdp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content or not checked", HFILL }},
|
||||
{ &hf_cdp_checksum_status,
|
||||
{ "Checksum Status", "cdp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_cdp_tlvtype,
|
||||
{ "Type", "cdp.tlv.type", FT_UINT16, BASE_HEX, VALS(type_vals), 0x0,
|
||||
|
|
|
@ -927,7 +927,7 @@ static guint32 dissect_cfdp_eof_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
|
||||
col_add_fstr(pinfo->cinfo, COL_INFO, "EOF (%s)", val_to_str_const((aux_byte & 0xF0) >> 4, cfdp_condition_codes, "Reserved Code"));
|
||||
|
||||
proto_tree_add_item(tree, hf_cfdp_file_checksum, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_cfdp_file_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 4;
|
||||
|
||||
proto_tree_add_item(tree, hf_cfdp_file_size, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -221,7 +221,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
guint16 segment_offset = 0;
|
||||
guint16 total_length;
|
||||
guint16 cnf_cksum;
|
||||
cksum_status_t cksum_status;
|
||||
gboolean cksum_valid = TRUE;
|
||||
int offset;
|
||||
guchar src_len, dst_len, nsel, opt_len = 0;
|
||||
guint next_length;
|
||||
|
@ -320,39 +320,19 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
return 7;
|
||||
}
|
||||
cnf_cksum = tvb_get_ntohs(tvb, P_CLNP_CKSUM);
|
||||
cksum_status = calc_checksum(tvb, 0, cnf_hdr_len, cnf_cksum);
|
||||
switch (cksum_status) {
|
||||
default:
|
||||
/*
|
||||
* No checksum present, or not enough of the header present to
|
||||
* checksum it.
|
||||
*/
|
||||
proto_tree_add_uint(clnp_tree, hf_clnp_checksum, tvb,
|
||||
P_CLNP_CKSUM, 2,
|
||||
cnf_cksum);
|
||||
break;
|
||||
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);
|
||||
} else {
|
||||
guint32 c0 = 0, c1 = 0;
|
||||
|
||||
case CKSUM_OK:
|
||||
/*
|
||||
* Checksum is correct.
|
||||
*/
|
||||
proto_tree_add_uint_format_value(clnp_tree, hf_clnp_checksum, tvb,
|
||||
P_CLNP_CKSUM, 2,
|
||||
cnf_cksum,
|
||||
"0x%04x (correct)",
|
||||
cnf_cksum);
|
||||
break;
|
||||
|
||||
case CKSUM_NOT_OK:
|
||||
/*
|
||||
* Checksum is not correct.
|
||||
*/
|
||||
proto_tree_add_uint_format_value(clnp_tree, hf_clnp_checksum, tvb,
|
||||
P_CLNP_CKSUM, 2,
|
||||
cnf_cksum,
|
||||
"0x%04x (incorrect)",
|
||||
cnf_cksum);
|
||||
break;
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
opt_len = cnf_hdr_len;
|
||||
|
@ -475,7 +455,7 @@ dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
((cnf_type & CNF_MORE_SEGS) || segment_offset != 0) &&
|
||||
tvb_bytes_exist(tvb, offset, segment_length - cnf_hdr_len) &&
|
||||
segment_length > cnf_hdr_len &&
|
||||
cksum_status != CKSUM_NOT_OK) {
|
||||
cksum_valid != FALSE) {
|
||||
fd_head = fragment_add_check(&clnp_reassembly_table,
|
||||
tvb, offset, pinfo, du_id, NULL,
|
||||
segment_offset, segment_length - cnf_hdr_len,
|
||||
|
|
|
@ -175,7 +175,7 @@ static int hf_dccp_data_offset = -1;
|
|||
static int hf_dccp_ccval = -1;
|
||||
static int hf_dccp_cscov = -1;
|
||||
static int hf_dccp_checksum = -1;
|
||||
static int hf_dccp_checksum_bad = -1;
|
||||
static int hf_dccp_checksum_status = -1;
|
||||
static int hf_dccp_res1 = -1;
|
||||
static int hf_dccp_type = -1;
|
||||
static int hf_dccp_x = -1;
|
||||
|
@ -600,7 +600,6 @@ dissect_dccp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
proto_item *hidden_item, *offset_item;
|
||||
vec_t cksum_vec[4];
|
||||
guint32 phdr[2];
|
||||
guint16 computed_cksum;
|
||||
guint offset = 0;
|
||||
guint len = 0;
|
||||
guint reported_len = 0;
|
||||
|
@ -695,30 +694,11 @@ 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);
|
||||
computed_cksum = in_cksum(&cksum_vec[0], 4);
|
||||
if (computed_cksum == 0) {
|
||||
proto_tree_add_uint_format_value(dccp_tree,
|
||||
hf_dccp_checksum, tvb,
|
||||
offset, 2,
|
||||
dccph->checksum,
|
||||
"0x%04x [correct]",
|
||||
dccph->checksum);
|
||||
} else {
|
||||
hidden_item =
|
||||
proto_tree_add_boolean(dccp_tree, hf_dccp_checksum_bad,
|
||||
tvb, offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_uint_format_value(
|
||||
dccp_tree, hf_dccp_checksum, tvb, offset, 2,
|
||||
dccph->checksum,
|
||||
"0x%04x [incorrect, should be 0x%04x]",
|
||||
dccph->checksum,
|
||||
in_cksum_shouldbe(dccph->checksum, computed_cksum));
|
||||
}
|
||||
proto_tree_add_checksum(dccp_tree, tvb, offset, hf_dccp_checksum, hf_dccp_checksum_status, NULL, pinfo, in_cksum(&cksum_vec[0], 4),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(dccp_tree, hf_dccp_checksum, tvb,
|
||||
offset, 2, dccph->checksum,
|
||||
"0x%04x", dccph->checksum);
|
||||
proto_tree_add_checksum(dccp_tree, tvb, offset, hf_dccp_checksum, hf_dccp_checksum_status, NULL, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
|
@ -1078,10 +1058,10 @@ proto_register_dccp(void)
|
|||
}
|
||||
},
|
||||
{
|
||||
&hf_dccp_checksum_bad,
|
||||
&hf_dccp_checksum_status,
|
||||
{
|
||||
"Bad Checksum", "dccp.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"Checksum Status", "dccp.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
|
|
|
@ -123,6 +123,7 @@ static int hf_dec_rt_reserved = -1;
|
|||
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_id = -1;
|
||||
static int hf_dec_rt_iinfo = -1;
|
||||
static int hf_dec_rt_iinfo_node_type = -1;
|
||||
|
@ -632,7 +633,6 @@ do_routing_msg(
|
|||
{
|
||||
guint my_offset = offset;
|
||||
guint32 my_checksum = 1;
|
||||
guint16 checksum;
|
||||
guint16 count, startid, rtginfo;
|
||||
guint remainder_count;
|
||||
|
||||
|
@ -667,18 +667,8 @@ do_routing_msg(
|
|||
/* fold 32 bit sum into 16 bits */
|
||||
while (my_checksum>>16)
|
||||
my_checksum = (my_checksum & 0xffff) + (my_checksum >> 16);
|
||||
checksum = tvb_get_letohs(tvb, my_offset);
|
||||
if (checksum != my_checksum) {
|
||||
proto_tree_add_none_format(tree, hf_dec_rt_segment, tvb,
|
||||
my_offset, 2,
|
||||
"Checksum mismatch(computed 0x%x <> received 0x%x)",
|
||||
my_checksum, checksum);
|
||||
} else {
|
||||
proto_tree_add_none_format(tree, hf_dec_rt_segment, tvb,
|
||||
my_offset, 2,
|
||||
"Checksum: match (computed 0x%x = received 0x%x)",
|
||||
my_checksum, checksum);
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(tree, tvb, my_offset, hf_dec_rt_checksum, -1, NULL, pinfo, my_checksum, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
my_offset += 2;
|
||||
return (my_offset);
|
||||
}
|
||||
|
@ -1343,6 +1333,10 @@ proto_register_dec_rt(void)
|
|||
{ "Segment", "dec_dna.ctl.segment",
|
||||
FT_NONE, BASE_NONE, NULL, 0x0,
|
||||
"Routing Segment", HFILL }},
|
||||
{ &hf_dec_rt_checksum,
|
||||
{ "Checksum", "dec_dna.ctl.checksum",
|
||||
FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_dec_rt_id,
|
||||
{ "Transmitting system ID", "dec_dna.ctl.id",
|
||||
FT_ETHER, BASE_NONE, NULL, 0x0,
|
||||
|
|
|
@ -245,8 +245,7 @@ dissect_djiuav_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
|
|||
offset += pdu_length - 1 - offset;
|
||||
}
|
||||
/* FIXME: calculate XOR and validate transmitted value */
|
||||
proto_tree_add_item(djiuav_tree, hf_djiuav_checksum, tvb, offset, 1,
|
||||
ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(djiuav_tree, tvb, offset, hf_djiuav_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 1;
|
||||
|
||||
}
|
||||
|
|
|
@ -358,8 +358,7 @@ static int hf_ack_diagnostic = -1;
|
|||
static int hf_ack_recips = -1;
|
||||
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_good = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
|
||||
static int hf_analysis_ack_time = -1;
|
||||
static int hf_analysis_total_time = -1;
|
||||
|
@ -371,10 +370,10 @@ static int hf_analysis_retrans_no = -1;
|
|||
static int hf_analysis_ack_num = -1;
|
||||
static int hf_analysis_ack_missing = -1;
|
||||
static int hf_analysis_ack_dup_no = -1;
|
||||
static int hf_analysis_rep_num = -1;
|
||||
/* static int hf_analysis_rep_num = -1; */
|
||||
static int hf_analysis_acks_rep_num = -1;
|
||||
static int hf_analysis_rep_time = -1;
|
||||
static int hf_analysis_not_num = -1;
|
||||
/* static int hf_analysis_not_num = -1; */
|
||||
static int hf_analysis_acks_not_num = -1;
|
||||
static int hf_analysis_not_time = -1;
|
||||
static int hf_analysis_msg_resend_from = -1;
|
||||
|
@ -475,8 +474,6 @@ static gint ett_notif_acp127recip = -1;
|
|||
static gint ett_ack = -1;
|
||||
static gint ett_ack_recips = -1;
|
||||
|
||||
static gint ett_checksum = -1;
|
||||
|
||||
static gint ett_analysis = -1;
|
||||
|
||||
static expert_field ei_reserved_value = EI_INIT;
|
||||
|
@ -3968,8 +3965,8 @@ static gint dissect_dmp_extensions (tvbuff_t *tvb, packet_info *pinfo _U_,
|
|||
static int dissect_dmp (tvbuff_t *tvb, packet_info *pinfo,
|
||||
proto_tree *tree, void *data _U_)
|
||||
{
|
||||
proto_tree *dmp_tree = NULL, *checksum_tree = NULL;
|
||||
proto_item *ti = NULL, *en = NULL;
|
||||
proto_tree *dmp_tree;
|
||||
proto_item *ti;
|
||||
guint16 checksum1 = 0, checksum2 = 1;
|
||||
gint length, offset = 0;
|
||||
gboolean retrans_or_dup_ack = FALSE;
|
||||
|
@ -4006,29 +4003,8 @@ static int dissect_dmp (tvbuff_t *tvb, packet_info *pinfo,
|
|||
if (dmp.checksum) {
|
||||
length = tvb_captured_length (tvb);
|
||||
checksum1 = crc16_x25_ccitt_tvb (tvb, length - 2);
|
||||
checksum2 = tvb_get_ntohs (tvb, offset);
|
||||
|
||||
en = proto_tree_add_item (dmp_tree, hf_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
checksum_tree = proto_item_add_subtree (en, ett_checksum);
|
||||
if (checksum1 == checksum2) {
|
||||
proto_item_append_text (en, " (correct)");
|
||||
en = proto_tree_add_boolean (checksum_tree, hf_checksum_good, tvb,
|
||||
offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED (en);
|
||||
en = proto_tree_add_boolean (checksum_tree, hf_checksum_bad, tvb,
|
||||
offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED (en);
|
||||
} else {
|
||||
proto_item_append_text (en, " (incorrect, should be 0x%04x)",
|
||||
checksum1);
|
||||
expert_add_info(pinfo, en, &ei_checksum_bad);
|
||||
en = proto_tree_add_boolean (checksum_tree, hf_checksum_good, tvb,
|
||||
offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED (en);
|
||||
en = proto_tree_add_boolean (checksum_tree, hf_checksum_bad, tvb,
|
||||
offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED (en);
|
||||
}
|
||||
proto_tree_add_checksum(dmp_tree, tvb, offset, hf_checksum, hf_checksum_status, &ei_checksum_bad, pinfo, checksum1, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
offset += 2;
|
||||
}
|
||||
|
||||
|
@ -4773,12 +4749,9 @@ void proto_register_dmp (void)
|
|||
{ &hf_checksum,
|
||||
{ "Checksum", "dmp.checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_checksum_good,
|
||||
{ "Good", "dmp.checksum_good", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "True: checksum matches packet content; False: doesn't match content or not checked", HFILL } },
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad", "dmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "True: checksum doesn't match packet content; False: matches content or not checked", HFILL } },
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "dmp.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL } },
|
||||
|
||||
/*
|
||||
** Ack matching / Resend
|
||||
|
@ -4810,15 +4783,17 @@ void proto_register_dmp (void)
|
|||
{ &hf_analysis_ack_num,
|
||||
{ "Acknowledgement in", "dmp.analysis.ack_in", FT_FRAMENUM, BASE_NONE,
|
||||
NULL, 0x0, "This packet has an Acknowledgement in this frame", HFILL } },
|
||||
{ &hf_analysis_rep_num,
|
||||
{ "Report in", "dmp.analysis.report_in", FT_FRAMENUM, BASE_NONE,
|
||||
NULL, 0x0, "This packet has a Report in this frame", HFILL } },
|
||||
{ &hf_analysis_acks_rep_num,
|
||||
{ "This is an Ack to the Report in", "dmp.analysis.acks_report_in", FT_FRAMENUM, BASE_NONE,
|
||||
FRAMENUM_TYPE(FT_FRAMENUM_ACK), 0x0, "This packet ACKs a Report in this frame", HFILL } },
|
||||
#if 0
|
||||
{ &hf_analysis_rep_num,
|
||||
{ "Report in", "dmp.analysis.report_in", FT_FRAMENUM, BASE_NONE,
|
||||
NULL, 0x0, "This packet has a Report in this frame", HFILL } },
|
||||
{ &hf_analysis_not_num,
|
||||
{ "Notification in", "dmp.analysis.notif_in", FT_FRAMENUM, BASE_NONE,
|
||||
NULL, 0x0, "This packet has a Notification in this frame", HFILL } },
|
||||
#endif
|
||||
{ &hf_analysis_acks_not_num,
|
||||
{ "This is an Ack to the Notification in", "dmp.analysis.acks_notif_in", FT_FRAMENUM, BASE_NONE,
|
||||
FRAMENUM_TYPE(FT_FRAMENUM_ACK), 0x0, "This packet ACKs a Notification in this frame", HFILL } },
|
||||
|
@ -4962,7 +4937,6 @@ void proto_register_dmp (void)
|
|||
&ett_notif_acp127recip,
|
||||
&ett_ack,
|
||||
&ett_ack_recips,
|
||||
&ett_checksum,
|
||||
&ett_analysis
|
||||
};
|
||||
|
||||
|
|
|
@ -92,8 +92,7 @@ static int hf_dmx_sip_fourth_dev_id = -1;
|
|||
static int hf_dmx_sip_fifth_dev_id = -1;
|
||||
static int hf_dmx_sip_reserved = -1;
|
||||
static int hf_dmx_sip_checksum = -1;
|
||||
static int hf_dmx_sip_checksum_good = -1;
|
||||
static int hf_dmx_sip_checksum_bad = -1;
|
||||
static int hf_dmx_sip_checksum_status = -1;
|
||||
static int hf_dmx_sip_trailer = -1;
|
||||
|
||||
static int hf_dmx_test_data = -1;
|
||||
|
@ -201,9 +200,6 @@ dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
|
|||
if (tree != NULL) {
|
||||
guint offset = 0;
|
||||
guint byte_count;
|
||||
guint checksum, checksum_shouldbe;
|
||||
proto_item *item;
|
||||
proto_tree *checksum_tree;
|
||||
|
||||
proto_tree *ti = proto_tree_add_item(tree, proto_dmx_sip, tvb,
|
||||
offset, -1, ENC_NA);
|
||||
|
@ -273,34 +269,7 @@ dissect_dmx_sip(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
|
|||
offset += (byte_count - offset);
|
||||
}
|
||||
|
||||
dmx_sip_checksum(tvb, offset);
|
||||
|
||||
checksum_shouldbe = dmx_sip_checksum(tvb, offset);
|
||||
checksum = tvb_get_guint8(tvb, offset);
|
||||
item = proto_tree_add_item(dmx_sip_tree, hf_dmx_sip_checksum, tvb,
|
||||
offset, 1, ENC_BIG_ENDIAN);
|
||||
if (checksum == checksum_shouldbe) {
|
||||
proto_item_append_text(item, " [correct]");
|
||||
|
||||
checksum_tree = proto_item_add_subtree(item, ett_dmx_sip);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_good, tvb,
|
||||
offset, 1, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_bad, tvb,
|
||||
offset, 1, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
proto_item_append_text(item, " [incorrect, should be 0x%02x]", checksum_shouldbe);
|
||||
|
||||
checksum_tree = proto_item_add_subtree(item, ett_dmx_sip);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_good, tvb,
|
||||
offset, 1, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_dmx_sip_checksum_bad, tvb,
|
||||
offset, 1, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
|
||||
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);
|
||||
offset += 1;
|
||||
|
||||
if (offset < tvb_reported_length(tvb))
|
||||
|
@ -600,15 +569,10 @@ proto_register_dmx_sip(void)
|
|||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_dmx_sip_checksum_good,
|
||||
{ "Good Checksum", "dmx_sip.checksum_good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content", HFILL }},
|
||||
|
||||
{ &hf_dmx_sip_checksum_bad,
|
||||
{ "Bad Checksum", "dmx_sip.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content", HFILL }},
|
||||
{ &hf_dmx_sip_checksum_status,
|
||||
{ "Checksum Status", "dmx_sip.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_dmx_sip_trailer,
|
||||
{ "Trailer", "dmx_sip.trailer",
|
||||
|
|
|
@ -784,13 +784,9 @@ 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;
|
||||
if (check_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, cur_off, input8)) {
|
||||
proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_crc, tvb,
|
||||
cur_off + DVB_S2_BB_OFFS_CRC, 1, 1, "Checksum: correct (0x%2.2x)", input8);
|
||||
} else {
|
||||
proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_crc, tvb,
|
||||
cur_off + DVB_S2_BB_OFFS_CRC, 1, -1, "Checksum: incorrect! (0x%2.2x)", input8);
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, -1, NULL, pinfo,
|
||||
check_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, cur_off, input8), ENC_NA, PROTO_CHECKSUM_VERIFY);
|
||||
|
||||
while (bb_data_len) {
|
||||
/* start DVB-GSE dissector */
|
||||
|
@ -987,7 +983,7 @@ void proto_register_dvb_s2_modeadapt(void)
|
|||
"Distance to first user packet", HFILL}
|
||||
},
|
||||
{&hf_dvb_s2_bb_crc, {
|
||||
"CRC", "dvb-s2_bb.crc",
|
||||
"Checksum", "dvb-s2_bb.crc",
|
||||
FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
"CRC-8", HFILL}
|
||||
}
|
||||
|
|
|
@ -63,7 +63,7 @@ static int hf_version = -1;
|
|||
static int hf_type = -1;
|
||||
static int hf_code_v1 = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
static int hf_reserved = -1;
|
||||
static int hf_commands = -1;
|
||||
static int hf_command = -1;
|
||||
|
@ -336,7 +336,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* skip unused byte */
|
||||
|
@ -525,7 +525,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* decode all the v1 commands */
|
||||
|
@ -720,9 +720,9 @@ proto_register_dvmrp(void)
|
|||
{ "Checksum", "dvmrp.checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0, "DVMRP Checksum", HFILL }},
|
||||
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad Checksum", "dvmrp.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "Bad DVMRP Checksum", HFILL }},
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "dvmrp.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_reserved,
|
||||
{ "Reserved", "dvmrp.reserved", FT_UINT16, BASE_HEX,
|
||||
|
|
|
@ -2416,9 +2416,9 @@ static int
|
|||
dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
||||
{
|
||||
proto_item *ti;
|
||||
proto_tree *eigrp_tree = NULL, *tlv_tree;
|
||||
proto_tree *eigrp_tree, *tlv_tree;
|
||||
guint opcode, vrid;
|
||||
guint16 tlv, checksum, cacl_checksum;
|
||||
guint16 tlv;
|
||||
guint32 ack, size, offset = EIGRP_HEADER_LENGTH;
|
||||
|
||||
/* Make entries in Protocol column and Info column on summary display */
|
||||
|
@ -2463,18 +2463,7 @@ dissect_eigrp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _
|
|||
ENC_BIG_ENDIAN);
|
||||
|
||||
size = tvb_captured_length(tvb);
|
||||
checksum = tvb_get_ntohs(tvb, 2);
|
||||
cacl_checksum = ip_checksum_tvb(tvb, 0, size);
|
||||
|
||||
if (cacl_checksum == checksum) {
|
||||
proto_tree_add_uint_format_value(eigrp_tree, hf_eigrp_checksum, tvb, 2, 2,
|
||||
checksum, "0x%02x [incorrect]",
|
||||
checksum);
|
||||
expert_add_info(pinfo, ti, &ei_eigrp_checksum_bad);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(eigrp_tree, hf_eigrp_checksum, tvb, 2, 2,
|
||||
checksum, "0x%02x [correct]", checksum);
|
||||
}
|
||||
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);
|
||||
|
||||
/* Decode the EIGRP Flags Field */
|
||||
proto_tree_add_bitmask(eigrp_tree, tvb, 4, hf_eigrp_flags, ett_eigrp_flags,
|
||||
|
|
|
@ -172,16 +172,8 @@ 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);
|
||||
|
||||
if (sent_checksum == checksum) {
|
||||
proto_tree_add_uint_format_value(epon_tree, hf_epon_checksum, tvb,
|
||||
5+offset, 1, sent_checksum,
|
||||
"0x%01x [correct]", sent_checksum);
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(epon_tree, hf_epon_checksum, tvb,
|
||||
5+offset, 1, sent_checksum,
|
||||
"0x%01x [incorrect, should be 0x%01x]",
|
||||
sent_checksum, checksum);
|
||||
expert_add_info(pinfo, item, &ei_epon_checksum_bad);
|
||||
proto_tree_add_checksum(epon_tree, tvb, 5+offset, hf_epon_checksum, -1, &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]");
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,6 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
proto_tree *esis_tree = NULL;
|
||||
guint8 variable_len, type;
|
||||
guint16 holdtime, checksum;
|
||||
const char *cksum_status;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ESIS");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
@ -285,31 +284,19 @@ dissect_esis(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
holdtime, "%u seconds", holdtime);
|
||||
|
||||
checksum = tvb_get_ntohs(tvb, 7);
|
||||
switch (calc_checksum( tvb, 0, length, checksum)) {
|
||||
if (checksum == 0) {
|
||||
/* No checksum present */
|
||||
proto_tree_add_checksum(esis_tree, tvb, 7, hf_esis_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
|
||||
} else {
|
||||
guint32 c0 = 0, c1 = 0;
|
||||
|
||||
case NO_CKSUM:
|
||||
cksum_status = "Not Used";
|
||||
break;
|
||||
|
||||
case DATA_MISSING:
|
||||
cksum_status = "Not checkable - not all of packet was captured";
|
||||
break;
|
||||
|
||||
case CKSUM_OK:
|
||||
cksum_status = "Is good";
|
||||
break;
|
||||
|
||||
case CKSUM_NOT_OK:
|
||||
cksum_status = "Is wrong";
|
||||
break;
|
||||
|
||||
default:
|
||||
cksum_status = NULL;
|
||||
DISSECTOR_ASSERT_NOT_REACHED();
|
||||
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);
|
||||
} 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_uint_format_value( esis_tree, hf_esis_checksum, tvb, 7, 2,
|
||||
checksum, "0x%x ( %s )", checksum, cksum_status );
|
||||
|
||||
|
||||
/*
|
||||
* Let us make sure we use the same names for all our decodes
|
||||
|
|
|
@ -78,14 +78,12 @@ static int hf_eth_ig = -1;
|
|||
static int hf_eth_padding = -1;
|
||||
static int hf_eth_trailer = -1;
|
||||
static int hf_eth_fcs = -1;
|
||||
static int hf_eth_fcs_good = -1;
|
||||
static int hf_eth_fcs_bad = -1;
|
||||
static int hf_eth_fcs_status = -1;
|
||||
|
||||
static gint ett_ieee8023 = -1;
|
||||
static gint ett_ether2 = -1;
|
||||
static gint ett_ether = -1;
|
||||
static gint ett_addr = -1;
|
||||
static gint ett_eth_fcs = -1;
|
||||
|
||||
static expert_field ei_eth_invalid_lentype = EI_INIT;
|
||||
static expert_field ei_eth_src_not_group = EI_INIT;
|
||||
|
@ -647,8 +645,6 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
|||
have had 64 or more bytes - i.e., it was at least an FCS worth of data
|
||||
longer than the minimum payload size - we could assume the last 4 bytes
|
||||
of the trailer are an FCS. */
|
||||
proto_item *item;
|
||||
proto_tree *checksum_tree;
|
||||
heur_dtbl_entry_t *hdtbl_entry;
|
||||
|
||||
if (trailer_tvb) {
|
||||
|
@ -749,43 +745,13 @@ add_ethernet_trailer(packet_info *pinfo, proto_tree *tree, proto_tree *fh_tree,
|
|||
guint32 sent_fcs = tvb_get_ntohl(trailer_tvb, padding_length+trailer_length);
|
||||
if(eth_check_fcs){
|
||||
guint32 fcs = crc32_802_tvb(tvb, tvb_captured_length(tvb) - 4);
|
||||
if (fcs == sent_fcs) {
|
||||
item = proto_tree_add_uint_format_value(fh_tree, hf_eth_fcs, trailer_tvb,
|
||||
padding_length+trailer_length, 4, sent_fcs,
|
||||
"0x%08x [correct]", sent_fcs);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_eth_fcs);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_good, trailer_tvb,
|
||||
padding_length+trailer_length, 4, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, trailer_tvb,
|
||||
padding_length+trailer_length, 4, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(fh_tree, hf_eth_fcs, trailer_tvb,
|
||||
padding_length+trailer_length, 4, sent_fcs,
|
||||
"0x%08x [incorrect, should be 0x%08x]",
|
||||
sent_fcs, fcs);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_eth_fcs);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_good, trailer_tvb,
|
||||
padding_length+trailer_length, 4, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, trailer_tvb,
|
||||
padding_length+trailer_length, 4, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
expert_add_info(pinfo, item, &ei_eth_fcs_bad);
|
||||
proto_tree_add_checksum(fh_tree, trailer_tvb, padding_length+trailer_length, hf_eth_fcs, hf_eth_fcs_status, &ei_eth_fcs_bad, pinfo, fcs, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
|
||||
if (fcs != sent_fcs) {
|
||||
col_append_str(pinfo->cinfo, COL_INFO, " [ETHERNET FRAME CHECK SEQUENCE INCORRECT]");
|
||||
}
|
||||
}else{
|
||||
item = proto_tree_add_uint_format_value(fh_tree, hf_eth_fcs, trailer_tvb,
|
||||
padding_length+trailer_length, 4, sent_fcs,
|
||||
"0x%08x [validation disabled]", sent_fcs);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_eth_fcs);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_good, trailer_tvb,
|
||||
padding_length+trailer_length, 4, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_eth_fcs_bad, trailer_tvb,
|
||||
padding_length+trailer_length, 4, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
proto_tree_add_checksum(fh_tree, trailer_tvb, padding_length+trailer_length, hf_eth_fcs, hf_eth_fcs_status, &ei_eth_fcs_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
trailer_length += 4;
|
||||
}
|
||||
|
@ -919,13 +885,9 @@ proto_register_eth(void)
|
|||
{ "Frame check sequence", "eth.fcs", FT_UINT32, BASE_HEX, NULL, 0x0,
|
||||
"Ethernet checksum", HFILL }},
|
||||
|
||||
{ &hf_eth_fcs_good,
|
||||
{ "FCS Good", "eth.fcs_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
|
||||
|
||||
{ &hf_eth_fcs_bad,
|
||||
{ "FCS Bad", "eth.fcs_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: does match content or not checked", HFILL }},
|
||||
{ &hf_eth_fcs_status,
|
||||
{ "FCS Status", "eth.fcs.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_eth_lg,
|
||||
{ "LG bit", "eth.lg", FT_BOOLEAN, 24,
|
||||
|
@ -942,13 +904,12 @@ proto_register_eth(void)
|
|||
&ett_ether2,
|
||||
&ett_ether,
|
||||
&ett_addr,
|
||||
&ett_eth_fcs
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
{ &ei_eth_invalid_lentype, { "eth.invalid_lentype.expert", PI_PROTOCOL, PI_WARN, "Invalid length/type", EXPFILL }},
|
||||
{ &ei_eth_src_not_group, { "eth.src_not_group", PI_PROTOCOL, PI_WARN, "Source MAC must not be a group address: IEEE 802.3-2002, Section 3.2.3(b)", EXPFILL }},
|
||||
{ &ei_eth_fcs_bad, { "eth.fcs_bad.expert", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
|
||||
{ &ei_eth_fcs_bad, { "eth.fcs_bad", PI_CHECKSUM, PI_ERROR, "Bad checksum", EXPFILL }},
|
||||
{ &ei_eth_len, { "eth.len.past_end", PI_MALFORMED, PI_ERROR, "Length field value goes past the end of the payload", EXPFILL }},
|
||||
};
|
||||
|
||||
|
|
|
@ -159,8 +159,7 @@ static int hf_edp_version = -1;
|
|||
static int hf_edp_reserved = -1;
|
||||
static int hf_edp_length = -1;
|
||||
static int hf_edp_checksum = -1;
|
||||
static int hf_edp_checksum_good = -1;
|
||||
static int hf_edp_checksum_bad = -1;
|
||||
static int hf_edp_checksum_status = -1;
|
||||
|
||||
static int hf_edp_seqno = -1;
|
||||
static int hf_edp_midtype = -1;
|
||||
|
@ -255,7 +254,6 @@ static int hf_edp_null = -1;
|
|||
static expert_field ei_edp_short_tlv = EI_INIT;
|
||||
|
||||
static gint ett_edp = -1;
|
||||
static gint ett_edp_checksum = -1;
|
||||
static gint ett_edp_tlv_header = -1;
|
||||
static gint ett_edp_display = -1;
|
||||
static gint ett_edp_info = -1;
|
||||
|
@ -950,11 +948,7 @@ dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
{
|
||||
proto_item *ti;
|
||||
proto_tree *edp_tree;
|
||||
proto_item *checksum_item;
|
||||
proto_tree *checksum_tree;
|
||||
guint32 offset = 0;
|
||||
guint16 packet_checksum, computed_checksum;
|
||||
gboolean checksum_good, checksum_bad;
|
||||
gboolean last = FALSE;
|
||||
guint8 tlv_type;
|
||||
guint16 tlv_length;
|
||||
|
@ -982,40 +976,18 @@ dissect_edp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
data_length);
|
||||
offset += 2;
|
||||
|
||||
packet_checksum = tvb_get_ntohs(tvb, offset);
|
||||
/*
|
||||
* If we have the entire ESP packet available, check the checksum.
|
||||
*/
|
||||
if (tvb_captured_length(tvb) >= data_length) {
|
||||
/* Checksum from version to null tlv */
|
||||
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, data_length);
|
||||
computed_checksum = in_cksum(&cksum_vec[0], 1);
|
||||
checksum_good = (computed_checksum == 0);
|
||||
checksum_bad = !checksum_good;
|
||||
if (checksum_good) {
|
||||
checksum_item = proto_tree_add_uint_format(edp_tree,
|
||||
hf_edp_checksum, tvb, offset, 2, packet_checksum,
|
||||
"Checksum: 0x%04x [correct]",
|
||||
packet_checksum);
|
||||
} else {
|
||||
checksum_item = proto_tree_add_uint_format(edp_tree,
|
||||
hf_edp_checksum, tvb, offset, 2, packet_checksum,
|
||||
"Checksum: 0x%04x [incorrect, should be 0x%04x]",
|
||||
packet_checksum,
|
||||
in_cksum_shouldbe(packet_checksum, computed_checksum));
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(edp_tree, tvb, offset, hf_edp_checksum, hf_edp_checksum_status, NULL, pinfo, in_cksum(&cksum_vec[0], 1),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
} else {
|
||||
checksum_good = checksum_bad = FALSE;
|
||||
checksum_item = proto_tree_add_uint(edp_tree, hf_edp_checksum,
|
||||
tvb, offset, 2, packet_checksum);
|
||||
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);
|
||||
}
|
||||
checksum_tree = proto_item_add_subtree(checksum_item, ett_edp_checksum);
|
||||
checksum_item = proto_tree_add_boolean(checksum_tree, hf_edp_checksum_good,
|
||||
tvb, offset, 2, checksum_good);
|
||||
PROTO_ITEM_SET_GENERATED(checksum_item);
|
||||
checksum_item = proto_tree_add_boolean(checksum_tree, hf_edp_checksum_bad,
|
||||
tvb, offset, 2, checksum_bad);
|
||||
PROTO_ITEM_SET_GENERATED(checksum_item);
|
||||
offset += 2;
|
||||
|
||||
seqno = tvb_get_ntohs(tvb, offset);
|
||||
|
@ -1114,13 +1086,9 @@ proto_register_edp(void)
|
|||
{ "EDP checksum", "edp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_edp_checksum_good,
|
||||
{ "Good", "edp.checksum_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
|
||||
|
||||
{ &hf_edp_checksum_bad,
|
||||
{ "Bad", "edp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content or not checked", HFILL }},
|
||||
{ &hf_edp_checksum_status,
|
||||
{ "EDP checksum status", "edp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_edp_seqno,
|
||||
{ "Sequence number", "edp.seqno", FT_UINT16, BASE_DEC, NULL,
|
||||
|
@ -1455,7 +1423,6 @@ proto_register_edp(void)
|
|||
|
||||
static gint *ett[] = {
|
||||
&ett_edp,
|
||||
&ett_edp_checksum,
|
||||
&ett_edp_tlv_header,
|
||||
&ett_edp_vlan_flags,
|
||||
&ett_edp_display,
|
||||
|
|
|
@ -1270,37 +1270,28 @@ dissect_fc_ifcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data
|
|||
static int
|
||||
dissect_fcsof(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_) {
|
||||
|
||||
proto_item *it = NULL;
|
||||
proto_tree *fcsof_tree = NULL;
|
||||
tvbuff_t *next_tvb, *checksum_tvb;
|
||||
guint32 sof = 0;
|
||||
guint32 crc = 0;
|
||||
guint32 crc_computed = 0;
|
||||
guint32 eof = 0;
|
||||
gint crc_offset = 0;
|
||||
gint eof_offset = 0;
|
||||
gint sof_offset = 0;
|
||||
proto_item *it;
|
||||
proto_tree *fcsof_tree;
|
||||
tvbuff_t *next_tvb;
|
||||
guint32 sof;
|
||||
guint32 crc_computed;
|
||||
guint32 eof;
|
||||
const gint FCSOF_TRAILER_LEN = 8;
|
||||
const gint FCSOF_HEADER_LEN = 4;
|
||||
gint frame_len_for_checksum = 0;
|
||||
gint crc_offset = tvb_reported_length(tvb) - FCSOF_TRAILER_LEN;
|
||||
gint eof_offset = crc_offset + 4;
|
||||
gint sof_offset = 0;
|
||||
gint frame_len_for_checksum;
|
||||
fc_data_t fc_data;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FC");
|
||||
|
||||
crc_offset = tvb_reported_length(tvb) - FCSOF_TRAILER_LEN;
|
||||
eof_offset = crc_offset + 4;
|
||||
sof_offset = 0;
|
||||
|
||||
/* Get SOF */
|
||||
sof = tvb_get_ntohl(tvb, 0);
|
||||
|
||||
/* GET CRC */
|
||||
crc = tvb_get_ntohl(tvb, crc_offset);
|
||||
|
||||
/* GET Computed CRC */
|
||||
frame_len_for_checksum = crc_offset - FCSOF_HEADER_LEN;
|
||||
checksum_tvb = tvb_new_subset_length(tvb, 4, frame_len_for_checksum);
|
||||
crc_computed = crc32_802_tvb(checksum_tvb, frame_len_for_checksum);
|
||||
crc_computed = crc32_802_tvb(tvb_new_subset_length(tvb, 4, frame_len_for_checksum), frame_len_for_checksum);
|
||||
|
||||
/* Get EOF */
|
||||
eof = tvb_get_ntohl(tvb, eof_offset);
|
||||
|
@ -1314,20 +1305,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);
|
||||
|
||||
if (crc == crc_computed) {
|
||||
proto_tree_add_uint_format_value(fcsof_tree, hf_fccrc, tvb,
|
||||
crc_offset, 4, crc,
|
||||
"%8.8x [valid]", crc);
|
||||
} else {
|
||||
it = proto_tree_add_uint_format_value(fcsof_tree, hf_fccrc, tvb,
|
||||
crc_offset, 4, crc,
|
||||
"%8.8x [error: should be %8.8x]",
|
||||
crc, crc_computed);
|
||||
|
||||
expert_add_info_format(pinfo, it, &ei_fccrc,
|
||||
"Bad FC CRC %8.8x %8.x",
|
||||
crc, crc_computed);
|
||||
}
|
||||
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_uint(fcsof_tree, hf_fceof, tvb, eof_offset, 4, eof);
|
||||
|
||||
|
|
|
@ -95,11 +95,9 @@ static int hf_fcoe_len = -1;
|
|||
static int hf_fcoe_sof = -1;
|
||||
static int hf_fcoe_eof = -1;
|
||||
static int hf_fcoe_crc = -1;
|
||||
static int hf_fcoe_crc_bad = -1;
|
||||
static int hf_fcoe_crc_good = -1;
|
||||
static int hf_fcoe_crc_status = -1;
|
||||
|
||||
static int ett_fcoe = -1;
|
||||
static int ett_fcoe_crc = -1;
|
||||
|
||||
static expert_field ei_fcoe_crc = EI_INIT;
|
||||
|
||||
|
@ -122,9 +120,7 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
const char *crc_msg;
|
||||
const char *len_msg;
|
||||
proto_item *ti;
|
||||
proto_item *item;
|
||||
proto_tree *fcoe_tree;
|
||||
proto_tree *crc_tree;
|
||||
tvbuff_t *next_tvb;
|
||||
gboolean crc_exists;
|
||||
guint32 crc_computed = 0;
|
||||
|
@ -213,34 +209,12 @@ dissect_fcoe(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
* Create the CRC information.
|
||||
*/
|
||||
if (crc_exists) {
|
||||
if (crc == crc_computed) {
|
||||
item = proto_tree_add_uint_format_value(fcoe_tree, hf_fcoe_crc, tvb,
|
||||
crc_offset, 4, crc,
|
||||
"%8.8x [valid]", crc);
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(fcoe_tree, hf_fcoe_crc, tvb,
|
||||
crc_offset, 4, crc,
|
||||
"%8.8x [error: should be %8.8x]",
|
||||
crc, crc_computed);
|
||||
expert_add_info_format(pinfo, item, &ei_fcoe_crc,
|
||||
"Bad FC CRC %8.8x %8.x",
|
||||
crc, crc_computed);
|
||||
}
|
||||
proto_tree_add_checksum(fcoe_tree, tvb, crc_offset, hf_fcoe_crc, hf_fcoe_crc_status, &ei_fcoe_crc, pinfo, crc_computed, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
proto_tree_set_appendix(fcoe_tree, tvb, crc_offset,
|
||||
tvb_captured_length_remaining (tvb, crc_offset));
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(fcoe_tree, hf_fcoe_crc, tvb, crc_offset, 0,
|
||||
0, "CRC: [missing]");
|
||||
proto_tree_add_checksum(fcoe_tree, tvb, crc_offset, hf_fcoe_crc, hf_fcoe_crc_status, &ei_fcoe_crc, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
|
||||
}
|
||||
crc_tree = proto_item_add_subtree(item, ett_fcoe_crc);
|
||||
ti = proto_tree_add_boolean(crc_tree, hf_fcoe_crc_bad, tvb,
|
||||
crc_offset, 4,
|
||||
crc_exists && crc != crc_computed);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
ti = proto_tree_add_boolean(crc_tree, hf_fcoe_crc_good, tvb,
|
||||
crc_offset, 4,
|
||||
crc_exists && crc == crc_computed);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
|
||||
/*
|
||||
* Interpret the EOF.
|
||||
|
@ -294,16 +268,12 @@ proto_register_fcoe(void)
|
|||
BASE_DEC, NULL, 0, NULL, HFILL}},
|
||||
{ &hf_fcoe_crc,
|
||||
{"CRC", "fcoe.crc", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
|
||||
{ &hf_fcoe_crc_good,
|
||||
{"CRC good", "fcoe.crc_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: CRC matches packet content; False: doesn't match or not checked.", HFILL }},
|
||||
{ &hf_fcoe_crc_bad,
|
||||
{"CRC bad", "fcoe.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: CRC doesn't match packet content; False: matches or not checked.", HFILL }}
|
||||
{ &hf_fcoe_crc_status,
|
||||
{"CRC Status", "fcoe.crc.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }}
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_fcoe,
|
||||
&ett_fcoe_crc
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
|
|
|
@ -96,11 +96,9 @@ static int hf_fcoib_sig = -1;
|
|||
static int hf_fcoib_sof = -1;
|
||||
static int hf_fcoib_eof = -1;
|
||||
static int hf_fcoib_crc = -1;
|
||||
static int hf_fcoib_crc_bad = -1;
|
||||
static int hf_fcoib_crc_good = -1;
|
||||
static int hf_fcoib_crc_status = -1;
|
||||
|
||||
static int ett_fcoib = -1;
|
||||
static int ett_fcoib_crc = -1;
|
||||
|
||||
static expert_field ei_fcoib_crc = EI_INIT;
|
||||
|
||||
|
@ -161,9 +159,7 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
|
|||
const char *crc_msg;
|
||||
const char *len_msg;
|
||||
proto_item *ti;
|
||||
proto_item *item;
|
||||
proto_tree *fcoib_tree;
|
||||
proto_tree *crc_tree;
|
||||
tvbuff_t *next_tvb;
|
||||
gboolean crc_exists;
|
||||
guint32 crc_computed = 0;
|
||||
|
@ -268,34 +264,12 @@ dissect_fcoib(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U
|
|||
* Create the CRC information.
|
||||
*/
|
||||
if (crc_exists) {
|
||||
if (crc == crc_computed) {
|
||||
item = proto_tree_add_uint_format_value(fcoib_tree, hf_fcoib_crc, tvb,
|
||||
crc_offset, 4, crc,
|
||||
"%8.8x [valid]", crc);
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(fcoib_tree, hf_fcoib_crc, tvb,
|
||||
crc_offset, 4, crc,
|
||||
"%8.8x [error: should be %8.8x]",
|
||||
crc, crc_computed);
|
||||
expert_add_info_format(pinfo, item, &ei_fcoib_crc,
|
||||
"Bad FC CRC %8.8x %8.x",
|
||||
crc, crc_computed);
|
||||
}
|
||||
proto_tree_add_checksum(fcoib_tree, tvb, crc_offset, hf_fcoib_crc, hf_fcoib_crc_status, &ei_fcoib_crc, pinfo, crc_computed, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
proto_tree_set_appendix(fcoib_tree, tvb, crc_offset,
|
||||
tvb_captured_length_remaining (tvb, crc_offset));
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(fcoib_tree, hf_fcoib_crc, tvb, crc_offset, 0,
|
||||
0, "CRC: [missing]");
|
||||
proto_tree_add_checksum(fcoib_tree, tvb, crc_offset, hf_fcoib_crc, hf_fcoib_crc_status, &ei_fcoib_crc, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
|
||||
}
|
||||
crc_tree = proto_item_add_subtree(item, ett_fcoib_crc);
|
||||
ti = proto_tree_add_boolean(crc_tree, hf_fcoib_crc_bad, tvb,
|
||||
crc_offset, 4,
|
||||
crc_exists && crc != crc_computed);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
ti = proto_tree_add_boolean(crc_tree, hf_fcoib_crc_good, tvb,
|
||||
crc_offset, 4,
|
||||
crc_exists && crc == crc_computed);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
|
||||
/*
|
||||
* Interpret the EOF.
|
||||
|
@ -349,16 +323,12 @@ proto_register_fcoib(void)
|
|||
{"Version", "fcoib.ver", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL}},
|
||||
{ &hf_fcoib_crc,
|
||||
{"CRC", "fcoib.crc", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL}},
|
||||
{ &hf_fcoib_crc_good,
|
||||
{"CRC good", "fcoib.crc_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: CRC matches packet content; False: doesn't match or not checked.", HFILL }},
|
||||
{ &hf_fcoib_crc_bad,
|
||||
{"CRC bad", "fcoib.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: CRC doesn't match packet content; False: matches or not checked.", HFILL }}
|
||||
{ &hf_fcoib_crc_status,
|
||||
{"CRC Status", "fcoib.crc.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_fcoib,
|
||||
&ett_fcoib_crc
|
||||
};
|
||||
|
||||
static ei_register_info ei[] = {
|
||||
|
|
|
@ -1015,7 +1015,7 @@ dissect_swils_fspf_lsrechdr(tvbuff_t *tvb, proto_tree *tree, int offset)
|
|||
proto_tree_add_item(tree, hf_swils_lsrh_lsid, tvb, offset+11, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree, hf_swils_lsrh_adv_domid, tvb, offset+15, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree, hf_swils_lsrh_ls_incid, tvb, offset+16, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(tree, hf_swils_lsrh_checksum, tvb, offset+20, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tvb, offset+20, hf_swils_lsrh_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_tree_add_item(tree, hf_swils_lsrh_lsr_length, tvb, offset+22, 2, ENC_BIG_ENDIAN);
|
||||
}
|
||||
|
||||
|
|
|
@ -94,31 +94,30 @@ dissect_fefd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
guint16 length;
|
||||
proto_tree *tlv_tree;
|
||||
int real_length;
|
||||
static const int * flags[] = {
|
||||
&hf_fefd_flags_rt,
|
||||
&hf_fefd_flags_rsy,
|
||||
NULL
|
||||
};
|
||||
static const int * headers[] = {
|
||||
&hf_fefd_version,
|
||||
&hf_fefd_opcode,
|
||||
NULL
|
||||
};
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "FEFD");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
||||
if (tree) {
|
||||
proto_item *flags_ti;
|
||||
proto_tree *flags_tree;
|
||||
ti = proto_tree_add_item(tree, proto_fefd, tvb, offset, -1, ENC_NA);
|
||||
fefd_tree = proto_item_add_subtree(ti, ett_fefd);
|
||||
|
||||
ti = proto_tree_add_item(tree, proto_fefd, tvb, offset, -1, ENC_NA);
|
||||
fefd_tree = proto_item_add_subtree(ti, ett_fefd);
|
||||
|
||||
/* FEFD header */
|
||||
proto_tree_add_item(fefd_tree, hf_fefd_version, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(fefd_tree, hf_fefd_opcode, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
flags_ti = proto_tree_add_item(fefd_tree, hf_fefd_flags, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
flags_tree = proto_item_add_subtree(flags_ti, ett_fefd_flags);
|
||||
proto_tree_add_item(flags_tree, hf_fefd_flags_rt, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(flags_tree, hf_fefd_flags_rsy, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
proto_tree_add_item(fefd_tree, hf_fefd_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
} else {
|
||||
offset += 4; /* The version/opcode/flags/checksum fields from above */
|
||||
}
|
||||
/* FEFD header */
|
||||
proto_tree_add_bitmask_list(fefd_tree, tvb, offset, 1, headers, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
proto_tree_add_bitmask(fefd_tree, tvb, offset, hf_fefd_flags, ett_fefd_flags, flags, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
proto_tree_add_checksum(fefd_tree, tvb, offset, hf_fefd_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
while (tvb_reported_length_remaining(tvb, offset) != 0) {
|
||||
type = tvb_get_ntohs(tvb, offset + TLV_TYPE);
|
||||
|
|
|
@ -284,7 +284,7 @@ dissect_fdp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
offset += 1;
|
||||
proto_tree_add_item(fdp_tree, hf_fdp_holdtime, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
proto_tree_add_item(fdp_tree, hf_fdp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(fdp_tree, tvb, offset, hf_fdp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
/* Decode the individual TLVs */
|
||||
|
|
|
@ -104,8 +104,7 @@ dissect_gdb_token(void *tvbparse_data, const void *wanted_data, tvbparse_elem_t
|
|||
case GDB_TOK_CHKSUM:
|
||||
/* the spec is not really explicit but it seems that the
|
||||
checksum is big endian */
|
||||
proto_tree_add_item(tree, hf_gdb_chksum,
|
||||
tok->tvb, tok->offset, tok->len, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tok->tvb, tok->offset, hf_gdb_chksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -53,8 +53,7 @@ void proto_register_gfp(void);
|
|||
static int proto_gfp = -1;
|
||||
static int hf_gfp_pli = -1;
|
||||
static int hf_gfp_chec = -1;
|
||||
static int hf_gfp_chec_good = -1;
|
||||
static int hf_gfp_chec_bad = -1;
|
||||
static int hf_gfp_chec_status = -1;
|
||||
static int hf_gfp_type = -1;
|
||||
static int hf_gfp_pti = -1;
|
||||
static int hf_gfp_pfi = -1;
|
||||
|
@ -62,12 +61,10 @@ static int hf_gfp_exi = -1;
|
|||
static int hf_gfp_upi_data = -1;
|
||||
static int hf_gfp_upi_management = -1;
|
||||
static int hf_gfp_thec = -1;
|
||||
static int hf_gfp_thec_good = -1;
|
||||
static int hf_gfp_thec_bad = -1;
|
||||
static int hf_gfp_thec_status = -1;
|
||||
static int hf_gfp_cid = -1;
|
||||
static int hf_gfp_ehec = -1;
|
||||
static int hf_gfp_ehec_good = -1;
|
||||
static int hf_gfp_ehec_bad = -1;
|
||||
static int hf_gfp_ehec_status = -1;
|
||||
static int hf_gfp_fcs = -1;
|
||||
static int hf_gfp_fcs_good = -1;
|
||||
static int hf_gfp_fcs_bad = -1;
|
||||
|
@ -93,10 +90,7 @@ static expert_field ei_gfp_fcs_bad = EI_INIT;
|
|||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_gfp = -1;
|
||||
static gint ett_gfp_chec = -1;
|
||||
static gint ett_gfp_type = -1;
|
||||
static gint ett_gfp_thec = -1;
|
||||
static gint ett_gfp_ehec = -1;
|
||||
static gint ett_gfp_fcs = -1;
|
||||
|
||||
static dissector_table_t gfp_dissector_table;
|
||||
|
@ -205,34 +199,15 @@ static gpointer gfp_value(packet_info *pinfo)
|
|||
/* GFP has several identical 16 bit CRCs in its header (HECs). Note that
|
||||
* this function increases the offset. */
|
||||
static void
|
||||
gfp_add_hec_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, const guint len, const int field, const int field_good, const int field_bad, const gint ett, expert_field *ei_bad)
|
||||
gfp_add_hec_tree(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint *offset, const guint len, const int field, const int field_status, expert_field *ei_bad)
|
||||
{
|
||||
|
||||
proto_item* ti = NULL;
|
||||
proto_tree* hec_tree = NULL;
|
||||
guint hec, hec_calc;
|
||||
guint hec_calc;
|
||||
|
||||
hec_calc = crc16_r3_ccitt_tvb(tvb, *offset, len);
|
||||
*offset += len;
|
||||
hec = tvb_get_ntohs(tvb, *offset);
|
||||
|
||||
if ( hec == hec_calc ) {
|
||||
ti = proto_tree_add_uint_format_value(tree, field, tvb, *offset, 2, hec, "0x%04x [correct]", hec);
|
||||
hec_tree = proto_item_add_subtree(ti, ett);
|
||||
ti = proto_tree_add_boolean(hec_tree, field_good, tvb, *offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
ti = proto_tree_add_boolean(hec_tree, field_bad, tvb, *offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
} else {
|
||||
ti = proto_tree_add_uint_format_value(tree, field, tvb, *offset, 2, hec, "0x%04x [incorrect, should be 0x%04x]", hec, hec_calc);
|
||||
hec_tree = proto_item_add_subtree(ti, ett);
|
||||
ti = proto_tree_add_boolean(hec_tree, field_good, tvb, *offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
ti = proto_tree_add_boolean(hec_tree, field_bad, tvb, *offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(ti);
|
||||
expert_add_info(pinfo, ti, ei_bad);
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(tree, tvb, *offset, field, field_status, ei_bad, pinfo, hec_calc, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
*offset += 2;
|
||||
}
|
||||
|
||||
|
@ -283,7 +258,7 @@ dissect_gfp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t
|
|||
}
|
||||
|
||||
/* G.7041 6.1.2.1.2 Type HEC (tHEC) - mandatory 2 bytes */
|
||||
gfp_add_hec_tree(tvb, pinfo, gfp_tree, offset, 2, hf_gfp_thec, hf_gfp_thec_good, hf_gfp_thec_bad, ett_gfp_thec, &ei_gfp_thec_bad);
|
||||
gfp_add_hec_tree(tvb, pinfo, gfp_tree, offset, 2, hf_gfp_thec, hf_gfp_thec_status, &ei_gfp_thec_bad);
|
||||
|
||||
switch (exi) {
|
||||
case GFP_EXT_NULL:
|
||||
|
@ -303,7 +278,7 @@ dissect_gfp_payload(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_t
|
|||
/* Next byte spare field, reserved */
|
||||
|
||||
/* 6.1.2.1.4 Extension HEC field */
|
||||
gfp_add_hec_tree(tvb, pinfo, gfp_tree, offset, 2, hf_gfp_ehec, hf_gfp_ehec_good, hf_gfp_ehec_bad, ett_gfp_ehec, &ei_gfp_ehec_bad);
|
||||
gfp_add_hec_tree(tvb, pinfo, gfp_tree, offset, 2, hf_gfp_ehec, hf_gfp_ehec_status, &ei_gfp_ehec_bad);
|
||||
break;
|
||||
case GFP_EXT_RING:
|
||||
/* 6.1.2.1.3.3 Extension header for a ring frame */
|
||||
|
@ -429,7 +404,7 @@ dissect_gfp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
col_set_str(pinfo->cinfo, COL_INFO, rval_to_str_const(pli, gfp_pli_rvals, "Unknown"));
|
||||
|
||||
/* 6.1.1.2 Core HEC field */
|
||||
gfp_add_hec_tree(tvb, pinfo, gfp_tree, &offset, len, hf_gfp_chec, hf_gfp_chec_good, hf_gfp_chec_bad, ett_gfp_chec, &ei_gfp_chec_bad);
|
||||
gfp_add_hec_tree(tvb, pinfo, gfp_tree, &offset, len, hf_gfp_chec, hf_gfp_chec_status, &ei_gfp_chec_bad);
|
||||
|
||||
if (pli == 0) { /* 6.2.1 GFP idle frames */
|
||||
if (tvb_reported_length_remaining(tvb, offset)) {
|
||||
|
@ -465,13 +440,9 @@ proto_register_gfp(void)
|
|||
{ "Core HEC", "gfp.chec", FT_UINT16, BASE_HEX,
|
||||
NULL, 0x0, NULL, HFILL }
|
||||
},
|
||||
{ &hf_gfp_chec_good,
|
||||
{ "Good cHEC", "gfp.chec_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: cHEC matches core header; False: doesn't match", HFILL }
|
||||
},
|
||||
{ &hf_gfp_chec_bad,
|
||||
{ "Bad cHEC", "gfp.chec_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: cHEC doesn't match core header; False: matches", HFILL }
|
||||
{ &hf_gfp_chec_status,
|
||||
{ "cHEC Status", "gfp.chec.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_gfp_type,
|
||||
{ "Type Field", "gfp.type", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
|
@ -503,13 +474,9 @@ proto_register_gfp(void)
|
|||
{ "Type HEC", "gfp.thec", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_gfp_thec_good,
|
||||
{ "Good tHEC", "gfp.thec_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: tHEC matches type header; False: doesn't match", HFILL }
|
||||
},
|
||||
{ &hf_gfp_thec_bad,
|
||||
{ "Bad tHEC", "gfp.thec_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: tHEC doesn't match type header; False: matches", HFILL }
|
||||
{ &hf_gfp_thec_status,
|
||||
{ "tHEC Status", "gfp.thec.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_gfp_cid,
|
||||
{ "Channel ID", "gfp.cid", FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
|
@ -519,13 +486,9 @@ proto_register_gfp(void)
|
|||
{ "Extension HEC", "gfp.ehec", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_gfp_ehec_good,
|
||||
{ "Good eHEC", "gfp.ehec_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: eHEC matches extension header; False: doesn't match", HFILL }
|
||||
},
|
||||
{ &hf_gfp_ehec_bad,
|
||||
{ "Bad eHEC", "gfp.ehec_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: eHEC doesn't match extension header; False: matches", HFILL }
|
||||
{ &hf_gfp_ehec_status,
|
||||
{ "eHEC Status", "gfp.ehec.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_gfp_fcs,
|
||||
{ "Payload FCS", "gfp.fcs", FT_UINT32, BASE_HEX, NULL, 0x0,
|
||||
|
@ -544,10 +507,7 @@ proto_register_gfp(void)
|
|||
/* Setup protocol subtree array */
|
||||
static gint *ett[] = {
|
||||
&ett_gfp,
|
||||
&ett_gfp_chec,
|
||||
&ett_gfp_type,
|
||||
&ett_gfp_thec,
|
||||
&ett_gfp_ehec,
|
||||
&ett_gfp_fcs
|
||||
};
|
||||
|
||||
|
|
|
@ -410,29 +410,21 @@ dissect_gre(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
|
||||
if (flags_and_ver & GRE_CHECKSUM || flags_and_ver & GRE_ROUTING) {
|
||||
guint length, reported_length;
|
||||
proto_item *it_checksum;
|
||||
vec_t cksum_vec[1];
|
||||
guint16 cksum, computed_cksum;
|
||||
|
||||
it_checksum = proto_tree_add_item(gre_tree, hf_gre_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
/* Checksum check !... */
|
||||
cksum = tvb_get_ntohs(tvb, offset);
|
||||
length = tvb_captured_length(tvb);
|
||||
reported_length = tvb_reported_length(tvb);
|
||||
/* The Checksum Present bit is set, and the packet isn't part of a
|
||||
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);
|
||||
computed_cksum = in_cksum(cksum_vec, 1);
|
||||
if (computed_cksum == 0) {
|
||||
proto_item_append_text(it_checksum," [correct]");
|
||||
} else {
|
||||
proto_item_append_text(it_checksum," [incorrect, should be 0x%04x]",in_cksum_shouldbe(cksum, computed_cksum));
|
||||
expert_add_info(pinfo, it_checksum, &ei_gre_checksum_incorrect);
|
||||
}
|
||||
proto_tree_add_checksum(gre_tree, tvb, offset, hf_gre_checksum, -1, &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,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(gre_tree, hf_gre_offset, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -95,7 +95,7 @@ static int hf_h223_al2_sequenced = -1;
|
|||
static int hf_h223_al2_unsequenced = -1;
|
||||
static int hf_h223_al2_seqno = -1;
|
||||
static int hf_h223_al2_crc = -1;
|
||||
static int hf_h223_al2_crc_bad = -1;
|
||||
static int hf_h223_al2_crc_status = -1;
|
||||
|
||||
static int hf_h223_al_payload = -1;
|
||||
|
||||
|
@ -697,15 +697,9 @@ 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);
|
||||
|
||||
if( calc_checksum == real_checksum ) {
|
||||
proto_tree_add_uint_format_value(al_tree, hf_h223_al2_crc, tvb, len - 1, 1, real_checksum,
|
||||
"0x%02x (correct)", real_checksum );
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(al_tree, hf_h223_al2_crc, tvb, len - 1, 1, real_checksum,
|
||||
"0x%02x (incorrect, should be 0x%02x)", real_checksum, calc_checksum );
|
||||
tmp_item = proto_tree_add_boolean( al_tree, hf_h223_al2_crc_bad, tvb, len - 1, 1, TRUE );
|
||||
PROTO_ITEM_SET_GENERATED(tmp_item);
|
||||
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);
|
||||
|
||||
if( calc_checksum != real_checksum ) {
|
||||
/* don't pass pdus which fail checksums on to the subdissector */
|
||||
subdissector = data_handle;
|
||||
}
|
||||
|
@ -1610,8 +1604,8 @@ void proto_register_h223 (void)
|
|||
{ "CRC", "h223.al2.crc", FT_UINT8, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_h223_al2_crc_bad,
|
||||
{ "Bad CRC","h223.al2.crc_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
{ &hf_h223_al2_crc_status,
|
||||
{ "CRC Status","h223.al2.crc.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_h223_al_payload,
|
||||
|
|
|
@ -788,7 +788,7 @@ dissect_pass_through(proto_tree *body_tree, tvbuff_t *tvb, gint offset,
|
|||
length = 1;
|
||||
}
|
||||
if (length > 0) {
|
||||
proto_tree_add_item(body_tree, hf_hartip_pt_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(body_tree, tvb, offset, hf_hartip_pt_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
return bodylen;
|
||||
|
|
|
@ -421,7 +421,7 @@ dissect_hip_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
proto_tree *hip_tree, *hip_tlv_tree=NULL;
|
||||
proto_item *ti, *ti_tlv;
|
||||
int length, offset = 0, newoffset = 0;
|
||||
guint16 control_h, checksum_h, computed_checksum;
|
||||
guint16 control_h, checksum_h;
|
||||
guint16 tlv_type_h, tlv_length_h; /* For storing in host order */
|
||||
guint len;
|
||||
guint reported_len;
|
||||
|
@ -510,32 +510,16 @@ 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);
|
||||
computed_checksum = in_cksum(cksum_vec, 4);
|
||||
if (computed_checksum == 0) {
|
||||
proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
|
||||
offset+4, 2, checksum_h,
|
||||
"0x%04x (correct)",
|
||||
checksum_h);
|
||||
if (checksum_h == 0 && udp) {
|
||||
proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, -1, NULL, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
} else {
|
||||
if (checksum_h == 0 && udp) {
|
||||
proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
|
||||
offset+4, 2, checksum_h,
|
||||
"0x%04x (correct)",
|
||||
checksum_h);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
|
||||
offset+4, 2, checksum_h,
|
||||
"0x%04x (incorrect, should be 0x%04x)",
|
||||
checksum_h,
|
||||
in_cksum_shouldbe(checksum_h,
|
||||
computed_checksum));
|
||||
}
|
||||
proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, -1, NULL, pinfo, in_cksum(cksum_vec, 4),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
}
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(hip_tree, hf_hip_checksum, tvb,
|
||||
offset+4, 2, checksum_h,
|
||||
"0x%04x (unverified)",
|
||||
checksum_h);
|
||||
proto_tree_add_checksum(hip_tree, tvb, offset+4, hf_hip_checksum, -1, NULL, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
ti = proto_tree_add_item(hip_tree, hf_hip_controls, tvb, offset+6, 2, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -3674,19 +3674,19 @@ proto_register_homeplug_av(void)
|
|||
},
|
||||
{ &hf_homeplug_av_st_mac_req_img_load,
|
||||
{ "Image Load Starting Address", "homeplug_av.st_mac_req.img_load",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, "Unknown", HFILL }
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
|
||||
},
|
||||
{ &hf_homeplug_av_st_mac_req_img_len,
|
||||
{ "Image Length", "homeplug_av.st_mac_req.img_len",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, "Unknown", HFILL }
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
|
||||
},
|
||||
{ &hf_homeplug_av_st_mac_req_img_chksum,
|
||||
{ "Image Checksum", "homeplug_av.st_mac_req.img_chksum",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, "Unknown", HFILL }
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
|
||||
},
|
||||
{ &hf_homeplug_av_st_mac_req_img_start,
|
||||
{ "Image Starting Address", "homeplug_av.st_mac_req.img_start",
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, "Unknown", HFILL }
|
||||
FT_UINT32, BASE_HEX, NULL, 0x00, NULL, HFILL }
|
||||
},
|
||||
/* Start MAC Confirmation */
|
||||
{ &hf_homeplug_av_st_mac_cnf,
|
||||
|
|
|
@ -80,7 +80,7 @@ int proto_icmp = -1;
|
|||
static int hf_icmp_type = -1;
|
||||
static int hf_icmp_code = -1;
|
||||
static int hf_icmp_checksum = -1;
|
||||
static int hf_icmp_checksum_bad = -1;
|
||||
static int hf_icmp_checksum_status = -1;
|
||||
static int hf_icmp_unused = -1;
|
||||
static int hf_icmp_reserved = -1;
|
||||
static int hf_icmp_ident = -1;
|
||||
|
@ -129,7 +129,7 @@ static int hf_icmp_ext = -1;
|
|||
static int hf_icmp_ext_version = -1;
|
||||
static int hf_icmp_ext_reserved = -1;
|
||||
static int hf_icmp_ext_checksum = -1;
|
||||
static int hf_icmp_ext_checksum_bad = -1;
|
||||
static int hf_icmp_ext_checksum_status = -1;
|
||||
static int hf_icmp_ext_length = -1;
|
||||
static int hf_icmp_ext_class = -1;
|
||||
static int hf_icmp_ext_c_type = -1;
|
||||
|
@ -760,9 +760,8 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree)
|
|||
guint8 version;
|
||||
guint8 class_num;
|
||||
guint8 c_type;
|
||||
guint16 cksum, computed_cksum;
|
||||
guint16 obj_length, obj_trunc_length;
|
||||
proto_item *ti, *tf_object, *hidden_item;
|
||||
proto_item *ti, *tf_object;
|
||||
proto_tree *ext_tree, *ext_object_tree;
|
||||
gint obj_end_offset;
|
||||
guint reported_length;
|
||||
|
@ -798,31 +797,8 @@ dissect_extensions(tvbuff_t * tvb, gint offset, proto_tree * tree)
|
|||
tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
|
||||
/* Checksum */
|
||||
cksum = tvb_get_ntohs(tvb, offset + 2);
|
||||
|
||||
computed_cksum = ip_checksum_tvb(tvb, offset, reported_length);
|
||||
|
||||
if (computed_cksum == 0) {
|
||||
proto_tree_add_uint_format_value(ext_tree, hf_icmp_ext_checksum,
|
||||
tvb, offset + 2, 2, cksum,
|
||||
"0x%04x [correct]",
|
||||
cksum);
|
||||
hidden_item =
|
||||
proto_tree_add_boolean(ext_tree,
|
||||
hf_icmp_ext_checksum_bad, tvb,
|
||||
offset + 2, 2, FALSE);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(ext_tree, hf_icmp_ext_checksum,
|
||||
tvb, offset + 2, 2, cksum,
|
||||
"0x%04x [incorrect, should be 0x%04x]",
|
||||
cksum, in_cksum_shouldbe(cksum,
|
||||
computed_cksum));
|
||||
hidden_item =
|
||||
proto_tree_add_boolean(ext_tree,
|
||||
hf_icmp_ext_checksum_bad, tvb,
|
||||
offset + 2, 2, TRUE);
|
||||
}
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
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);
|
||||
|
||||
if (version != 1 && version != 2) {
|
||||
/* Unsupported version */
|
||||
|
@ -1194,14 +1170,12 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
|
|||
guint8 icmp_code;
|
||||
guint8 icmp_original_dgram_length;
|
||||
guint captured_length, reported_length;
|
||||
guint16 cksum, computed_cksum;
|
||||
const gchar *type_str, *code_str;
|
||||
guint32 num_addrs = 0;
|
||||
guint32 addr_entry_size = 0;
|
||||
guint32 i;
|
||||
gboolean save_in_error_pkt;
|
||||
tvbuff_t *next_tvb;
|
||||
proto_item *item;
|
||||
guint32 conv_key[2];
|
||||
icmp_transaction_t *trans = NULL;
|
||||
nstime_t ts, time_relative;
|
||||
|
@ -1213,7 +1187,6 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
|
|||
/* To do: check for runts, errs, etc. */
|
||||
icmp_type = tvb_get_guint8(tvb, 0);
|
||||
icmp_code = tvb_get_guint8(tvb, 1);
|
||||
cksum = tvb_get_ntohs(tvb, 2);
|
||||
/*length of original datagram carried in the ICMP payload. In terms of 32 bit
|
||||
* words.*/
|
||||
icmp_original_dgram_length = tvb_get_guint8(tvb, 5);
|
||||
|
@ -1291,27 +1264,16 @@ dissect_icmp(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void* data)
|
|||
proto_item_append_text(ti, " (%s)", code_str);
|
||||
}
|
||||
|
||||
checksum_item = proto_tree_add_item(icmp_tree, hf_icmp_checksum, tvb, 2, 2, ENC_BIG_ENDIAN);
|
||||
|
||||
if (!pinfo->fragmented && captured_length >= reported_length
|
||||
&& !pinfo->flags.in_error_pkt) {
|
||||
/* The packet isn't part of a fragmented datagram, isn't
|
||||
truncated, and isn't the payload of an error packet, so we can checksum
|
||||
it. */
|
||||
|
||||
computed_cksum = ip_checksum_tvb(tvb, 0, reported_length);
|
||||
if (computed_cksum == 0) {
|
||||
item = proto_tree_add_boolean(icmp_tree, hf_icmp_checksum_bad, tvb, 2, 2, FALSE);
|
||||
PROTO_ITEM_SET_HIDDEN(item);
|
||||
proto_item_append_text(checksum_item, " [correct]");
|
||||
} else {
|
||||
item = proto_tree_add_boolean(icmp_tree, hf_icmp_checksum_bad, tvb, 2, 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(item);
|
||||
proto_item_append_text(checksum_item, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum));
|
||||
expert_add_info_format(pinfo, checksum_item, &ei_icmp_checksum,
|
||||
"ICMPv4 Checksum Incorrect, should be 0x%04x", in_cksum_shouldbe(cksum, computed_cksum));
|
||||
}
|
||||
proto_tree_add_checksum(icmp_tree, tvb, 2, hf_icmp_checksum, hf_icmp_checksum_status, &ei_icmp_checksum, pinfo, ip_checksum_tvb(tvb, 0, reported_length),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
} else {
|
||||
checksum_item = proto_tree_add_checksum(icmp_tree, tvb, 2, hf_icmp_checksum, hf_icmp_checksum_status, &ei_icmp_checksum, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_item_append_text(checksum_item, " [%s]",
|
||||
pinfo->flags.in_error_pkt ? "in ICMP error packet" : "fragmented datagram");
|
||||
}
|
||||
|
@ -1631,9 +1593,9 @@ void proto_register_icmp(void)
|
|||
0x0,
|
||||
NULL, HFILL}},
|
||||
|
||||
{&hf_icmp_checksum_bad,
|
||||
{"Bad Checksum", "icmp.checksum_bad", FT_BOOLEAN,
|
||||
BASE_NONE, NULL, 0x0,
|
||||
{&hf_icmp_checksum_status,
|
||||
{"Checksum Status", "icmp.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL}},
|
||||
|
||||
{&hf_icmp_unused,
|
||||
|
@ -1844,9 +1806,9 @@ void proto_register_icmp(void)
|
|||
NULL, 0x0,
|
||||
NULL, HFILL}},
|
||||
|
||||
{&hf_icmp_ext_checksum_bad,
|
||||
{"Bad Checksum", "icmp.ext.checksum_bad", FT_BOOLEAN,
|
||||
BASE_NONE, NULL,
|
||||
{&hf_icmp_ext_checksum_status,
|
||||
{"Checksum Status", "icmp.ext.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals),
|
||||
0x0,
|
||||
NULL, HFILL}},
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ static int proto_icmpv6 = -1;
|
|||
static int hf_icmpv6_type = -1;
|
||||
static int hf_icmpv6_code = -1;
|
||||
static int hf_icmpv6_checksum = -1;
|
||||
static int hf_icmpv6_checksum_bad = -1;
|
||||
static int hf_icmpv6_checksum_status = -1;
|
||||
static int hf_icmpv6_reserved = -1;
|
||||
static int hf_icmpv6_data = -1;
|
||||
static int hf_icmpv6_unknown_data = -1;
|
||||
|
@ -3470,12 +3470,12 @@ static int
|
|||
dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
||||
{
|
||||
proto_tree *icmp6_tree = NULL, *flag_tree = NULL;
|
||||
proto_item *ti = NULL, *hidden_item, *checksum_item = NULL, *code_item = NULL, *ti_flag = NULL;
|
||||
proto_item *ti = NULL, *checksum_item = NULL, *code_item = NULL, *ti_flag = NULL;
|
||||
const char *code_name = NULL;
|
||||
guint length = 0, reported_length;
|
||||
vec_t cksum_vec[4];
|
||||
guint32 phdr[2];
|
||||
guint16 cksum, computed_cksum;
|
||||
guint16 cksum;
|
||||
int offset;
|
||||
tvbuff_t *next_tvb;
|
||||
guint8 icmp6_type, icmp6_code;
|
||||
|
@ -3540,46 +3540,32 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
|||
col_set_str(pinfo->cinfo, COL_INFO, "Direct IPv6 Connectivity Test");
|
||||
}
|
||||
|
||||
if (tree) {
|
||||
if (code_name)
|
||||
proto_item_append_text(code_item, " (%s)", code_name);
|
||||
checksum_item = proto_tree_add_item(icmp6_tree, hf_icmpv6_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
}
|
||||
if (code_name)
|
||||
proto_item_append_text(code_item, " (%s)", code_name);
|
||||
|
||||
cksum = tvb_get_ntohs(tvb, offset);
|
||||
length = tvb_captured_length(tvb);
|
||||
reported_length = tvb_reported_length(tvb);
|
||||
if (!pinfo->fragmented && length >= reported_length && !pinfo->flags.in_error_pkt) {
|
||||
/* The packet isn't part of a fragmented datagram, isn't truncated,
|
||||
* and we aren't in an ICMP error packet, so we can checksum it.
|
||||
*/
|
||||
|
||||
if (1) { /* There's an expert info in here so always execute */
|
||||
length = tvb_captured_length(tvb);
|
||||
reported_length = tvb_reported_length(tvb);
|
||||
if (!pinfo->fragmented && length >= reported_length && !pinfo->flags.in_error_pkt) {
|
||||
/* The packet isn't part of a fragmented datagram, isn't truncated,
|
||||
* and we aren't in an ICMP error packet, so we can checksum it.
|
||||
*/
|
||||
/* Set up the fields of the pseudo-header. */
|
||||
SET_CKSUM_VEC_PTR(cksum_vec[0], (const guint8 *)pinfo->src.data, pinfo->src.len);
|
||||
SET_CKSUM_VEC_PTR(cksum_vec[1], (const guint8 *)pinfo->dst.data, pinfo->dst.len);
|
||||
phdr[0] = g_htonl(reported_length);
|
||||
phdr[1] = g_htonl(IP_PROTO_ICMPV6);
|
||||
SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 8);
|
||||
SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, reported_length);
|
||||
|
||||
/* Set up the fields of the pseudo-header. */
|
||||
SET_CKSUM_VEC_PTR(cksum_vec[0], (const guint8 *)pinfo->src.data, pinfo->src.len);
|
||||
SET_CKSUM_VEC_PTR(cksum_vec[1], (const guint8 *)pinfo->dst.data, pinfo->dst.len);
|
||||
phdr[0] = g_htonl(reported_length);
|
||||
phdr[1] = g_htonl(IP_PROTO_ICMPV6);
|
||||
SET_CKSUM_VEC_PTR(cksum_vec[2], (const guint8 *)&phdr, 8);
|
||||
SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, reported_length);
|
||||
computed_cksum = in_cksum(cksum_vec, 4);
|
||||
|
||||
if (computed_cksum == 0) {
|
||||
hidden_item = proto_tree_add_boolean(icmp6_tree, hf_icmpv6_checksum_bad, tvb, offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_item_append_text(checksum_item, " [correct]");
|
||||
} else {
|
||||
hidden_item = proto_tree_add_boolean(icmp6_tree, hf_icmpv6_checksum_bad, tvb, offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_item_append_text(checksum_item, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(cksum, computed_cksum));
|
||||
expert_add_info_format(pinfo, checksum_item, &ei_icmpv6_checksum,
|
||||
"ICMPv6 Checksum Incorrect, should be 0x%04x", in_cksum_shouldbe(cksum, computed_cksum));
|
||||
}
|
||||
} else {
|
||||
proto_item_append_text(checksum_item, " [%s]",
|
||||
pinfo->flags.in_error_pkt ? "in ICMP error packet" : "fragmented datagram");
|
||||
}
|
||||
proto_tree_add_checksum(icmp6_tree, tvb, 2, hf_icmpv6_checksum, hf_icmpv6_checksum_status, &ei_icmpv6_checksum, pinfo, in_cksum(cksum_vec, 4),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
} else {
|
||||
checksum_item = proto_tree_add_checksum(icmp6_tree, tvb, 2, hf_icmpv6_checksum, hf_icmpv6_checksum_status, &ei_icmpv6_checksum, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_item_append_text(checksum_item, " [%s]",
|
||||
pinfo->flags.in_error_pkt ? "in ICMP error packet" : "fragmented datagram");
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
|
@ -3612,8 +3598,7 @@ dissect_icmpv6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
|
|||
* Shouldn't the nonce be at least 8 then? Why not just use (-1),
|
||||
* as it could really be any length, couldn't it?
|
||||
*/
|
||||
if (tree)
|
||||
proto_tree_add_item(icmp6_tree, hf_icmpv6_nonce, tvb, offset, 4, ENC_NA);
|
||||
proto_tree_add_item(icmp6_tree, hf_icmpv6_nonce, tvb, offset, 4, ENC_NA);
|
||||
offset += 4;
|
||||
} else {
|
||||
if (!pinfo->flags.in_error_pkt) {
|
||||
|
@ -4158,8 +4143,8 @@ proto_register_icmpv6(void)
|
|||
{ &hf_icmpv6_checksum,
|
||||
{ "Checksum", "icmpv6.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
"Used to detect data corruption in the ICMPv6 message and parts of the IPv6 header", HFILL }},
|
||||
{ &hf_icmpv6_checksum_bad,
|
||||
{ "Bad Checksum", "icmpv6.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
{ &hf_icmpv6_checksum_status,
|
||||
{ "Checksum Status", "icmpv6.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_icmpv6_reserved,
|
||||
{ "Reserved", "icmpv6.reserved", FT_BYTES, BASE_NONE, NULL, 0x0,
|
||||
|
|
|
@ -88,7 +88,7 @@ dissect_idp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
ti = proto_tree_add_item(tree, proto_idp, tvb, 0, IDP_HEADER_LEN, ENC_NA);
|
||||
idp_tree = proto_item_add_subtree(ti, ett_idp);
|
||||
|
||||
proto_tree_add_item(idp_tree, hf_idp_checksum, tvb, 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(idp_tree, tvb, 0, hf_idp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
length = tvb_get_ntohs(tvb, 2);
|
||||
proto_tree_add_uint_format_value(idp_tree, hf_idp_len, tvb, 2, 2, length,
|
||||
"%u bytes", length);
|
||||
|
|
|
@ -2978,8 +2978,7 @@ static int hf_ieee80211_seq_number = -1;
|
|||
/* Header values for Frame Check field */
|
||||
/* ************************************************************************* */
|
||||
static int hf_ieee80211_fcs = -1;
|
||||
static int hf_ieee80211_fcs_good = -1;
|
||||
static int hf_ieee80211_fcs_bad = -1;
|
||||
static int hf_ieee80211_fcs_status = -1;
|
||||
|
||||
/* ************************************************************************* */
|
||||
/* Header values for reassembly */
|
||||
|
@ -16429,14 +16428,12 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
|
|||
guint32 seq_number, frag_number;
|
||||
gboolean more_frags;
|
||||
proto_item *ti = NULL;
|
||||
proto_item *fcs_item = NULL;
|
||||
proto_item *cw_item = NULL;
|
||||
proto_item *hidden_item;
|
||||
proto_tree *fcs_tree = NULL;
|
||||
proto_tree *cw_tree = NULL;
|
||||
guint16 hdr_len, ohdr_len;
|
||||
guint16 htc_len = 0;
|
||||
gboolean has_fcs, fcs_good, fcs_bad;
|
||||
gboolean has_fcs;
|
||||
gint len, reported_len, ivlen;
|
||||
gint sta_addr_offset = 0;
|
||||
const gchar *station_name;
|
||||
|
@ -17527,7 +17524,7 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
|
|||
*/
|
||||
len -= 4;
|
||||
reported_len -= 4;
|
||||
if (tree)
|
||||
if (wlan_check_checksum)
|
||||
{
|
||||
guint32 sent_fcs = tvb_get_ntohl(tvb, hdr_len + len);
|
||||
guint32 fcs;
|
||||
|
@ -17536,40 +17533,13 @@ dissect_ieee80211_common(tvbuff_t *tvb, packet_info *pinfo,
|
|||
fcs = crc32_802_tvb_padded(tvb, ohdr_len, hdr_len, len);
|
||||
else
|
||||
fcs = crc32_802_tvb(tvb, hdr_len + len);
|
||||
if (fcs == sent_fcs) {
|
||||
fcs_good = TRUE;
|
||||
fcs_bad = FALSE;
|
||||
} else {
|
||||
fcs_good = FALSE;
|
||||
fcs_bad = TRUE;
|
||||
}
|
||||
|
||||
fcs_item = proto_tree_add_item(hdr_tree, hf_ieee80211_fcs, tvb,
|
||||
hdr_len + len, 4, ENC_LITTLE_ENDIAN);
|
||||
if (fcs_good) {
|
||||
proto_item_append_text(fcs_item, " [correct]");
|
||||
} else {
|
||||
proto_item_append_text(fcs_item, " [incorrect, should be 0x%08x]", fcs);
|
||||
if (fcs != sent_fcs) {
|
||||
flag_str[8] = '.';
|
||||
}
|
||||
|
||||
proto_tree_set_appendix(hdr_tree, tvb, hdr_len + len, 4);
|
||||
|
||||
if(wlan_check_checksum) {
|
||||
fcs_tree = proto_item_add_subtree(fcs_item, ett_fcs);
|
||||
|
||||
fcs_item = proto_tree_add_boolean(fcs_tree,
|
||||
hf_ieee80211_fcs_good, tvb,
|
||||
hdr_len + len, 4,
|
||||
fcs_good);
|
||||
PROTO_ITEM_SET_GENERATED(fcs_item);
|
||||
|
||||
fcs_item = proto_tree_add_boolean(fcs_tree,
|
||||
hf_ieee80211_fcs_bad, tvb,
|
||||
hdr_len + len, 4,
|
||||
fcs_bad);
|
||||
PROTO_ITEM_SET_GENERATED(fcs_item);
|
||||
}
|
||||
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);
|
||||
} 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19154,15 +19124,10 @@ proto_register_ieee80211(void)
|
|||
FT_UINT32, BASE_HEX, NULL, 0,
|
||||
"Frame Check Sequence (FCS)", HFILL }},
|
||||
|
||||
{&hf_ieee80211_fcs_good,
|
||||
{"Good", "wlan.fcs_good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True if the FCS is correct", HFILL }},
|
||||
|
||||
{&hf_ieee80211_fcs_bad,
|
||||
{"Bad", "wlan.fcs_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True if the FCS is incorrect", HFILL }},
|
||||
{&hf_ieee80211_fcs_status,
|
||||
{"FCS Status", "wlan.fcs.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{&hf_ieee80211_fragment_overlap,
|
||||
{"Fragment overlap", "wlan.fragment.overlap",
|
||||
|
|
|
@ -52,7 +52,7 @@ static int proto_igap = -1;
|
|||
static int hf_type = -1;
|
||||
static int hf_max_resp = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
static int hf_maddr = -1;
|
||||
static int hf_version = -1;
|
||||
static int hf_subtype = -1;
|
||||
|
@ -157,7 +157,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_bad, pinfo, 0);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
|
@ -256,9 +256,9 @@ proto_register_igap(void)
|
|||
FT_UINT16, BASE_HEX, NULL, 0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad Checksum", "igap.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "igap.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_maddr,
|
||||
|
|
|
@ -127,7 +127,7 @@ static int hf_group_type = -1;
|
|||
static int hf_reply_code = -1;
|
||||
static int hf_reply_pending = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
static int hf_identifier = -1;
|
||||
static int hf_access_key = -1;
|
||||
static int hf_max_resp = -1;
|
||||
|
@ -282,11 +282,9 @@ static const value_string mtrace_fwd_code_vals[] = {
|
|||
};
|
||||
|
||||
void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index,
|
||||
int hf_index_bad, packet_info *pinfo, guint len)
|
||||
int hf_index_status, packet_info *pinfo, guint len)
|
||||
{
|
||||
guint16 cksum, hdrcksum;
|
||||
vec_t cksum_vec[1];
|
||||
proto_item *hidden_item;
|
||||
|
||||
if (len == 0) {
|
||||
/*
|
||||
|
@ -295,29 +293,16 @@ void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index,
|
|||
len = tvb_reported_length(tvb);
|
||||
}
|
||||
|
||||
hdrcksum = tvb_get_ntohs(tvb, 2);
|
||||
if (!pinfo->fragmented && tvb_captured_length(tvb) >= len) {
|
||||
/*
|
||||
* 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, len);
|
||||
|
||||
cksum = in_cksum(&cksum_vec[0],1);
|
||||
|
||||
if (cksum == 0) {
|
||||
proto_tree_add_uint_format(tree, hf_index, tvb, 2, 2, hdrcksum,
|
||||
"Header checksum: 0x%04x [correct]", hdrcksum);
|
||||
} else {
|
||||
hidden_item = proto_tree_add_boolean(tree, hf_index_bad,
|
||||
tvb, 2, 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_uint_format(tree, hf_index, tvb, 2, 2, hdrcksum,
|
||||
"Header checksum: 0x%04x [incorrect, should be 0x%04x]",
|
||||
hdrcksum, in_cksum_shouldbe(hdrcksum,cksum));
|
||||
}
|
||||
proto_tree_add_checksum(tree, tvb, 2, hf_index, hf_index_status, NULL, pinfo, in_cksum(&cksum_vec[0], 1),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
} else
|
||||
proto_tree_add_uint(tree, hf_index, tvb, 2, 2, hdrcksum);
|
||||
proto_tree_add_checksum(tree, tvb, 2, hf_index, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -563,7 +548,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_bad, pinfo, 0);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(tree, hf_reserved, tvb, offset, 2, ENC_NA);
|
||||
|
@ -598,7 +583,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_bad, pinfo, 0);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* group address */
|
||||
|
@ -653,7 +638,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_bad, pinfo, 8);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 8);
|
||||
offset += 2;
|
||||
|
||||
/* group address */
|
||||
|
@ -695,7 +680,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_bad, pinfo, 8);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 8);
|
||||
offset += 2;
|
||||
|
||||
/* group address */
|
||||
|
@ -730,7 +715,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_bad, pinfo, 20);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 20);
|
||||
offset += 2;
|
||||
|
||||
/* identifier */
|
||||
|
@ -813,7 +798,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_bad, pinfo, 0);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* group address to be traced */
|
||||
|
@ -952,9 +937,9 @@ proto_register_igmp(void)
|
|||
{ "Checksum", "igmp.checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0, "IGMP Checksum", HFILL }},
|
||||
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad Checksum", "igmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "Bad IGMP Checksum", HFILL }},
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "igmp.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_identifier,
|
||||
{ "Identifier", "igmp.identifier", FT_UINT32, BASE_DEC,
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
#define IGMP_RGMP_HELLO 0xFF
|
||||
|
||||
void igmp_checksum(proto_tree *tree, tvbuff_t *tvb, int hf_index,
|
||||
int hf_index_bad, packet_info *pinfo, guint len);
|
||||
int hf_index_status, packet_info *pinfo, guint len);
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -147,7 +147,7 @@ static int dissect_igrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, voi
|
|||
offset+=IGRP_ENTRY_LENGTH;
|
||||
}
|
||||
|
||||
proto_tree_add_item(igrp_tree, hf_igrp_checksum, tvb, 10, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(igrp_tree, tvb, 10, hf_igrp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
return tvb_captured_length(tvb);
|
||||
}
|
||||
|
|
|
@ -124,8 +124,7 @@ static int hf_ip_ttl = -1;
|
|||
static int hf_ip_proto = -1;
|
||||
static int hf_ip_checksum = -1;
|
||||
static int hf_ip_checksum_calculated = -1;
|
||||
static int hf_ip_checksum_good = -1;
|
||||
static int hf_ip_checksum_bad = -1;
|
||||
static int hf_ip_checksum_status = -1;
|
||||
|
||||
/* IP option fields */
|
||||
static int hf_ip_opt_type = -1;
|
||||
|
@ -243,7 +242,6 @@ static gint ett_ip_option_qs = -1;
|
|||
static gint ett_ip_option_other = -1;
|
||||
static gint ett_ip_fragments = -1;
|
||||
static gint ett_ip_fragment = -1;
|
||||
static gint ett_ip_checksum = -1;
|
||||
static gint ett_ip_opt_type = -1;
|
||||
static gint ett_ip_opt_sec_prot_auth_flags = -1;
|
||||
static gint ett_unknown_ip_tcp_opt = -1;
|
||||
|
@ -1999,7 +1997,6 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
|
|||
guint hlen, optlen;
|
||||
guint16 flags;
|
||||
guint16 ipsum;
|
||||
guint16 expected_cksum;
|
||||
fragment_head *ipfd_head = NULL;
|
||||
tvbuff_t *next_tvb;
|
||||
gboolean update_col_info = TRUE;
|
||||
|
@ -2008,7 +2005,6 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
|
|||
guint32 src32, dst32;
|
||||
proto_tree *tree;
|
||||
proto_item *item = NULL, *ttl_item;
|
||||
proto_tree *checksum_tree;
|
||||
guint16 ttl;
|
||||
int bit_offset;
|
||||
tree = parent_tree;
|
||||
|
@ -2207,55 +2203,25 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
|
|||
*/
|
||||
if (ip_check_checksum && tvb_bytes_exist(tvb, offset, hlen)&&(!pinfo->flags.in_error_pkt)) {
|
||||
ipsum = ip_checksum_tvb(tvb, offset, hlen);
|
||||
if (tree) {
|
||||
if (ipsum == 0) {
|
||||
item = proto_tree_add_uint_format_value(ip_tree, hf_ip_checksum, tvb,
|
||||
offset + 10, 2, iph->ip_sum,
|
||||
"0x%04x [correct]",
|
||||
iph->ip_sum);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_ip_checksum);
|
||||
item = proto_tree_add_uint(checksum_tree, hf_ip_checksum_calculated, tvb,
|
||||
offset + 10, 2, iph->ip_sum);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_good, tvb,
|
||||
offset + 10, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_bad, tvb,
|
||||
offset + 10, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
expected_cksum = in_cksum_shouldbe(iph->ip_sum, ipsum);
|
||||
item = proto_tree_add_checksum(ip_tree, tvb, offset + 10, hf_ip_checksum, hf_ip_checksum_status, &ei_ip_checksum_bad, pinfo, ipsum,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
if (ipsum == 0) {
|
||||
/* XXX - Keeping hf_ip_checksum_calculated field for now. Doesn't fit into the
|
||||
proto_tree_add_checksum design, but IP is a popular enough dissector that somebody
|
||||
may have a legitimate reason for wanting it filtered */
|
||||
item = proto_tree_add_uint(ip_tree, hf_ip_checksum_calculated, tvb,
|
||||
offset + 10, 2, iph->ip_sum);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
proto_item_append_text(item, "(may be caused by \"IP checksum offload\"?)");
|
||||
|
||||
item = proto_tree_add_uint_format_value(ip_tree, hf_ip_checksum, tvb,
|
||||
offset + 10, 2, iph->ip_sum,
|
||||
"0x%04x "
|
||||
"[incorrect, should be 0x%04x "
|
||||
"(may be caused by \"IP checksum "
|
||||
"offload\"?)]", iph->ip_sum,
|
||||
expected_cksum);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_ip_checksum);
|
||||
item = proto_tree_add_uint(checksum_tree, hf_ip_checksum_calculated, tvb,
|
||||
offset + 10, 2, expected_cksum);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_good, tvb,
|
||||
offset + 10, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_bad, tvb,
|
||||
offset + 10, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
}
|
||||
if (ipsum != 0) {
|
||||
/* Add expert item always (so tap gets called if present);
|
||||
if (tree == NULL) then item will be NULL
|
||||
else item should be from the
|
||||
add_boolean(..., hf_ip_checksum_bad, ...) above */
|
||||
expert_add_info(pinfo, item, &ei_ip_checksum_bad);
|
||||
item = proto_tree_add_uint(ip_tree, hf_ip_checksum_calculated, tvb,
|
||||
offset + 10, 2, in_cksum_shouldbe(iph->ip_sum, ipsum));
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
} else {
|
||||
ipsum = 0;
|
||||
if (tree) {
|
||||
item = proto_tree_add_uint_format_value(ip_tree, hf_ip_checksum, tvb,
|
||||
proto_tree_add_uint_format_value(ip_tree, hf_ip_checksum, tvb,
|
||||
offset + 10, 2, iph->ip_sum,
|
||||
"0x%04x [%s]",
|
||||
iph->ip_sum,
|
||||
|
@ -2264,14 +2230,9 @@ dissect_ip_v4(tvbuff_t *tvb, packet_info *pinfo, proto_tree *parent_tree, void*
|
|||
"in ICMP error packet" :
|
||||
"not all data available") :
|
||||
"validation disabled");
|
||||
checksum_tree = proto_item_add_subtree(item, ett_ip_checksum);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_good, tvb,
|
||||
offset + 10, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_ip_checksum_bad, tvb,
|
||||
offset + 10, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
item = proto_tree_add_uint(ip_tree, hf_ip_checksum_status, tvb,
|
||||
offset + 10, 0, PROTO_CHECKSUM_E_UNVERIFIED);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
src32 = tvb_get_ntohl(tvb, offset + IPH_SRC);
|
||||
set_address_tvb(&pinfo->net_src, AT_IPv4, 4, tvb, offset + IPH_SRC);
|
||||
|
@ -2801,13 +2762,9 @@ proto_register_ip(void)
|
|||
{ "Calculated Checksum", "ip.checksum_calculated", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
"The expected IP checksum field as calculated from the IP datagram", HFILL }},
|
||||
|
||||
{ &hf_ip_checksum_good,
|
||||
{ "Good", "ip.checksum_good", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
|
||||
|
||||
{ &hf_ip_checksum_bad,
|
||||
{ "Bad", "ip.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content or not checked", HFILL }},
|
||||
{ &hf_ip_checksum_status,
|
||||
{ "Header checksum status", "ip.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
/* IP options related fields */
|
||||
{ &hf_ip_opt_type,
|
||||
|
@ -3080,7 +3037,6 @@ proto_register_ip(void)
|
|||
&ett_ip_option_other,
|
||||
&ett_ip_fragments,
|
||||
&ett_ip_fragment,
|
||||
&ett_ip_checksum,
|
||||
&ett_ip_opt_type,
|
||||
&ett_ip_opt_sec_prot_auth_flags,
|
||||
&ett_unknown_ip_tcp_opt,
|
||||
|
|
|
@ -1426,8 +1426,8 @@ dissect_opt_calipso(tvbuff_t *tvb, gint offset, packet_info *pinfo, proto_tree *
|
|||
offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item(opt_tree, hf_ipv6_opt_calipso_checksum, tvb,
|
||||
offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(opt_tree, tvb, offset, hf_ipv6_opt_calipso_checksum, -1,
|
||||
NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(opt_tree, hf_ipv6_opt_calipso_cmpt_bitmap, tvb,
|
||||
|
|
|
@ -345,7 +345,7 @@ dissect_ipx(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
hidden_item = proto_tree_add_string(ipx_tree, hf_ipx_addr, tvb, 0, 0, str);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
|
||||
proto_tree_add_item(ipx_tree, hf_ipx_checksum, tvb, 0, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(ipx_tree, tvb, 0, hf_ipx_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_tree_add_uint_format_value(ipx_tree, hf_ipx_len, tvb, 2, 2, ipxh->ipx_length,
|
||||
"%d bytes", ipxh->ipx_length);
|
||||
ipx_hops = tvb_get_guint8(tvb, 4);
|
||||
|
|
|
@ -765,29 +765,18 @@ dissect_hello_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
|
|||
* which is offseted 17 bytes in IIHs (relative to the beginning of the IS-IS packet) */
|
||||
pdu_length = tvb_get_ntohs(tvb, 17);
|
||||
|
||||
/* unlike the LSP checksum verification which starts at an offset of 12 we start at offset 0*/
|
||||
switch (check_and_get_checksum(tvb, 0, pdu_length, checksum, offset, &cacl_checksum))
|
||||
{
|
||||
case NO_CKSUM :
|
||||
proto_tree_add_uint_format_value( tree, hf_isis_hello_checksum, tvb, offset, length, checksum,
|
||||
"0x%04x [unused]", checksum);
|
||||
break;
|
||||
case DATA_MISSING :
|
||||
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);
|
||||
} 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);
|
||||
} 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_expert_format(tree, pinfo, &ei_isis_hello_long_packet, tvb, offset, -1,
|
||||
"Packet length %d went beyond packet", tvb_captured_length(tvb) );
|
||||
break;
|
||||
case CKSUM_NOT_OK :
|
||||
proto_tree_add_uint_format_value( tree, hf_isis_hello_checksum, tvb, offset, length, checksum,
|
||||
"0x%04x [incorrect, should be 0x%04x]",
|
||||
checksum,
|
||||
cacl_checksum);
|
||||
break;
|
||||
case CKSUM_OK :
|
||||
proto_tree_add_uint_format_value( tree, hf_isis_hello_checksum, tvb, offset, length, checksum,
|
||||
"0x%04x [correct]", checksum);
|
||||
break;
|
||||
default :
|
||||
g_message("'check_and_get_checksum' returned an invalid value");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -156,8 +156,7 @@ static int hf_isis_lsp_srlg_ipv4_local = -1;
|
|||
static int hf_isis_lsp_srlg_ipv4_remote = -1;
|
||||
static int hf_isis_lsp_srlg_value = -1;
|
||||
static int hf_isis_lsp_checksum = -1;
|
||||
static int hf_isis_lsp_checksum_bad = -1;
|
||||
static int hf_isis_lsp_checksum_good = -1;
|
||||
static int hf_isis_lsp_checksum_status = -1;
|
||||
static int hf_isis_lsp_clv_ipv4_int_addr = -1;
|
||||
static int hf_isis_lsp_clv_ipv6_int_addr = -1;
|
||||
static int hf_isis_lsp_clv_te_router_id = -1;
|
||||
|
@ -3105,25 +3104,6 @@ dissect_lsp_prefix_neighbors_clv(tvbuff_t *tvb, packet_info* pinfo, proto_tree *
|
|||
}
|
||||
}
|
||||
|
||||
static void isis_lsp_checkum_additional_info(tvbuff_t * tvb, packet_info * pinfo,
|
||||
proto_item * it_cksum, int offset, gboolean is_cksum_correct)
|
||||
{
|
||||
proto_tree * checksum_tree;
|
||||
proto_item * item;
|
||||
|
||||
checksum_tree = proto_item_add_subtree(it_cksum, ett_isis_lsp_cksum);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_isis_lsp_checksum_good, tvb,
|
||||
offset, 2, is_cksum_correct);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_isis_lsp_checksum_bad, tvb,
|
||||
offset, 2, !is_cksum_correct);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
if (!is_cksum_correct) {
|
||||
expert_add_info(pinfo, item, &ie_isis_lsp_checksum_bad);
|
||||
col_append_str(pinfo->cinfo, COL_INFO, " [ISIS CHECKSUM INCORRECT]");
|
||||
}
|
||||
}
|
||||
|
||||
static const isis_clv_handle_t clv_l1_lsp_opts[] = {
|
||||
{
|
||||
ISIS_CLV_AREA_ADDRESS,
|
||||
|
@ -3475,7 +3455,6 @@ dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
|
|||
guint16 pdu_length, lifetime, checksum, cacl_checksum=0;
|
||||
guint8 lsp_info;
|
||||
int len, offset_checksum;
|
||||
proto_item *it_cksum;
|
||||
char* system_id;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "ISIS LSP");
|
||||
|
@ -3511,28 +3490,23 @@ dissect_isis_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset
|
|||
offset += 4;
|
||||
|
||||
checksum = lifetime ? tvb_get_ntohs(tvb, offset) : 0;
|
||||
switch (check_and_get_checksum(tvb, offset_checksum, pdu_length-12, checksum, offset, &cacl_checksum)) {
|
||||
case NO_CKSUM :
|
||||
checksum = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint_format_value(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
|
||||
"0x%04x [unused]", checksum);
|
||||
break;
|
||||
case DATA_MISSING :
|
||||
if (checksum == 0) {
|
||||
/* No checksum present */
|
||||
proto_tree_add_checksum(lsp_tree, tvb, offset_checksum, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ie_isis_lsp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NOT_PRESENT);
|
||||
} else {
|
||||
if (osi_check_and_get_checksum(tvb, offset_checksum, pdu_length-12, offset, &cacl_checksum)) {
|
||||
/* Successfully processed checksum, verify it */
|
||||
proto_tree_add_checksum(lsp_tree, tvb, offset_checksum, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ie_isis_lsp_checksum_bad, pinfo, cacl_checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
if (cacl_checksum != checksum) {
|
||||
col_append_str(pinfo->cinfo, COL_INFO, " [ISIS CHECKSUM INCORRECT]");
|
||||
}
|
||||
|
||||
} else {
|
||||
proto_tree_add_checksum(lsp_tree, tvb, offset_checksum, hf_isis_lsp_checksum, hf_isis_lsp_checksum_status, &ie_isis_lsp_checksum_bad, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_tree_add_expert_format(tree, pinfo, &ei_isis_lsp_long_packet, tvb, offset, -1,
|
||||
"Packet length %d went beyond packet",
|
||||
tvb_reported_length_remaining(tvb, offset_checksum));
|
||||
break;
|
||||
case CKSUM_NOT_OK :
|
||||
it_cksum = proto_tree_add_uint_format_value(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
|
||||
"0x%04x [incorrect, should be 0x%04x]",
|
||||
checksum, cacl_checksum);
|
||||
isis_lsp_checkum_additional_info(tvb, pinfo, it_cksum, offset, FALSE);
|
||||
break;
|
||||
case CKSUM_OK :
|
||||
it_cksum = proto_tree_add_uint_format_value(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum,
|
||||
"0x%04x [correct]", checksum);
|
||||
isis_lsp_checkum_additional_info(tvb, pinfo, it_cksum, offset, TRUE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
|
@ -3675,16 +3649,10 @@ proto_register_isis_lsp(void)
|
|||
NULL, HFILL }
|
||||
},
|
||||
|
||||
{ &hf_isis_lsp_checksum_good,
|
||||
{ "Good Checksum", "isis.lsp.checksum_good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"Good IS-IS LSP Checksum", HFILL }
|
||||
},
|
||||
|
||||
{ &hf_isis_lsp_checksum_bad,
|
||||
{ "Bad Checksum", "isis.lsp.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"Bad IS-IS LSP Checksum", HFILL }
|
||||
{ &hf_isis_lsp_checksum_status,
|
||||
{ "Checksum Status", "isis.lsp.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
|
||||
{ &hf_isis_lsp_clv_ipv4_int_addr,
|
||||
|
|
|
@ -134,7 +134,6 @@ dissect_snp_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
|
|||
return;
|
||||
}
|
||||
|
||||
ti = proto_tree_add_item( tree, hf_isis_csnp_checksum, tvb, offset, length, ENC_BIG_ENDIAN);
|
||||
|
||||
checksum = tvb_get_ntohs(tvb, offset);
|
||||
|
||||
|
@ -145,22 +144,18 @@ dissect_snp_checksum_clv(tvbuff_t *tvb, packet_info* pinfo,
|
|||
|
||||
pdu_length = tvb_get_ntohs(tvb, 8);
|
||||
|
||||
/* unlike the LSP checksum verification which starts at an offset of 12 we start at offset 0*/
|
||||
switch (check_and_get_checksum(tvb, 0, pdu_length, checksum, offset, &cacl_checksum))
|
||||
{
|
||||
case NO_CKSUM :
|
||||
proto_item_append_text(ti, " [unused]");
|
||||
break;
|
||||
case DATA_MISSING :
|
||||
expert_add_info_format(pinfo, ti, &ei_isis_csnp_long_packet,
|
||||
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);
|
||||
} 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);
|
||||
} else {
|
||||
ti = proto_tree_add_checksum(tree, tvb, offset, hf_isis_csnp_checksum, -1, NULL, 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));
|
||||
break;
|
||||
case CKSUM_NOT_OK :
|
||||
proto_item_append_text(ti, " [incorrect, should be 0x%04x]", cacl_checksum);
|
||||
break;
|
||||
case CKSUM_OK :
|
||||
proto_item_append_text(ti, " [correct]");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ dissect_itdm_125usec(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_item(itdm_tree, hf_itdm_last_pack, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(itdm_tree, hf_itdm_pktlen, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
proto_tree_add_item(itdm_tree, hf_itdm_chksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(itdm_tree, tvb, offset, hf_itdm_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
proto_tree_add_item(itdm_tree, hf_itdm_uid, tvb, offset, 3, ENC_BIG_ENDIAN);
|
||||
offset += 3;
|
||||
|
@ -318,7 +318,7 @@ dissect_itdm_control(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
|
|||
proto_tree_add_item(itdm_ctl_tree, hf_itdm_last_pack, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_item(itdm_ctl_tree, hf_itdm_pktlen, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
proto_tree_add_item(itdm_ctl_tree, hf_itdm_chksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(itdm_ctl_tree, tvb, offset, hf_itdm_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
proto_tree_add_item(itdm_ctl_tree, hf_itdm_uid, tvb, offset, 3, ENC_BIG_ENDIAN);
|
||||
offset += 3;
|
||||
|
|
|
@ -294,7 +294,7 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
proto_tree_add_uint_format_value(kingfisher_tree, hf_kingfisher_message, tvb, 5, 1, kfp.message, "%u (0x%02X, %s)", message, kfp.message, ((kfp.message & 0xf0)?"Response":"Request"));
|
||||
|
||||
/* message function code */
|
||||
proto_tree_add_uint_format(kingfisher_tree, hf_kingfisher_function, tvb, 6, 1, kfp.function, "Message Function Code: %u (0x%02X, %s)", kfp.function, kfp.function, func_string);
|
||||
proto_tree_add_uint_format_value(kingfisher_tree, hf_kingfisher_function, tvb, 6, 1, kfp.function, "%u (0x%02X, %s)", kfp.function, kfp.function, func_string);
|
||||
|
||||
/* message data */
|
||||
if(kfp.length > ((kfp.version==3)?11:8)){
|
||||
|
@ -302,9 +302,7 @@ dissect_kingfisher(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
}
|
||||
|
||||
/* checksum */
|
||||
proto_tree_add_uint_format_value(kingfisher_tree, hf_kingfisher_checksum, tvb, kfp.length-1, 2, kfp.checksum, "0x%04X [%s]", kfp.checksum, ((checksum != kfp.checksum)?"incorrect":"correct"));
|
||||
|
||||
|
||||
proto_tree_add_checksum(kingfisher_tree, tvb, kfp.length-1, hf_kingfisher_checksum, -1, NULL, pinfo, checksum, ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -351,7 +349,7 @@ proto_register_kingfisher( void )
|
|||
{ &hf_kingfisher_target, { "Target RTU", "kingfisher.target", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_kingfisher_via, { "Via RTU", "kingfisher.via", FT_UINT16, BASE_DEC_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_kingfisher_message, { "Message Number", "kingfisher.message", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_kingfisher_function, { "Function Code", "kingfisher.function", FT_UINT8, BASE_DEC, VALS( function_code_vals ), 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_message_data, { "Message Data", "kingfisher.message_data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
};
|
||||
|
|
|
@ -74,8 +74,7 @@ static int hf_lapd_ftype_i = -1;
|
|||
static int hf_lapd_ftype_s_u = -1;
|
||||
static int hf_lapd_ftype_s_u_ext = -1;
|
||||
static int hf_lapd_checksum = -1;
|
||||
static int hf_lapd_checksum_good = -1;
|
||||
static int hf_lapd_checksum_bad = -1;
|
||||
static int hf_lapd_checksum_status = -1;
|
||||
|
||||
static gint ett_lapd = -1;
|
||||
static gint ett_lapd_address = -1;
|
||||
|
@ -417,10 +416,10 @@ dissect_lapd(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
static void
|
||||
dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean has_crc)
|
||||
{
|
||||
proto_tree *lapd_tree, *addr_tree, *checksum_tree;
|
||||
proto_item *lapd_ti, *addr_ti, *checksum_ti;
|
||||
proto_tree *lapd_tree, *addr_tree;
|
||||
proto_item *lapd_ti, *addr_ti;
|
||||
int direction;
|
||||
guint16 control, checksum, checksum_calculated;
|
||||
guint16 control;
|
||||
int lapd_header_len, checksum_offset;
|
||||
guint16 addr, cr, sapi, tei;
|
||||
gboolean is_response = 0;
|
||||
|
@ -543,25 +542,9 @@ dissect_lapd_full(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean
|
|||
|
||||
/* check checksum */
|
||||
checksum_offset = tvb_reported_length(tvb) - 2;
|
||||
checksum = tvb_get_guint8(tvb, checksum_offset); /* high byte */
|
||||
checksum <<= 8;
|
||||
checksum |= tvb_get_guint8(tvb, checksum_offset+1) & 0x00FF; /* low byte */
|
||||
checksum_calculated = crc16_ccitt_tvb(tvb, tvb_reported_length(tvb) - 2);
|
||||
checksum_calculated = g_htons(checksum_calculated); /* Note: g_htons() macro may eval arg multiple times */
|
||||
|
||||
if (checksum == checksum_calculated) {
|
||||
checksum_ti = proto_tree_add_uint_format_value(lapd_tree, hf_lapd_checksum, tvb, checksum_offset, 2, 0,"0x%04x [correct]", checksum);
|
||||
checksum_tree = proto_item_add_subtree(checksum_ti, ett_lapd_checksum);
|
||||
proto_tree_add_boolean(checksum_tree, hf_lapd_checksum_good, tvb, checksum_offset, 2, TRUE);
|
||||
proto_tree_add_boolean(checksum_tree, hf_lapd_checksum_bad, tvb, checksum_offset, 2, FALSE);
|
||||
} else {
|
||||
proto_item *pi;
|
||||
checksum_ti = proto_tree_add_uint_format_value(lapd_tree, hf_lapd_checksum, tvb, checksum_offset, 2, 0,"0x%04x [incorrect, should be 0x%04x]", checksum, checksum_calculated);
|
||||
checksum_tree = proto_item_add_subtree(checksum_ti, ett_lapd_checksum);
|
||||
proto_tree_add_boolean(checksum_tree, hf_lapd_checksum_good, tvb, checksum_offset, 2, FALSE);
|
||||
pi = proto_tree_add_boolean(checksum_tree, hf_lapd_checksum_bad, tvb, checksum_offset, 2, TRUE);
|
||||
expert_add_info(pinfo, pi, &ei_lapd_checksum_bad);
|
||||
}
|
||||
proto_tree_add_checksum(lapd_tree, tvb, checksum_offset, hf_lapd_checksum, hf_lapd_checksum_status, &ei_lapd_checksum_bad, pinfo,
|
||||
crc16_ccitt_tvb(tvb, tvb_reported_length(tvb) - 2), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
|
||||
next_tvb = tvb_new_subset_length(tvb, lapd_header_len, tvb_reported_length_remaining(tvb,lapd_header_len) - 2);
|
||||
|
||||
|
@ -702,13 +685,9 @@ proto_register_lapd(void)
|
|||
{ "Checksum", "lapd.checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0x0, "Details at: http://www.wireshark.org/docs/wsug_html_chunked/ChAdvChecksums.html", HFILL }},
|
||||
|
||||
{ &hf_lapd_checksum_good,
|
||||
{ "Good Checksum", "lapd.checksum_good", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "True: checksum matches packet content; False: doesn't match content or not checked", HFILL }},
|
||||
|
||||
{ &hf_lapd_checksum_bad,
|
||||
{ "Bad Checksum", "lapd.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "True: checksum doesn't match packet content; False: matches content or not checked", HFILL }},
|
||||
{ &hf_lapd_checksum_status,
|
||||
{ "Checksum Status", "lapd.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
};
|
||||
static gint *ett[] = {
|
||||
&ett_lapd,
|
||||
|
|
|
@ -707,7 +707,6 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
proto_item *hidden_item, *msg_item;
|
||||
|
||||
guint8 message_type;
|
||||
guint16 cksum, computed_cksum;
|
||||
vec_t cksum_vec[1];
|
||||
int j, k, l, len;
|
||||
int msg_length;
|
||||
|
@ -759,24 +758,16 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
|||
}
|
||||
|
||||
if (lmp_checksum_config) {
|
||||
cksum = tvb_get_ntohs(tvb, offset+6);
|
||||
ti = proto_tree_add_item(lmp_header_tree, hf_lmp_filter[LMPF_CHECKSUM], tvb,
|
||||
offset+6, 2, ENC_BIG_ENDIAN);
|
||||
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);
|
||||
computed_cksum = in_cksum(cksum_vec, 1);
|
||||
|
||||
if (computed_cksum == 0) {
|
||||
proto_item_append_text( ti, " [correct]");
|
||||
}
|
||||
else {
|
||||
expert_add_info_format(pinfo, ti, &ei_lmp_checksum_incorrect, "[incorrect, should be 0x%04x]",
|
||||
in_cksum_shouldbe(cksum, computed_cksum));
|
||||
}
|
||||
proto_tree_add_checksum(lmp_header_tree, tvb, offset+6, hf_lmp_filter[LMPF_CHECKSUM], -1, &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);
|
||||
}
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(lmp_header_tree, hf_lmp_filter[LMPF_CHECKSUM], tvb, offset+6, 2, 0, "[None]");
|
||||
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);
|
||||
}
|
||||
|
||||
offset += 8;
|
||||
|
|
|
@ -90,8 +90,8 @@ dissect_manolito(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* diss
|
|||
manolito_tree = proto_item_add_subtree(ti, ett_manolito);
|
||||
|
||||
/* MANOLITO packet header (network byte order) */
|
||||
proto_tree_add_item(manolito_tree,
|
||||
hf_manolito_checksum, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(manolito_tree, tvb, offset, hf_manolito_checksum,
|
||||
-1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 4;
|
||||
proto_tree_add_item(manolito_tree,
|
||||
hf_manolito_seqno, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -517,14 +517,14 @@ static int
|
|||
dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
||||
{
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
proto_item *mi, *crc_item;
|
||||
proto_item *mi;
|
||||
proto_tree *mbrtu_tree;
|
||||
int offset, packet_type;
|
||||
tvbuff_t *next_tvb;
|
||||
const char *func_string = "";
|
||||
const char *pkt_type_str = "";
|
||||
const char *err_str = "";
|
||||
guint16 len, crc16, calc_crc16;
|
||||
guint16 len, calc_crc16;
|
||||
guint8 unit_id, function_code, exception_code, subfunction_code;
|
||||
|
||||
/* Make entries in Protocol column on summary display */
|
||||
|
@ -535,7 +535,6 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
|
|||
|
||||
unit_id = tvb_get_guint8(tvb, 0);
|
||||
function_code = tvb_get_guint8(tvb, 1) & 0x7F;
|
||||
crc16 = tvb_get_ntohs(tvb, len-2);
|
||||
|
||||
offset = 0;
|
||||
|
||||
|
@ -618,14 +617,16 @@ dissect_mbrtu_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* dat
|
|||
|
||||
/* Add items to protocol tree specific to Modbus RTU */
|
||||
proto_tree_add_uint(mbrtu_tree, hf_mbrtu_unitid, tvb, offset, 1, unit_id);
|
||||
crc_item = proto_tree_add_uint(mbrtu_tree, hf_mbrtu_crc16, tvb, len-2, 2, crc16);
|
||||
|
||||
/* CRC validation */
|
||||
if (mbrtu_crc)
|
||||
{
|
||||
calc_crc16 = crc16_plain_tvb_offset_seed(tvb, offset, len-2, 0xFFFF);
|
||||
if (g_htons(calc_crc16) != crc16)
|
||||
expert_add_info_format(pinfo, crc_item, &ei_mbrtu_crc16_incorrect, "Incorrect CRC - should be 0x%04x", g_htons(calc_crc16));
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/* when determining payload length, make sure to ignore the unit ID header & CRC-16 footer bytes */
|
||||
|
|
|
@ -4093,8 +4093,8 @@ dissect_mip6(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
proto_tree_add_item(mip6_tree, hf_mip6_reserved, tvb,
|
||||
MIP6_RES_OFF, 1, ENC_BIG_ENDIAN);
|
||||
|
||||
proto_tree_add_item(mip6_tree, hf_mip6_csum, tvb,
|
||||
MIP6_CSUM_OFF, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(mip6_tree, tvb, MIP6_CSUM_OFF, hf_mip6_csum,
|
||||
-1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
/* Process mobility header */
|
||||
type = tvb_get_guint8(tvb, MIP6_TYPE_OFF);
|
||||
|
|
|
@ -800,8 +800,8 @@ dissect_dsmcc_ts(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree_in, void *d
|
|||
}
|
||||
} else {
|
||||
/* TODO: actually check the checksum */
|
||||
proto_tree_add_item(tree, hf_dsmcc_checksum, tvb,
|
||||
crc_len, 4, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(tree, tvb, crc_len, hf_dsmcc_checksum,
|
||||
-1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
|
|
|
@ -37,6 +37,7 @@ static int hf_mpeg_sect_syntax_indicator = -1;
|
|||
static int hf_mpeg_sect_reserved = -1;
|
||||
static int hf_mpeg_sect_length = -1;
|
||||
static int hf_mpeg_sect_crc = -1;
|
||||
static int hf_mpeg_sect_crc_status = -1;
|
||||
|
||||
static gint ett_mpeg_sect = -1;
|
||||
|
||||
|
@ -247,30 +248,12 @@ guint
|
|||
packet_mpeg_sect_crc(tvbuff_t *tvb, packet_info *pinfo,
|
||||
proto_tree *tree, guint start, guint end)
|
||||
{
|
||||
guint32 crc, calculated_crc;
|
||||
const char *label;
|
||||
|
||||
crc = tvb_get_ntohl(tvb, end);
|
||||
|
||||
calculated_crc = crc;
|
||||
label = "Unverified";
|
||||
if (mpeg_sect_check_crc) {
|
||||
label = "Verified";
|
||||
calculated_crc = crc32_mpeg2_tvb_offset(tvb, start, end);
|
||||
}
|
||||
|
||||
if (calculated_crc == crc) {
|
||||
proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb,
|
||||
end, 4, crc, "CRC: 0x%08x [%s]", crc, label);
|
||||
proto_tree_add_checksum(tree, tvb, end, hf_mpeg_sect_crc, hf_mpeg_sect_crc_status, &ei_mpeg_sect_crc, pinfo, crc32_mpeg2_tvb_offset(tvb, start, end),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
} else {
|
||||
proto_item *msg_error;
|
||||
|
||||
msg_error = proto_tree_add_uint_format( tree, hf_mpeg_sect_crc, tvb,
|
||||
end, 4, crc,
|
||||
"CRC: 0x%08x [Failed Verification (Calculated: 0x%08x)]",
|
||||
crc, calculated_crc );
|
||||
PROTO_ITEM_SET_GENERATED(msg_error);
|
||||
expert_add_info( pinfo, msg_error, &ei_mpeg_sect_crc);
|
||||
proto_tree_add_checksum(tree, tvb, end, hf_mpeg_sect_crc, hf_mpeg_sect_crc_status, &ei_mpeg_sect_crc, pinfo, crc32_mpeg2_tvb_offset(tvb, start, end),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
return 4;
|
||||
|
@ -348,7 +331,13 @@ proto_register_mpeg_sect(void)
|
|||
{ &hf_mpeg_sect_crc, {
|
||||
"CRC 32", "mpeg_sect.crc",
|
||||
FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL
|
||||
} }
|
||||
} },
|
||||
|
||||
{ &hf_mpeg_sect_crc_status, {
|
||||
"CRC 32 Status", "mpeg_sect.crc.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0, NULL, HFILL
|
||||
} },
|
||||
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
|
|
|
@ -46,7 +46,7 @@ void proto_reg_handoff_mrdisc(void);
|
|||
|
||||
static int proto_mrdisc = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
static int hf_type = -1;
|
||||
static int hf_advint = -1;
|
||||
static int hf_numopts = -1;
|
||||
|
@ -91,7 +91,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* skip unused bytes */
|
||||
|
@ -160,7 +160,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
return offset;
|
||||
|
@ -222,9 +222,9 @@ proto_register_mrdisc(void)
|
|||
{ "Checksum", "mrdisc.checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0, "MRDISC Checksum", HFILL }},
|
||||
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad Checksum", "mrdisc.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "Bad MRDISC Checksum", HFILL }},
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "mrdisc.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_advint,
|
||||
{ "Advertising Interval", "mrdisc.adv_int", FT_UINT8, BASE_DEC,
|
||||
|
|
|
@ -44,7 +44,7 @@ void proto_reg_handoff_msnip(void);
|
|||
|
||||
static int proto_msnip = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
static int hf_type = -1;
|
||||
static int hf_count = -1;
|
||||
static int hf_holdtime = -1;
|
||||
|
@ -89,7 +89,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
while (count--) {
|
||||
|
@ -135,7 +135,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* 16 bit holdtime */
|
||||
|
@ -161,7 +161,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_bad, pinfo, 0);
|
||||
igmp_checksum(parent_tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
/* holdtime */
|
||||
|
@ -264,9 +264,9 @@ proto_register_msnip(void)
|
|||
{ "Checksum", "msnip.checksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0, "MSNIP Checksum", HFILL }},
|
||||
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad Checksum", "msnip.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, "Bad MSNIP Checksum", HFILL }},
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "msnip.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
|
||||
{ &hf_count,
|
||||
{ "Count", "msnip.count", FT_UINT8, BASE_DEC,
|
||||
|
|
|
@ -86,8 +86,7 @@ static int hf_mstp_frame_vendor_id = -1;
|
|||
static int hf_mstp_frame_pdu_len = -1;
|
||||
static int hf_mstp_frame_crc8 = -1;
|
||||
static int hf_mstp_frame_crc16 = -1;
|
||||
static int hf_mstp_frame_checksum_bad = -1;
|
||||
static int hf_mstp_frame_checksum_good = -1;
|
||||
static int hf_mstp_frame_checksum_status = -1;
|
||||
|
||||
static expert_field ei_mstp_frame_pdu_len = EI_INIT;
|
||||
static expert_field ei_mstp_frame_checksum_bad = EI_INIT;
|
||||
|
@ -190,12 +189,11 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
proto_item *item;
|
||||
#if defined(BACNET_MSTP_CHECKSUM_VALIDATE)
|
||||
/* used to calculate the crc value */
|
||||
guint8 crc8 = 0xFF, framecrc8;
|
||||
guint16 crc16 = 0xFFFF, framecrc16;
|
||||
guint8 crc8 = 0xFF;
|
||||
guint16 crc16 = 0xFFFF;
|
||||
guint8 crcdata;
|
||||
guint16 i; /* loop counter */
|
||||
guint16 max_len = 0;
|
||||
proto_tree *checksum_tree;
|
||||
#endif
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "BACnet");
|
||||
|
@ -228,39 +226,11 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
crc8 = CRC_Calc_Header(crcdata, crc8);
|
||||
}
|
||||
crc8 = ~crc8;
|
||||
framecrc8 = tvb_get_guint8(tvb, offset+5);
|
||||
if (framecrc8 == crc8) {
|
||||
item = proto_tree_add_uint_format_value(subtree, hf_mstp_frame_crc8,
|
||||
tvb, offset+5, 1, framecrc8,
|
||||
"0x%02x [correct]", framecrc8);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_bacnet_mstp_checksum);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_good,
|
||||
tvb, offset+5, 1, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_bad,
|
||||
tvb, offset+5, 1, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(subtree, hf_mstp_frame_crc8,
|
||||
tvb, offset+5, 1, framecrc8,
|
||||
"0x%02x [incorrect, should be 0x%02x]",
|
||||
framecrc8, crc8);
|
||||
checksum_tree = proto_item_add_subtree(item, ett_bacnet_mstp_checksum);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_good,
|
||||
tvb, offset+5, 1, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_bad,
|
||||
tvb, offset+5, 1, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
expert_add_info(pinfo, item, &ei_mstp_frame_checksum_bad);
|
||||
}
|
||||
proto_tree_add_checksum(subtree, tvb, offset+5, hf_mstp_frame_crc8, hf_mstp_frame_checksum_status, &ei_mstp_frame_checksum_bad, pinfo, crc8,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
#else
|
||||
proto_tree_add_item(subtree, hf_mstp_frame_crc8,
|
||||
tvb, offset+5, 1, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_checksum(subtree, tvb, offset+5, hf_mstp_frame_crc8, hf_mstp_frame_checksum_status, &ei_mstp_frame_checksum_bad, pinfo, 0,
|
||||
PROTO_CHECKSUM_NO_FLAGS);
|
||||
#endif
|
||||
|
||||
/* dissect BACnet PDU if there is one */
|
||||
|
@ -300,42 +270,12 @@ dissect_mstp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
crc16 = ~crc16;
|
||||
/* convert it to on-the-wire format */
|
||||
crc16 = g_htons(crc16);
|
||||
/* get the actual CRC from the frame */
|
||||
framecrc16 = tvb_get_ntohs(tvb, offset+mstp_frame_pdu_len);
|
||||
if (framecrc16 == crc16) {
|
||||
item = proto_tree_add_uint_format_value(subtree, hf_mstp_frame_crc16,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, framecrc16,
|
||||
"0x%04x [correct]", framecrc16);
|
||||
checksum_tree = proto_item_add_subtree(item,
|
||||
ett_bacnet_mstp_checksum);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_good,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_bad,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
item = proto_tree_add_uint_format_value(subtree, hf_mstp_frame_crc16,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, framecrc16,
|
||||
"0x%04x [incorrect, should be 0x%04x]",
|
||||
framecrc16, crc16);
|
||||
checksum_tree = proto_item_add_subtree(item,
|
||||
ett_bacnet_mstp_checksum);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_good,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree,
|
||||
hf_mstp_frame_checksum_bad,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
expert_add_info(pinfo, item, &ei_mstp_frame_checksum_bad);
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(subtree, tvb, offset+mstp_frame_pdu_len, hf_mstp_frame_crc16, hf_mstp_frame_checksum_status, &ei_mstp_frame_checksum_bad, pinfo, crc16,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
#else
|
||||
proto_tree_add_item(subtree, hf_mstp_frame_crc16,
|
||||
tvb, offset+mstp_frame_pdu_len, 2, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_checksum(subtree, tvb, offset+mstp_frame_pdu_len, hf_mstp_frame_crc16, hf_mstp_frame_checksum_status, &ei_mstp_frame_checksum_bad, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@ -427,16 +367,11 @@ proto_register_mstp(void)
|
|||
FT_UINT16, BASE_HEX, NULL, 0,
|
||||
"MS/TP Data CRC", HFILL }
|
||||
},
|
||||
{ &hf_mstp_frame_checksum_bad,
|
||||
{ "Bad", "mstp.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content or not checked", HFILL }
|
||||
{ &hf_mstp_frame_checksum_status,
|
||||
{ "Checksum status", "mstp.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_mstp_frame_checksum_good,
|
||||
{ "Good", "mstp.checksum_good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL }
|
||||
}
|
||||
};
|
||||
|
||||
static gint *ett[] = {
|
||||
|
|
|
@ -6324,8 +6324,7 @@ dissect_mswsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolean in,
|
|||
"(Unknown: 0x%x)"));
|
||||
}
|
||||
|
||||
proto_tree_add_item(hdr_tree, hf_mswsp_hdr_checksum, tvb,
|
||||
8, 4, ENC_LITTLE_ENDIAN);
|
||||
proto_tree_add_checksum(hdr_tree, tvb, 8, hf_mswsp_hdr_checksum, -1, NULL, pinfo, 0, ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
/* todo: validate checksum */
|
||||
|
||||
proto_tree_add_item(hdr_tree, hf_mswsp_hdr_reserved, tvb,
|
||||
|
|
|
@ -148,11 +148,7 @@ mtp2_decode_crc16(tvbuff_t *tvb, proto_tree *fh_tree, packet_info *pinfo)
|
|||
{
|
||||
tvbuff_t *next_tvb;
|
||||
gint len, reported_len;
|
||||
int rx_fcs_offset;
|
||||
guint32 rx_fcs_exp;
|
||||
guint32 rx_fcs_got;
|
||||
int proto_offset=0;
|
||||
proto_item *cause;
|
||||
|
||||
/*
|
||||
* Do we have the entire packet, and does it include a 2-byte FCS?
|
||||
|
@ -191,16 +187,8 @@ mtp2_decode_crc16(tvbuff_t *tvb, proto_tree *fh_tree, packet_info *pinfo)
|
|||
/*
|
||||
* Compute the FCS and put it into the tree.
|
||||
*/
|
||||
rx_fcs_offset = proto_offset + len;
|
||||
rx_fcs_exp = mtp2_fcs16(tvb);
|
||||
rx_fcs_got = tvb_get_letohs(tvb, rx_fcs_offset);
|
||||
cause=proto_tree_add_item(fh_tree, hf_mtp2_fcs_16, tvb, rx_fcs_offset, 2, ENC_LITTLE_ENDIAN);
|
||||
if (rx_fcs_got != rx_fcs_exp) {
|
||||
proto_item_append_text(cause, " [incorrect, should be 0x%04x]", rx_fcs_exp);
|
||||
expert_add_info(pinfo, cause, &ei_mtp2_checksum_error);
|
||||
} else {
|
||||
proto_item_append_text(cause, " [correct]");
|
||||
}
|
||||
proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_mtp2_fcs_16, -1, &ei_mtp2_checksum_error, pinfo, mtp2_fcs16(tvb),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
return next_tvb;
|
||||
}
|
||||
|
|
|
@ -535,8 +535,8 @@ dissect_netsync_pdu(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* d
|
|||
|
||||
offset += size;
|
||||
|
||||
proto_tree_add_item(netsync_tree, hf_netsync_checksum, tvb,
|
||||
offset, 4, ENC_BIG_ENDIAN );
|
||||
proto_tree_add_checksum(netsync_tree, tvb, offset, hf_netsync_checksum,
|
||||
-1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS );
|
||||
offset += 4;
|
||||
|
||||
|
||||
|
|
|
@ -282,14 +282,6 @@ typedef struct _e_nhrp {
|
|||
guint8 ar_sstl;
|
||||
} e_nhrp_hdr;
|
||||
|
||||
static guint16 nhrp_checksum(tvbuff_t *tvb, int len)
|
||||
{
|
||||
vec_t cksum_vec[1];
|
||||
|
||||
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, len);
|
||||
return in_cksum(&cksum_vec[0], 1);
|
||||
}
|
||||
|
||||
static void dissect_nhrp_hdr(tvbuff_t *tvb,
|
||||
packet_info *pinfo,
|
||||
proto_tree *tree,
|
||||
|
@ -302,7 +294,6 @@ static void dissect_nhrp_hdr(tvbuff_t *tvb,
|
|||
gint offset = *pOffset;
|
||||
const gchar *pro_type_str;
|
||||
guint total_len = tvb_reported_length(tvb);
|
||||
guint16 ipcsum, rx_chksum;
|
||||
|
||||
proto_tree *nhrp_tree;
|
||||
proto_item *shtl_tree_item;
|
||||
|
@ -379,20 +370,14 @@ static void dissect_nhrp_hdr(tvbuff_t *tvb,
|
|||
proto_tree_add_item(nhrp_tree, hf_nhrp_hdr_pktsz, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
|
||||
rx_chksum = tvb_get_ntohs(tvb, offset);
|
||||
if (tvb_bytes_exist(tvb, 0, total_len)) {
|
||||
ipcsum = nhrp_checksum(tvb, total_len);
|
||||
if (ipcsum == 0) {
|
||||
proto_tree_add_uint_format_value(nhrp_tree, hf_nhrp_hdr_chksum, tvb, offset, 2, rx_chksum,
|
||||
"0x%04x [correct]", rx_chksum);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(nhrp_tree, hf_nhrp_hdr_chksum, tvb, offset, 2, rx_chksum,
|
||||
"0x%04x [incorrect, should be 0x%04x]", rx_chksum,
|
||||
in_cksum_shouldbe(rx_chksum, ipcsum));
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(nhrp_tree, hf_nhrp_hdr_chksum, tvb, offset, 2, rx_chksum,
|
||||
"0x%04x [not all data available]", rx_chksum);
|
||||
proto_tree_add_checksum(nhrp_tree, tvb, offset, hf_nhrp_hdr_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
|
|
|
@ -945,9 +945,7 @@ nlsp_dissect_nlsp_lsp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
offset += 4;
|
||||
|
||||
/* XXX -> we could validate the cksum here! */
|
||||
proto_tree_add_item(tree, hf_nlsp_lsp_checksum, tvb,
|
||||
offset, 2, ENC_BIG_ENDIAN );
|
||||
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_nlsp_lsp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
if (tree) {
|
||||
|
@ -1027,7 +1025,7 @@ dissect_csnp_lsp_entries(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, in
|
|||
proto_tree_add_uint_format_value(subtree, hf_nlsp_csnp_remaining_lifetime, tvb, offset, 2,
|
||||
tvb_get_ntohs(tvb, offset), "%us", tvb_get_ntohs(tvb, offset));
|
||||
|
||||
proto_tree_add_item(subtree, hf_nlsp_csnp_lsp_checksum, tvb, offset+14, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(subtree, tvb, offset+14, hf_nlsp_csnp_lsp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
length -= 16;
|
||||
offset += 16;
|
||||
|
@ -1063,7 +1061,7 @@ dissect_psnp_lsp_entries(tvbuff_t *tvb, packet_info* pinfo, proto_tree *tree, in
|
|||
proto_tree_add_uint_format_value(subtree, hf_nlsp_psnp_remaining_lifetime, tvb, offset, 2,
|
||||
tvb_get_ntohs(tvb, offset), "%us", tvb_get_ntohs(tvb, offset));
|
||||
|
||||
proto_tree_add_item(subtree, hf_nlsp_psnp_lsp_checksum, tvb, offset+14, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(subtree, tvb, offset+14, hf_nlsp_psnp_lsp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
length -= 16;
|
||||
offset += 16;
|
||||
|
|
|
@ -243,7 +243,7 @@ dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
proto_tree_add_item(nsrp_tree, hf_nsrp_no_used, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(nsrp_tree, hf_nsrp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(nsrp_tree, tvb, offset, hf_nsrp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(nsrp_tree, hf_nsrp_data, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
||||
|
@ -293,7 +293,7 @@ dissect_nsrp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_
|
|||
proto_tree_add_item(nsrp_tree, hf_nsrp_dummy, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
proto_tree_add_item(nsrp_tree, hf_nsrp_authchecksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(nsrp_tree, tvb, offset, hf_nsrp_authchecksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(nsrp_tree, hf_nsrp_data, tvb, offset, -1, ENC_ASCII|ENC_NA);
|
||||
|
|
|
@ -52,23 +52,18 @@ static dissector_handle_t osi_handle;
|
|||
static gboolean tpkt_desegment = FALSE;
|
||||
static guint global_tcp_port_osi_over_tpkt = 0;
|
||||
|
||||
cksum_status_t
|
||||
calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
|
||||
const gchar *buffer;
|
||||
gboolean
|
||||
osi_calc_checksum( tvbuff_t *tvb, int offset, guint len, guint32* c0, guint32* c1) {
|
||||
guint available_len;
|
||||
const guint8 *p;
|
||||
guint32 c0, c1;
|
||||
guint seglen;
|
||||
guint i;
|
||||
|
||||
if ( 0 == checksum )
|
||||
return( NO_CKSUM );
|
||||
|
||||
available_len = tvb_captured_length_remaining( tvb, offset );
|
||||
if ( available_len < len )
|
||||
return( DATA_MISSING );
|
||||
return FALSE;
|
||||
|
||||
buffer = tvb_get_ptr( tvb, offset, len );
|
||||
p = tvb_get_ptr( tvb, offset, len );
|
||||
|
||||
/*
|
||||
* The maximum values of c0 and c1 will occur if all bytes have the
|
||||
|
@ -81,33 +76,29 @@ calc_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum) {
|
|||
* we can solve this by taking c0 and c1 mod 255 every
|
||||
* 5803 bytes.
|
||||
*/
|
||||
p = buffer;
|
||||
c0 = 0;
|
||||
c1 = 0;
|
||||
*c0 = 0;
|
||||
*c1 = 0;
|
||||
while (len != 0) {
|
||||
seglen = len;
|
||||
if (seglen > 5803)
|
||||
seglen = 5803;
|
||||
for (i = 0; i < seglen; i++) {
|
||||
c0 = c0 + *(p++);
|
||||
c1 += c0;
|
||||
(*c0) += *(p++);
|
||||
(*c1) += (*c0);
|
||||
}
|
||||
|
||||
c0 = c0 % 255;
|
||||
c1 = c1 % 255;
|
||||
(*c0) = (*c0) % 255;
|
||||
(*c1) = (*c1) % 255;
|
||||
|
||||
len -= seglen;
|
||||
}
|
||||
if (c0 != 0 || c1 != 0)
|
||||
return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
|
||||
else
|
||||
return( CKSUM_OK );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
cksum_status_t
|
||||
check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, int offset_check, guint16* result) {
|
||||
const gchar *buffer;
|
||||
gboolean
|
||||
osi_check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, int offset_check, guint16* result) {
|
||||
guint available_len;
|
||||
const guint8 *p;
|
||||
guint8 discard = 0;
|
||||
|
@ -116,15 +107,12 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in
|
|||
guint i;
|
||||
int block, x, y;
|
||||
|
||||
if ( 0 == checksum )
|
||||
return( NO_CKSUM );
|
||||
|
||||
available_len = tvb_captured_length_remaining( tvb, offset );
|
||||
offset_check -= offset;
|
||||
if ( ( available_len < len ) || ( offset_check < 0 ) || ( (guint)(offset_check+2) > len ) )
|
||||
return( DATA_MISSING );
|
||||
return FALSE;
|
||||
|
||||
buffer = tvb_get_ptr( tvb, offset, len );
|
||||
p = tvb_get_ptr( tvb, offset, len );
|
||||
block = offset_check / 5803;
|
||||
|
||||
/*
|
||||
|
@ -138,7 +126,6 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in
|
|||
* we can solve this by taking c0 and c1 mod 255 every
|
||||
* 5803 bytes.
|
||||
*/
|
||||
p = buffer;
|
||||
c0 = 0;
|
||||
c1 = 0;
|
||||
|
||||
|
@ -189,11 +176,7 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in
|
|||
if (y == 0) y = 0x01;
|
||||
|
||||
*result = ( x << 8 ) | ( y & 0xFF );
|
||||
|
||||
if (*result != checksum)
|
||||
return( CKSUM_NOT_OK ); /* XXX - what should the checksum field be? */
|
||||
else
|
||||
return( CKSUM_OK );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* 4 octet ATN extended checksum: ICAO doc 9705 Ed3 Volume V section 5.5.4.6.4 */
|
||||
|
@ -201,7 +184,7 @@ check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, guint checksum, in
|
|||
/* of length SRC-NSAP, SRC-NSAP, length DST-NSAP, DST-NSAP and ATN extended checksum. */
|
||||
/* In case of a CR TPDU, the value of the ISO 8073 16-bit fletcher checksum parameter shall */
|
||||
/* be set to zero. */
|
||||
gboolean check_atn_ec_32(
|
||||
guint32 check_atn_ec_32(
|
||||
tvbuff_t *tvb, guint tpdu_len,
|
||||
guint offset_ec_32_val, /* offset ATN extended checksum value, calculated at last as part of pseudo trailer */
|
||||
guint offset_iso8073_val, /* offset ISO 8073 fletcher checksum, CR only*/
|
||||
|
@ -314,12 +297,8 @@ gboolean check_atn_ec_32(
|
|||
c3 -= 0x000000FF;
|
||||
}
|
||||
|
||||
sum = (c3 << 24) + (c2 << 16 ) + (c1 << 8) + c0 ;
|
||||
|
||||
if(!sum)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
sum = (c3 << 24) + (c2 << 16 ) + (c1 << 8) + c0;
|
||||
return sum;
|
||||
}
|
||||
|
||||
/* 2 octet ATN extended checksum: ICAO doc 9705 Ed3 Volume V section 5.5.4.6.4 */
|
||||
|
@ -328,7 +307,7 @@ gboolean check_atn_ec_32(
|
|||
/* In case of a CR TPDU, the value of the ISO 8073 16-bit fletcher checksum parameter shall */
|
||||
/* be set to zero. */
|
||||
/* this routine is currently *untested* because of the unavailability of samples.*/
|
||||
gboolean check_atn_ec_16(
|
||||
guint16 check_atn_ec_16(
|
||||
tvbuff_t *tvb,
|
||||
guint tpdu_len,
|
||||
guint offset_ec_16_val, /* offset ATN extended checksum value, calculated at last as part of pseudo trailer */
|
||||
|
@ -341,7 +320,7 @@ gboolean check_atn_ec_16(
|
|||
guint i = 0;
|
||||
guint16 c0 = 0;
|
||||
guint16 c1 = 0;
|
||||
guint16 sum = 0;
|
||||
guint16 sum;
|
||||
|
||||
/* sum across complete TPDU */
|
||||
for ( i =0; i< tpdu_len; i++){
|
||||
|
@ -405,11 +384,7 @@ gboolean check_atn_ec_16(
|
|||
}
|
||||
|
||||
sum = (c1 << 8) + c0 ;
|
||||
|
||||
if(!sum)
|
||||
return TRUE;
|
||||
else
|
||||
return FALSE;
|
||||
return sum;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,19 +57,12 @@
|
|||
* published API functions
|
||||
*/
|
||||
|
||||
typedef enum {
|
||||
NO_CKSUM, /* checksum field is 0 */
|
||||
DATA_MISSING, /* not all the data covered by the checksum was captured */
|
||||
CKSUM_OK, /* checksum is OK */
|
||||
CKSUM_NOT_OK /* checksum is not OK */
|
||||
} cksum_status_t;
|
||||
|
||||
/* Exposed to be used by packet-osi-options.c */
|
||||
extern int proto_osi;
|
||||
|
||||
extern cksum_status_t calc_checksum(tvbuff_t *, int, guint, guint);
|
||||
extern cksum_status_t check_and_get_checksum(tvbuff_t *, int, guint, guint, int, guint16*);
|
||||
extern gboolean check_atn_ec_32(tvbuff_t *tvb, guint tpdu_len, guint offset_ec_32_val, guint offset_iso8073_val, guint clnp_dst_len, const guint8 *clnp_dst, guint clnp_src_len, const guint8 *clnp_src);
|
||||
extern gboolean check_atn_ec_16(tvbuff_t *tvb, guint tpdu_len, guint offset_ec_16_val, guint offset_iso8073_val, guint clnp_dst_len, const guint8 *clnp_dst, guint clnp_src_len, const guint8 *clnp_src);
|
||||
extern gboolean osi_calc_checksum( tvbuff_t *tvb, int offset, guint len, guint32* c0, guint32* c1);
|
||||
extern gboolean osi_check_and_get_checksum( tvbuff_t *tvb, int offset, guint len, int offset_check, guint16* result);
|
||||
extern guint32 check_atn_ec_32(tvbuff_t *tvb, guint tpdu_len, guint offset_ec_32_val, guint offset_iso8073_val, guint clnp_dst_len, const guint8 *clnp_dst, guint clnp_src_len, const guint8 *clnp_src);
|
||||
extern guint16 check_atn_ec_16(tvbuff_t *tvb, guint tpdu_len, guint offset_ec_16_val, guint offset_iso8073_val, guint clnp_dst_len, const guint8 *clnp_dst, guint clnp_src_len, const guint8 *clnp_src);
|
||||
|
||||
#endif /* _PACKET_OSI_H */
|
||||
|
|
|
@ -68,7 +68,8 @@ static int hf_cotp_eot_extended = -1;
|
|||
static int hf_cotp_parameter_code = -1;
|
||||
static int hf_cotp_parameter_length = -1;
|
||||
static int hf_cotp_parameter_value = -1;
|
||||
static int hf_cotp_atn_extended_checksum = -1;
|
||||
static int hf_cotp_atn_extended_checksum16 = -1;
|
||||
static int hf_cotp_atn_extended_checksum32 = -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;
|
||||
|
@ -440,10 +441,8 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
|
|||
gint32 i = 0;
|
||||
guint8 tmp_code = 0;
|
||||
guint tmp_len = 0;
|
||||
cksum_status_t cksum_status;
|
||||
gboolean checksum_ok = FALSE;
|
||||
guint32 pref_max_tpdu_size;
|
||||
proto_item *ti, *hidden_item;
|
||||
proto_item *hidden_item;
|
||||
|
||||
while (vp_length != 0) {
|
||||
code = tvb_get_guint8(tvb, offset);
|
||||
|
@ -462,6 +461,7 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
|
|||
|
||||
case VP_ATN_EC_16 : /* ATN */
|
||||
if (cotp_decode_atn) {
|
||||
guint16 sum;
|
||||
/* if an alternate OSI checksum is present in the currently unprocessed
|
||||
* VP section to the checksum algorithm has to know.
|
||||
* this may be the case for backward compatible CR TPDU */
|
||||
|
@ -477,12 +477,11 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
|
|||
i += tmp_len;
|
||||
}
|
||||
}
|
||||
checksum_ok = check_atn_ec_16(tvb, tpdu_len , offset,
|
||||
sum = check_atn_ec_16(tvb, tpdu_len , offset,
|
||||
offset_iso8073_checksum,
|
||||
pinfo->dst.len, (const guint8 *)pinfo->dst.data,
|
||||
pinfo->src.len, (const guint8 *)pinfo->src.data);
|
||||
ti = proto_tree_add_item(tree, hf_cotp_atn_extended_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_item_append_text(ti, checksum_ok ? " (correct)" : " (incorrect)");
|
||||
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);
|
||||
} else {
|
||||
proto_tree_add_bytes_format_value(tree, hf_cotp_parameter_value, tvb, offset, length, NULL, "<not shown>");
|
||||
}
|
||||
|
@ -492,6 +491,7 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
|
|||
|
||||
case VP_ATN_EC_32 : /* ATN */
|
||||
if (cotp_decode_atn) {
|
||||
guint32 sum;
|
||||
/* if an alternate OSI checksum is present in the currently unprocessed
|
||||
* VP section the checksum algorithm has to know.
|
||||
* this may be the case for backward compatible CR TPDU */
|
||||
|
@ -507,12 +507,11 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
|
|||
i += tmp_len;
|
||||
}
|
||||
}
|
||||
checksum_ok = check_atn_ec_32(tvb, tpdu_len , offset,
|
||||
sum = check_atn_ec_32(tvb, tpdu_len , offset,
|
||||
offset_iso8073_checksum,
|
||||
pinfo->dst.len, (const guint8 *)pinfo->dst.data,
|
||||
pinfo->src.len, (const guint8 *)pinfo->src.data);
|
||||
ti = proto_tree_add_item(tree, hf_cotp_atn_extended_checksum, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
proto_item_append_text(ti, checksum_ok ? " (correct)" : " (incorrect)");
|
||||
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);
|
||||
} else {
|
||||
proto_tree_add_bytes_format_value(tree, hf_cotp_parameter_value, tvb, offset, length, NULL, "<not shown>");
|
||||
}
|
||||
|
@ -691,36 +690,21 @@ static gboolean ositp_decode_var_part(tvbuff_t *tvb, int offset, int vp_length,
|
|||
|
||||
case VP_CHECKSUM:
|
||||
offset_iso8073_checksum = offset; /* save ISO 8073 checksum offset for ATN extended checksum calculation */
|
||||
cksum_status = calc_checksum(tvb, 0, tpdu_len,
|
||||
tvb_get_ntohs(tvb, offset));
|
||||
switch (cksum_status) {
|
||||
|
||||
default:
|
||||
/*
|
||||
* No checksum present, or not enough of the packet present to
|
||||
* checksum it.
|
||||
*/
|
||||
proto_tree_add_item(tree, hf_cotp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
break;
|
||||
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);
|
||||
} else {
|
||||
guint32 calc_c0 = 0, calc_c1 = 0;
|
||||
|
||||
case CKSUM_OK:
|
||||
/*
|
||||
* Checksum is correct.
|
||||
*/
|
||||
s = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint_format_value(tree, hf_cotp_checksum, tvb, offset, 2,
|
||||
s, "0x%04x (correct)", s);
|
||||
break;
|
||||
|
||||
case CKSUM_NOT_OK:
|
||||
/*
|
||||
* Checksum is not correct.
|
||||
*/
|
||||
s = tvb_get_ntohs(tvb, offset);
|
||||
proto_tree_add_uint_format_value(tree, hf_cotp_checksum, tvb, offset, 2,
|
||||
s, "0x%04x (incorrect)", s);
|
||||
break;
|
||||
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);
|
||||
} else {
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_cotp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
}
|
||||
|
||||
offset += length;
|
||||
vp_length -= length;
|
||||
break;
|
||||
|
@ -2338,7 +2322,8 @@ void proto_register_cotp(void)
|
|||
{ &hf_cotp_parameter_code, { "Parameter code", "cotp.parameter_code", FT_UINT8, BASE_HEX, VALS(tp_vpart_type_vals), 0x0, NULL, HFILL }},
|
||||
{ &hf_cotp_parameter_length, { "Parameter length", "cotp.parameter_length", FT_UINT8, BASE_DEC, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_cotp_parameter_value, { "Parameter value", "cotp.parameter_value", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_cotp_atn_extended_checksum, { "ATN extended checksum", "cotp.atn_extended_checksum", FT_UINT32, BASE_HEX, 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_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 }},
|
||||
|
|
|
@ -1470,7 +1470,7 @@ dissect_ospf_lls_data_block(tvbuff_t *tvb, packet_info *pinfo, int offset, proto
|
|||
ospf_lls_data_block_tree = proto_tree_add_subtree(tree, tvb, offset, -1, ett_ospf_lls_data_block, NULL, "OSPF LLS Data Block");
|
||||
|
||||
/* TODO: verify checksum */
|
||||
proto_tree_add_item(ospf_lls_data_block_tree, hf_ospf_lls_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(ospf_lls_data_block_tree, tvb, offset, hf_ospf_lls_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_tree_add_uint_format_value(ospf_lls_data_block_tree, hf_ospf_lls_data_length, tvb, offset + 2, 2,
|
||||
ospf_lls_len, "%d bytes", ospf_lls_len);
|
||||
|
||||
|
|
|
@ -148,7 +148,7 @@ static int hf_pgm_main_opts_netsig = -1;
|
|||
static int hf_pgm_main_opts_varlen = -1;
|
||||
static int hf_pgm_main_opts_parity = -1;
|
||||
static int hf_pgm_main_cksum = -1;
|
||||
static int hf_pgm_main_cksum_bad = -1;
|
||||
static int hf_pgm_main_cksum_status = -1;
|
||||
static int hf_pgm_main_gsi = -1;
|
||||
static int hf_pgm_main_tsdulen = -1;
|
||||
static int hf_pgm_spm_sqn = -1;
|
||||
|
@ -910,30 +910,18 @@ 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_uint_format_value(pgm_tree, hf_pgm_main_cksum, tvb,
|
||||
ptvcursor_current_offset(cursor), 2, pgmhdr_cksum, "not available");
|
||||
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);
|
||||
} else {
|
||||
reportedlen = tvb_reported_length(tvb);
|
||||
pgmlen = tvb_captured_length(tvb);
|
||||
if (pgm_check_checksum && pgmlen >= reportedlen) {
|
||||
vec_t cksum_vec[1];
|
||||
guint16 computed_cksum;
|
||||
|
||||
SET_CKSUM_VEC_TVB(cksum_vec[0], tvb, 0, pgmlen);
|
||||
computed_cksum = in_cksum(&cksum_vec[0], 1);
|
||||
if (computed_cksum == 0) {
|
||||
proto_tree_add_uint_format_value(pgm_tree, hf_pgm_main_cksum, tvb,
|
||||
ptvcursor_current_offset(cursor), 2, pgmhdr_cksum, "0x%04x [correct]", pgmhdr_cksum);
|
||||
} else {
|
||||
hidden_item = proto_tree_add_boolean(pgm_tree, hf_pgm_main_cksum_bad, tvb,
|
||||
ptvcursor_current_offset(cursor), 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_tree_add_uint_format_value(pgm_tree, hf_pgm_main_cksum, tvb,
|
||||
ptvcursor_current_offset(cursor), 2, pgmhdr_cksum, "0x%04x [incorrect, should be 0x%04x]",
|
||||
pgmhdr_cksum, in_cksum_shouldbe(pgmhdr_cksum, computed_cksum));
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
ptvcursor_add_no_advance(cursor, hf_pgm_main_cksum, 2, ENC_BIG_ENDIAN);
|
||||
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);
|
||||
}
|
||||
}
|
||||
ptvcursor_advance(cursor, 2);
|
||||
|
@ -1120,9 +1108,9 @@ proto_register_pgm(void)
|
|||
{ &hf_pgm_main_cksum,
|
||||
{ "Checksum", "pgm.hdr.cksum", FT_UINT16, BASE_HEX,
|
||||
NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_pgm_main_cksum_bad,
|
||||
{ "Bad Checksum", "pgm.hdr.cksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_pgm_main_cksum_status,
|
||||
{ "Checksum Status", "pgm.hdr.cksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
{ &hf_pgm_main_gsi,
|
||||
{ "Global Source Identifier", "pgm.hdr.gsi", FT_BYTES, BASE_NONE,
|
||||
NULL, 0x0, NULL, HFILL }},
|
||||
|
|
|
@ -327,12 +327,10 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
|
|||
guint8 pim_type;
|
||||
guint8 pim_ver;
|
||||
guint length, pim_length;
|
||||
guint16 pim_cksum, computed_cksum;
|
||||
vec_t cksum_vec[1];
|
||||
proto_tree *pim_tree = NULL;
|
||||
proto_item *ti;
|
||||
proto_tree *pimopt_tree = NULL;
|
||||
proto_item *ticksum;
|
||||
int offset = 0;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PIMv1");
|
||||
|
@ -353,10 +351,10 @@ dissect_pimv1(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U
|
|||
proto_tree_add_uint(pim_tree, hf_pim_code, tvb, offset, 1, pim_type);
|
||||
offset += 1;
|
||||
|
||||
pim_cksum = tvb_get_ntohs(tvb, offset);
|
||||
ticksum = proto_tree_add_item(pim_tree, hf_pim_cksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
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);
|
||||
|
||||
/*
|
||||
* Not PIMv1; should we bother dissecting the PIM drafts
|
||||
* with a version number of 2 and with PIM running atop
|
||||
|
@ -403,12 +401,10 @@ 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);
|
||||
computed_cksum = in_cksum(&cksum_vec[0], 1);
|
||||
if (computed_cksum == 0) {
|
||||
proto_item_append_text(ticksum, " [correct]");
|
||||
} else {
|
||||
proto_item_append_text(ticksum, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(pim_cksum, computed_cksum));
|
||||
}
|
||||
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);
|
||||
} else {
|
||||
proto_tree_add_checksum(pim_tree, tvb, offset, hf_pim_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
offset += 2;
|
||||
|
||||
|
@ -805,14 +801,13 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
guint8 pim_typever;
|
||||
guint8 pim_bidir_subtype = 0;
|
||||
guint length, pim_length;
|
||||
guint16 pim_cksum, computed_cksum;
|
||||
vec_t cksum_vec[4];
|
||||
guint32 phdr[2];
|
||||
const char *typestr;
|
||||
proto_tree *pim_tree = NULL;
|
||||
proto_item *ti;
|
||||
proto_tree *pimopt_tree = NULL;
|
||||
proto_item *tiopt, *ticksum;
|
||||
proto_item *tiopt;
|
||||
|
||||
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PIM");
|
||||
col_clear(pinfo->cinfo, COL_INFO);
|
||||
|
@ -846,10 +841,9 @@ dissect_pim(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
else {
|
||||
proto_tree_add_item(pim_tree, hf_pim_res_bytes, tvb, offset + 1, 1, ENC_NA);
|
||||
}
|
||||
pim_cksum = tvb_get_ntohs(tvb, offset + 2);
|
||||
ticksum = proto_tree_add_item(pim_tree, hf_pim_cksum, tvb, offset + 2, 2, ENC_BIG_ENDIAN);
|
||||
|
||||
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);
|
||||
/*
|
||||
* We don't know this version, so we don't know how much of the
|
||||
* packet the checksum covers.
|
||||
|
@ -891,7 +885,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);
|
||||
computed_cksum = in_cksum(&cksum_vec[0], 1);
|
||||
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);
|
||||
break;
|
||||
case AT_IPv6:
|
||||
/* Set up the fields of the pseudo-header. */
|
||||
|
@ -901,20 +896,16 @@ 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);
|
||||
computed_cksum = in_cksum(&cksum_vec[0], 4);
|
||||
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);
|
||||
break;
|
||||
default:
|
||||
/* PIM is available for IPv4 and IPv6 right now */
|
||||
DISSECTOR_ASSERT_NOT_REACHED();
|
||||
break;
|
||||
}
|
||||
|
||||
if (computed_cksum == 0) {
|
||||
proto_item_append_text(ticksum, " [correct]");
|
||||
|
||||
} else {
|
||||
proto_item_append_text(ticksum, " [incorrect, should be 0x%04x]", in_cksum_shouldbe(pim_cksum, computed_cksum));
|
||||
}
|
||||
} else {
|
||||
proto_tree_add_checksum(pim_tree, tvb, offset+2, hf_pim_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
offset += 4;
|
||||
|
||||
|
|
|
@ -1829,9 +1829,6 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset)
|
|||
{
|
||||
tvbuff_t *next_tvb;
|
||||
gint len, reported_len;
|
||||
int rx_fcs_offset;
|
||||
guint32 rx_fcs_exp;
|
||||
guint32 rx_fcs_got;
|
||||
|
||||
/*
|
||||
* Remove the FCS, if any, from the packet data.
|
||||
|
@ -1880,17 +1877,8 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset)
|
|||
/*
|
||||
* Compute the FCS and put it into the tree.
|
||||
*/
|
||||
rx_fcs_offset = proto_offset + len;
|
||||
rx_fcs_exp = fcs16(tvb);
|
||||
rx_fcs_got = tvb_get_letohs(tvb, rx_fcs_offset);
|
||||
if (rx_fcs_got != rx_fcs_exp) {
|
||||
proto_tree_add_uint_format_value(fh_tree, hf_ppp_fcs_16, tvb, rx_fcs_offset, 2,
|
||||
rx_fcs_got, "0x%04x [incorrect, should be 0x%04x]",
|
||||
rx_fcs_got, rx_fcs_exp);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(fh_tree, hf_ppp_fcs_16, tvb, rx_fcs_offset, 2,
|
||||
rx_fcs_got, "0x%04x [correct]", rx_fcs_got);
|
||||
}
|
||||
proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_ppp_fcs_16, -1, NULL, NULL, fcs16(tvb),
|
||||
ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1931,17 +1919,8 @@ decode_fcs(tvbuff_t *tvb, proto_tree *fh_tree, int fcs_decode, int proto_offset)
|
|||
/*
|
||||
* Compute the FCS and put it into the tree.
|
||||
*/
|
||||
rx_fcs_offset = proto_offset + len;
|
||||
rx_fcs_exp = fcs32(tvb);
|
||||
rx_fcs_got = tvb_get_letohl(tvb, rx_fcs_offset);
|
||||
if (rx_fcs_got != rx_fcs_exp) {
|
||||
proto_tree_add_uint_format_value(fh_tree, hf_ppp_fcs_32, tvb, rx_fcs_offset, 4,
|
||||
rx_fcs_got, "0x%08x [incorrect, should be 0x%08x]",
|
||||
rx_fcs_got, rx_fcs_exp);
|
||||
} else {
|
||||
proto_tree_add_uint_format_value(fh_tree, hf_ppp_fcs_32, tvb, rx_fcs_offset, 4,
|
||||
rx_fcs_got, "0x%08x [correct]", rx_fcs_got);
|
||||
}
|
||||
proto_tree_add_checksum(fh_tree, tvb, proto_offset + len, hf_ppp_fcs_32, -1, NULL, NULL, fcs32(tvb),
|
||||
ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -137,7 +137,6 @@ dissect_quake2_client_commands_move(tvbuff_t *tvb, packet_info *pinfo _U_,
|
|||
#define BUTTON_USE 2
|
||||
#define BUTTON_ANY 128
|
||||
|
||||
guint8 chksum;
|
||||
guint32 lastframe;
|
||||
int i, offset = 0;
|
||||
enum { Q_OFFSET, Q_VALUE, Q_SIZE };
|
||||
|
@ -151,7 +150,6 @@ dissect_quake2_client_commands_move(tvbuff_t *tvb, packet_info *pinfo _U_,
|
|||
guint8 impulse[Q_SIZE];
|
||||
} move[MOVES+1];
|
||||
|
||||
chksum = tvb_get_guint8(tvb, offset);
|
||||
offset++;
|
||||
lastframe = tvb_get_letohl(tvb, offset);
|
||||
offset += 4;
|
||||
|
@ -212,8 +210,7 @@ dissect_quake2_client_commands_move(tvbuff_t *tvb, packet_info *pinfo _U_,
|
|||
if (!tree)
|
||||
return offset;
|
||||
|
||||
proto_tree_add_uint(tree, hf_quake2_game_client_command_move_chksum, tvb,
|
||||
0, 1, chksum);
|
||||
proto_tree_add_checksum(tree, tvb, 0, hf_quake2_game_client_command_move_chksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
proto_tree_add_uint(tree, hf_quake2_game_client_command_move_lframe, tvb,
|
||||
1, 4, lastframe);
|
||||
|
||||
|
|
|
@ -540,8 +540,7 @@ static int hf_rdm_parameter_data = -1;
|
|||
static int hf_rdm_parameter_data_raw = -1;
|
||||
static int hf_rdm_intron = -1;
|
||||
static int hf_rdm_checksum = -1;
|
||||
static int hf_rdm_checksum_good = -1;
|
||||
static int hf_rdm_checksum_bad = -1;
|
||||
static int hf_rdm_checksum_status = -1;
|
||||
static int hf_rdm_trailer = -1;
|
||||
|
||||
static int hf_rdm_pd_device_label = -1;
|
||||
|
@ -2051,9 +2050,7 @@ dissect_rdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
gint padding_size;
|
||||
guint16 man_id;
|
||||
guint32 dev_id;
|
||||
guint message_length, checksum, checksum_shouldbe, offset = 0;
|
||||
proto_item *item;
|
||||
proto_tree *checksum_tree;
|
||||
guint message_length, offset = 0;
|
||||
|
||||
proto_tree *ti = proto_tree_add_item(tree, proto_rdm, tvb,
|
||||
offset, -1, ENC_NA);
|
||||
|
@ -2096,32 +2093,8 @@ dissect_rdm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)
|
|||
offset += padding_size;
|
||||
}
|
||||
|
||||
checksum_shouldbe = rdm_checksum(tvb, offset);
|
||||
checksum = tvb_get_ntohs(tvb, offset);
|
||||
item = proto_tree_add_item(rdm_tree, hf_rdm_checksum, tvb,
|
||||
offset, 2, ENC_BIG_ENDIAN);
|
||||
if (checksum == checksum_shouldbe) {
|
||||
proto_item_append_text(item, " [correct]");
|
||||
|
||||
checksum_tree = proto_item_add_subtree(item, ett_rdm);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_rdm_checksum_good, tvb,
|
||||
offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_rdm_checksum_bad, tvb,
|
||||
offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
} else {
|
||||
proto_item_append_text(item, " [incorrect, should be 0x%04x]", checksum_shouldbe);
|
||||
|
||||
checksum_tree = proto_item_add_subtree(item, ett_rdm);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_rdm_checksum_good, tvb,
|
||||
offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_rdm_checksum_bad, tvb,
|
||||
offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(rdm_tree, tvb, offset, hf_rdm_checksum, hf_rdm_checksum_status, NULL, pinfo, rdm_checksum(tvb, offset),
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
offset += 2;
|
||||
|
||||
if (offset < tvb_reported_length(tvb))
|
||||
|
@ -2220,15 +2193,10 @@ proto_register_rdm(void)
|
|||
FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_rdm_checksum_good,
|
||||
{ "Good Checksum", "rdm.checksum_good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content", HFILL }},
|
||||
|
||||
{ &hf_rdm_checksum_bad,
|
||||
{ "Bad Checksum", "rdm.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content", HFILL }},
|
||||
{ &hf_rdm_checksum_status,
|
||||
{ "Checksum Status", "rdm.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_rdm_trailer,
|
||||
{ "Trailer", "rdm.trailer",
|
||||
|
|
|
@ -137,15 +137,13 @@ dissect_pn532_hci(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *dat
|
|||
call_dissector_with_data(pn532_handle, next_tvb, pinfo, tree, usb_conv_info);
|
||||
offset += length;
|
||||
|
||||
proto_tree_add_item(main_tree, hf_data_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
checksum = tvb_get_guint8(tvb, offset);
|
||||
while (length) {
|
||||
checksum += tvb_get_guint8(tvb, offset - length);
|
||||
length -= 1;
|
||||
}
|
||||
if (checksum != 0) {
|
||||
proto_tree_add_expert(main_tree, pinfo, &ei_invalid_data_checksum, tvb, offset, 1);
|
||||
}
|
||||
proto_tree_add_checksum(main_tree, tvb, offset, hf_data_checksum, -1, &ei_invalid_data_checksum, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_ZERO);
|
||||
offset += 1;
|
||||
} else { /* Normal Information Frame */
|
||||
col_set_str(pinfo->cinfo, COL_INFO, "Normal Information Frame");
|
||||
|
|
|
@ -39,7 +39,7 @@ static int proto_rgmp = -1;
|
|||
static int hf_type = -1;
|
||||
static int hf_reserved = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
static int hf_maddr = -1;
|
||||
|
||||
static int ett_rgmp = -1;
|
||||
|
@ -86,7 +86,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_bad, pinfo, 0);
|
||||
igmp_checksum(tree, tvb, hf_checksum, hf_checksum_status, pinfo, 0);
|
||||
offset += 2;
|
||||
|
||||
proto_tree_add_item(tree, hf_maddr, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
|
@ -115,9 +115,9 @@ proto_register_rgmp(void)
|
|||
NULL, 0, NULL, HFILL }
|
||||
},
|
||||
|
||||
{ &hf_checksum_bad,
|
||||
{ "Bad Checksum", "rgmp.checksum_bad", FT_BOOLEAN, BASE_NONE,
|
||||
NULL, 0x0, NULL, HFILL }
|
||||
{ &hf_checksum_status,
|
||||
{ "Checksum Status", "rgmp.checksum.status", FT_UINT8, BASE_NONE,
|
||||
VALS(proto_checksum_vals), 0x0, NULL, HFILL }
|
||||
},
|
||||
|
||||
{ &hf_maddr,
|
||||
|
|
|
@ -1461,7 +1461,7 @@ dissect_rohc_ir_rtp_profile_dynamic(tvbuff_t *tvb, packet_info *pinfo, proto_tre
|
|||
dynamic_udp_tree = proto_item_add_subtree(root_ti, ett_rohc_dynamic_udp);
|
||||
id = tvb_get_ntohs(tvb, offset);
|
||||
rohc_cid_context->udp_checksum_present = id ? TRUE : FALSE;
|
||||
proto_tree_add_item(dynamic_udp_tree, hf_rohc_dynamic_udp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(dynamic_udp_tree, tvb, offset, hf_rohc_dynamic_udp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset +=2;
|
||||
proto_item_set_len(item, offset - start_offset);
|
||||
}
|
||||
|
@ -2334,7 +2334,7 @@ start_over:
|
|||
|
||||
/* UDP Checksum */
|
||||
if (rohc_cid_context->udp_checksum_present) {
|
||||
proto_tree_add_item(rohc_tree, hf_rohc_udp_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(rohc_tree, tvb, offset, hf_rohc_udp_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -116,7 +116,9 @@ static void dissect_roofnet_header(proto_tree *tree, tvbuff_t *tvb, guint *offse
|
|||
ptvcursor_add(cursor, hf_roofnet_nlinks, 1, ENC_BIG_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_roofnet_next, 1, ENC_BIG_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_roofnet_ttl, 2, ENC_BIG_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_roofnet_cksum, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(ptvcursor_tree(cursor), ptvcursor_tvbuff(cursor), ptvcursor_current_offset(cursor),
|
||||
hf_roofnet_cksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
ptvcursor_advance(cursor, 2);
|
||||
ptvcursor_add(cursor, hf_roofnet_flags, 2, ENC_BIG_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_roofnet_data_length, 2, ENC_BIG_ENDIAN);
|
||||
ptvcursor_add(cursor, hf_roofnet_query_dst, 4, ENC_BIG_ENDIAN);
|
||||
|
|
|
@ -2528,7 +2528,7 @@ static int hf_rtp_midi_controller_value = -1;
|
|||
static int hf_rtp_midi_program = -1;
|
||||
static int hf_rtp_midi_channel_pressure = -1;
|
||||
static int hf_rtp_midi_pitch_bend = -1;
|
||||
static int hf_rtp_midi_pitch_bend_truncated = -1;
|
||||
/* static int hf_rtp_midi_pitch_bend_truncated = -1; */
|
||||
|
||||
static int hf_rtp_midi_manu_short = -1;
|
||||
static int hf_rtp_midi_manu_long = -1;
|
||||
|
@ -2733,7 +2733,7 @@ static int hf_rtp_midi_sj_chapter_x_invalid_data = -1;
|
|||
|
||||
static int hf_rtp_midi_quarter_frame_type = -1;
|
||||
static int hf_rtp_midi_quarter_frame_value = -1;
|
||||
static int hf_rtp_midi_spp_truncated = -1;
|
||||
/* static int hf_rtp_midi_spp_truncated = -1; */
|
||||
static int hf_rtp_midi_spp = -1;
|
||||
static int hf_rtp_midi_song_select = -1;
|
||||
static int hf_rtp_midi_manu_data = -1;
|
||||
|
@ -3515,7 +3515,7 @@ decode_sysex_common_nrt_fd( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
|
|||
offset += ( data_len - 1 );
|
||||
}
|
||||
|
||||
proto_tree_add_item( tree, hf_rtp_midi_sysex_common_nrt_fd_checksum, tvb, offset, 1, ENC_BIG_ENDIAN );
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_rtp_midi_sysex_common_nrt_fd_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset++;
|
||||
|
||||
} else if ( sub_id == RTP_MIDI_SYSEX_COMMON_NRT_FD_REQUEST ) {
|
||||
|
@ -3589,7 +3589,7 @@ decode_sysex_common_tuning( tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *t
|
|||
}
|
||||
|
||||
/* checksum */
|
||||
proto_tree_add_item( tree, hf_rtp_midi_sysex_common_tune_checksum, tvb, offset, 1, ENC_BIG_ENDIAN );
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_rtp_midi_sysex_common_tune_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset++;
|
||||
|
||||
} else if ( sub_id == RTP_MIDI_SYSEX_COMMON_TUNING_NOTE_CHANGE ) {
|
||||
|
@ -6599,6 +6599,7 @@ proto_register_rtp_midi( void )
|
|||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
#if 0
|
||||
{
|
||||
&hf_rtp_midi_pitch_bend_truncated,
|
||||
{
|
||||
|
@ -6611,6 +6612,7 @@ proto_register_rtp_midi( void )
|
|||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
#endif
|
||||
{
|
||||
&hf_rtp_midi_manu_short,
|
||||
{
|
||||
|
@ -8939,6 +8941,7 @@ proto_register_rtp_midi( void )
|
|||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
#if 0
|
||||
{
|
||||
&hf_rtp_midi_spp_truncated,
|
||||
{
|
||||
|
@ -8951,6 +8954,7 @@ proto_register_rtp_midi( void )
|
|||
NULL, HFILL
|
||||
}
|
||||
},
|
||||
#endif
|
||||
{
|
||||
&hf_rtp_midi_song_select,
|
||||
{
|
||||
|
|
|
@ -5477,8 +5477,8 @@ static gboolean dissect_parameter_sequence_v1(proto_tree *rtps_parameter_tree, p
|
|||
|
||||
case PID_TYPE_CHECKSUM:
|
||||
ENSURE_LENGTH(4);
|
||||
proto_tree_add_item(rtps_parameter_tree, hf_rtps_type_checksum, tvb, offset, 4,
|
||||
little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(rtps_parameter_tree, tvb, offset, hf_rtps_type_checksum, -1, NULL, pinfo, 0,
|
||||
little_endian ? ENC_LITTLE_ENDIAN : ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
break;
|
||||
|
||||
case PID_EXPECTS_ACK:
|
||||
|
|
|
@ -116,7 +116,7 @@ dissect_rudp(tvbuff_t *tvb, packet_info *pinfo _U_ , proto_tree *tree, void* dat
|
|||
|
||||
/* If the header is more than 4 bytes the next 2 bytes are the checksum */
|
||||
if (hlen > 4) {
|
||||
proto_tree_add_item(rudp_tree, hf_rudp_cksum, tvb, 4, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(rudp_tree, tvb, 4, hf_rudp_cksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
/* If we have even more bytes their meaning is unknown - we have seen this
|
||||
|
|
|
@ -4438,7 +4438,7 @@ s7comm_decode_ud_block_subfunc(tvbuff_t *tvb,
|
|||
offset += 1;
|
||||
proto_tree_add_item(data_tree, hf_s7comm_ud_blockinfo_res_unknown, tvb, offset, 1, ENC_NA);
|
||||
offset += 1;
|
||||
proto_tree_add_item(data_tree, hf_s7comm_ud_blockinfo_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(data_tree, tvb, offset, hf_s7comm_ud_blockinfo_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
offset += 2;
|
||||
proto_tree_add_item(data_tree, hf_s7comm_ud_blockinfo_reserved1, tvb, offset, 4, ENC_BIG_ENDIAN);
|
||||
offset += 4;
|
||||
|
|
|
@ -240,7 +240,7 @@ static int hf_sbus_week_day = -1;
|
|||
static int hf_sbus_date = -1;
|
||||
static int hf_sbus_time = -1;
|
||||
static int hf_sbus_crc = -1;
|
||||
static int hf_sbus_crc_bad = -1;
|
||||
static int hf_sbus_crc_status = -1;
|
||||
static int hf_sbus_flags_accu = -1;
|
||||
static int hf_sbus_flags_error = -1;
|
||||
static int hf_sbus_flags_negative = -1;
|
||||
|
@ -650,7 +650,7 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
{
|
||||
|
||||
/* Set up structures needed to add the protocol subtree and manage it */
|
||||
proto_item *ti, *hi, *cs;
|
||||
proto_item *ti, *hi;
|
||||
proto_tree *sbus_tree, *ethsbus_tree, *sbusdata_tree;
|
||||
|
||||
gint i; /*for CRC calculation*/
|
||||
|
@ -1855,22 +1855,9 @@ dissect_sbus(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_
|
|||
sbus_crc_calc = 0;
|
||||
for (i = 0; i < sbus_eth_len - 2; i++)
|
||||
sbus_crc_calc = crc_calc (sbus_crc_calc, tvb_get_guint8(tvb, i));
|
||||
/*Show CRC and add hidden item for wrong CRC*/
|
||||
sbus_helper = tvb_get_ntohs(tvb, offset);
|
||||
if (sbus_helper == sbus_crc_calc) {
|
||||
proto_tree_add_uint_format_value(sbus_tree,
|
||||
hf_sbus_crc, tvb, offset, 2, sbus_helper,
|
||||
"0x%04x (correct)", sbus_helper);
|
||||
} else {
|
||||
cs = proto_tree_add_uint_format_value(sbus_tree,
|
||||
hf_sbus_crc, tvb, offset, 2, sbus_helper,
|
||||
"0x%04x (NOT correct)", sbus_helper);
|
||||
expert_add_info(pinfo, cs, &ei_sbus_crc_bad);
|
||||
hi = proto_tree_add_boolean(sbus_tree,
|
||||
hf_sbus_crc_bad, tvb, offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hi);
|
||||
PROTO_ITEM_SET_GENERATED(hi);
|
||||
}
|
||||
|
||||
proto_tree_add_checksum(sbus_tree, tvb, offset, hf_sbus_crc, hf_sbus_crc_status, &ei_sbus_crc_bad, pinfo, sbus_crc_calc,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
offset += 2; /*now at the end of the telegram*/
|
||||
}
|
||||
return offset;
|
||||
|
@ -2231,10 +2218,10 @@ proto_register_sbus(void)
|
|||
"CRC 16", HFILL }
|
||||
},
|
||||
|
||||
{ &hf_sbus_crc_bad,
|
||||
{ "Bad Checksum", "sbus.crc_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"A bad checksum in the telegram", HFILL }},
|
||||
{ &hf_sbus_crc_status,
|
||||
{ "Checksum Status", "sbus.crc.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }},
|
||||
|
||||
{ &hf_sbus_flags_accu,
|
||||
{ "ACCU", "sbus.flags.accu",
|
||||
|
|
|
@ -94,7 +94,9 @@ static int hf_source_port = -1;
|
|||
static int hf_destination_port = -1;
|
||||
static int hf_verification_tag = -1;
|
||||
static int hf_checksum = -1;
|
||||
static int hf_checksum_bad = -1;
|
||||
static int hf_checksum_adler = -1;
|
||||
static int hf_checksum_crc32c = -1;
|
||||
static int hf_checksum_status = -1;
|
||||
|
||||
static int hf_chunk_type = -1;
|
||||
static int hf_chunk_flags = -1;
|
||||
|
@ -272,7 +274,6 @@ static int exported_pdu_tap = -1;
|
|||
|
||||
/* Initialize the subtree pointers */
|
||||
static gint ett_sctp = -1;
|
||||
static gint ett_sctp_checksum = -1;
|
||||
static gint ett_sctp_chunk = -1;
|
||||
static gint ett_sctp_chunk_parameter = -1;
|
||||
static gint ett_sctp_chunk_cause = -1;
|
||||
|
@ -4573,8 +4574,8 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
|
|||
guint16 source_port, destination_port;
|
||||
guint captured_length, reported_length;
|
||||
gboolean crc32c_correct = FALSE, adler32_correct = FALSE;
|
||||
proto_item *sctp_item, *hidden_item, *item;
|
||||
proto_tree *sctp_tree, *checksum_tree;
|
||||
proto_item *sctp_item, *hidden_item;
|
||||
proto_tree *sctp_tree;
|
||||
guint32 vtag;
|
||||
sctp_half_assoc_t *ha = NULL;
|
||||
proto_item *pi, *vt = NULL;
|
||||
|
@ -4654,58 +4655,36 @@ dissect_sctp_packet(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gboolea
|
|||
|
||||
switch(sctp_checksum) {
|
||||
case SCTP_CHECKSUM_NONE:
|
||||
proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum, "0x%08x (not verified)", checksum);
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
break;
|
||||
case SCTP_CHECKSUM_ADLER32:
|
||||
if (adler32_correct)
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH,
|
||||
checksum, "0x%08x [correct Adler32]", checksum);
|
||||
else {
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum,
|
||||
"0x%08x [incorrect Adler32, should be 0x%08x]",
|
||||
checksum, calculated_adler32);
|
||||
expert_add_info(pinfo, item, &ei_sctp_bad_sctp_checksum);
|
||||
}
|
||||
checksum_tree = proto_item_add_subtree(item, ett_sctp_checksum);
|
||||
proto_tree_add_boolean(checksum_tree, hf_checksum_bad, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, !(adler32_correct));
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum_adler, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, calculated_adler32,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
break;
|
||||
case SCTP_CHECKSUM_CRC32C:
|
||||
if (crc32c_correct)
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH,
|
||||
checksum, "0x%08x [correct CRC32C]", checksum);
|
||||
else {
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum,
|
||||
"0x%08x [incorrect CRC32C, should be 0x%08x]",
|
||||
checksum, calculated_crc32c);
|
||||
expert_add_info(pinfo, item, &ei_sctp_bad_sctp_checksum);
|
||||
}
|
||||
checksum_tree = proto_item_add_subtree(item, ett_sctp_checksum);
|
||||
proto_tree_add_boolean(checksum_tree, hf_checksum_bad, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, !(crc32c_correct));
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum_crc32c, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, calculated_crc32c,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
break;
|
||||
case SCTP_CHECKSUM_AUTOMATIC:
|
||||
if ((adler32_correct) && !(crc32c_correct))
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH,
|
||||
checksum, "0x%08x [correct Adler32]", checksum);
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum_adler, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, calculated_adler32,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
else if ((!adler32_correct) && (crc32c_correct))
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH,
|
||||
checksum, "0x%08x [correct CRC32C]", checksum);
|
||||
else if ((adler32_correct) && (crc32c_correct))
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH,
|
||||
checksum, "0x%08x [correct Adler32 and CRC32C]", checksum);
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum_crc32c, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, calculated_crc32c,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
else {
|
||||
item = proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, checksum,
|
||||
"0x%08x [incorrect, should be 0x%08x (Adler32) or 0x%08x (CRC32C)]",
|
||||
checksum, calculated_adler32, calculated_crc32c);
|
||||
expert_add_info(pinfo, item, &ei_sctp_bad_sctp_checksum);
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum_adler, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, calculated_adler32,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum_crc32c, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, calculated_crc32c,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
checksum_tree = proto_item_add_subtree(item, ett_sctp_checksum);
|
||||
proto_tree_add_boolean(checksum_tree, hf_checksum_bad, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH, !(crc32c_correct || adler32_correct));
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* We don't have the whole packet so we can't verify the checksum */
|
||||
proto_tree_add_uint_format_value(sctp_tree, hf_checksum, tvb, CHECKSUM_OFFSET, CHECKSUM_LENGTH,
|
||||
checksum, "0x%08x [unchecked, not all data available]", checksum);
|
||||
proto_tree_add_checksum(sctp_tree, tvb, CHECKSUM_OFFSET, hf_checksum, hf_checksum_status, &ei_sctp_bad_sctp_checksum, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
/* add all chunks of the sctp datagram to the protocol tree */
|
||||
|
@ -4789,7 +4768,9 @@ proto_register_sctp(void)
|
|||
{ &hf_port, { "Port", "sctp.port", FT_UINT16, BASE_PT_SCTP, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_verification_tag, { "Verification tag", "sctp.verification_tag", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_checksum, { "Checksum", "sctp.checksum", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_checksum_bad, { "Bad checksum", "sctp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_checksum_adler, { "Checksum (Adler)", "sctp.checksum", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_checksum_crc32c, { "Checksum (CRC32C)", "sctp.checksum", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_checksum_status, { "Checksum Status", "sctp.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL } },
|
||||
{ &hf_chunk_type, { "Chunk type", "sctp.chunk_type", FT_UINT8, BASE_DEC, VALS(chunk_type_values), 0x0, NULL, HFILL } },
|
||||
{ &hf_chunk_flags, { "Chunk flags", "sctp.chunk_flags", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL } },
|
||||
{ &hf_chunk_bit_1, { "Bit", "sctp.chunk_bit_1", FT_BOOLEAN, 8, TFS(&sctp_chunk_bit_1_value), SCTP_CHUNK_BIT_1, NULL, HFILL } },
|
||||
|
@ -4944,7 +4925,6 @@ proto_register_sctp(void)
|
|||
/* Setup protocol subtree array */
|
||||
static gint *ett[] = {
|
||||
&ett_sctp,
|
||||
&ett_sctp_checksum,
|
||||
&ett_sctp_chunk,
|
||||
&ett_sctp_chunk_parameter,
|
||||
&ett_sctp_chunk_cause,
|
||||
|
|
|
@ -1103,10 +1103,9 @@ dissect_relaydef_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
|
|||
offset += 1;
|
||||
}
|
||||
|
||||
proto_tree_add_item(relaydef_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(relaydef_tree, tvb, offset, hf_selfm_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
|
||||
}
|
||||
|
||||
/******************************************************************************************************/
|
||||
|
@ -1208,7 +1207,7 @@ dissect_fmconfig_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
|
|||
offset += 1;
|
||||
}
|
||||
|
||||
proto_tree_add_item(fmconfig_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(fmconfig_tree, tvb, offset, hf_selfm_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
|
||||
|
@ -1424,7 +1423,7 @@ dissect_fmdata_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int of
|
|||
offset += 1;
|
||||
}
|
||||
|
||||
proto_tree_add_item(fmdata_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
proto_tree_add_checksum(fmdata_tree, tvb, offset, hf_selfm_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
} /* matching config frame message was found */
|
||||
|
||||
|
@ -1517,8 +1516,7 @@ dissect_foconfig_frame(tvbuff_t *tvb, proto_tree *tree, int offset)
|
|||
offset += 1;
|
||||
}
|
||||
|
||||
proto_tree_add_item(foconfig_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
|
||||
proto_tree_add_checksum(foconfig_tree, tvb, offset, hf_selfm_checksum, -1, NULL, NULL, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
|
||||
|
@ -1606,8 +1604,8 @@ dissect_fastop_frame(tvbuff_t *tvb, proto_tree *tree, packet_info *pinfo, int of
|
|||
proto_tree_add_item(fastop_tree, hf_selfm_fastop_valid, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
offset += 1;
|
||||
|
||||
/* Add checksum */
|
||||
proto_tree_add_item(fastop_tree, hf_selfm_checksum, tvb, offset, 1, ENC_BIG_ENDIAN);
|
||||
/* Add checksum */
|
||||
proto_tree_add_checksum(fastop_tree, tvb, offset, hf_selfm_checksum, -1, NULL, pinfo, 0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
|
||||
return tvb_reported_length(tvb);
|
||||
|
||||
|
|
|
@ -102,8 +102,7 @@ static int hf_shim6_ct = -1;
|
|||
static int hf_shim6_type = -1;
|
||||
static int hf_shim6_proto = -1;
|
||||
static int hf_shim6_checksum = -1;
|
||||
static int hf_shim6_checksum_bad = -1;
|
||||
static int hf_shim6_checksum_good = -1;
|
||||
static int hf_shim6_checksum_status= -1;
|
||||
static int hf_shim6_inonce = -1; /* also for request nonce */
|
||||
static int hf_shim6_rnonce = -1;
|
||||
static int hf_shim6_reserved = -1;
|
||||
|
@ -563,26 +562,6 @@ static const value_string shimctrlvals[] = {
|
|||
{ 0, NULL }
|
||||
};
|
||||
|
||||
static void
|
||||
add_shim6_checksum_additional_info(tvbuff_t * tvb, packet_info * pinfo,
|
||||
proto_item * it_cksum, int offset, gboolean is_cksum_correct)
|
||||
{
|
||||
proto_tree *checksum_tree;
|
||||
proto_item *item;
|
||||
|
||||
checksum_tree = proto_item_add_subtree(it_cksum, ett_shim6_cksum);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_shim6_checksum_good, tvb,
|
||||
offset, 2, is_cksum_correct);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_shim6_checksum_bad, tvb,
|
||||
offset, 2, !is_cksum_correct);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
if (!is_cksum_correct) {
|
||||
expert_add_info(pinfo, item, &ei_shim6_checksum_bad);
|
||||
col_append_str(pinfo->cinfo, COL_INFO, " [Shim6 CHECKSUM INCORRECT]");
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
dissect_shim6(tvbuff_t *tvb, packet_info * pinfo, proto_tree *tree, void* data _U_)
|
||||
{
|
||||
|
@ -656,17 +635,10 @@ dissect_shim6(tvbuff_t *tvb, packet_info * pinfo, proto_tree *tree, void* data _
|
|||
|
||||
/* Checksum */
|
||||
csum = shim6_checksum(tvb, offset, len);
|
||||
|
||||
if (csum == 0) {
|
||||
ti = proto_tree_add_uint_format_value(shim_tree, hf_shim6_checksum, tvb, p, 2,
|
||||
tvb_get_ntohs(tvb, p), "0x%04x [correct]", tvb_get_ntohs(tvb, p));
|
||||
add_shim6_checksum_additional_info(tvb, pinfo, ti, p, TRUE);
|
||||
} else {
|
||||
ti = proto_tree_add_uint_format_value(shim_tree, hf_shim6_checksum, tvb, p, 2,
|
||||
tvb_get_ntohs(tvb, p), "0x%04x [incorrect: should be 0x%04x]",
|
||||
tvb_get_ntohs(tvb, p), in_cksum_shouldbe(tvb_get_ntohs(tvb, p), csum));
|
||||
add_shim6_checksum_additional_info(tvb, pinfo, ti, p, FALSE);
|
||||
}
|
||||
proto_tree_add_checksum(shim_tree, tvb, p, hf_shim6_checksum, hf_shim6_checksum_status, &ei_shim6_checksum_bad, pinfo, csum,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY|PROTO_CHECKSUM_IN_CKSUM);
|
||||
if (csum != 0)
|
||||
col_append_str(pinfo->cinfo, COL_INFO, " [Shim6 CHECKSUM INCORRECT]");
|
||||
p += 2;
|
||||
|
||||
/* Type specific data */
|
||||
|
@ -726,14 +698,9 @@ proto_register_shim6(void)
|
|||
FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
"Shim6 Checksum", HFILL }
|
||||
},
|
||||
{ &hf_shim6_checksum_bad,
|
||||
{ "Bad Checksum", "shim6.checksum_bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"Shim6 Bad Checksum", HFILL }
|
||||
},
|
||||
{ &hf_shim6_checksum_good,
|
||||
{ "Good Checksum", "shim6.checksum_good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
{ &hf_shim6_checksum_status,
|
||||
{ "Checksum Status", "shim6.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }
|
||||
},
|
||||
{ &hf_shim6_inonce,
|
||||
|
|
|
@ -247,7 +247,7 @@ static gint hf_simple_status_link11_pu = -1;
|
|||
static gint hf_simple_status_link11_dts_host_status = -1;
|
||||
static gint hf_simple_status_spare_3 = -1;
|
||||
static gint hf_simple_checksum = -1;
|
||||
static gint hf_simple_checksum_bad = -1;
|
||||
static gint hf_simple_checksum_status = -1;
|
||||
|
||||
static gint ett_simple = -1;
|
||||
static gint ett_packet = -1;
|
||||
|
@ -409,10 +409,6 @@ static void dissect_simple_status(tvbuff_t *tvb, packet_info *pinfo, proto_tree
|
|||
|
||||
static void dissect_checksum(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, gint offset)
|
||||
{
|
||||
gint checksum = tvb_get_letohs(tvb, offset);
|
||||
proto_item *checksum_item = proto_tree_add_item(tree, hf_simple_checksum, tvb, offset, 2, ENC_BIG_ENDIAN);
|
||||
proto_item *hidden_item;
|
||||
|
||||
const guint8 * v = tvb_get_ptr(tvb, 0, offset);
|
||||
guint16 expected_checksum = 0;
|
||||
gint i;
|
||||
|
@ -420,17 +416,8 @@ static void dissect_checksum(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree
|
|||
for (i = 0; i < offset; i++)
|
||||
expected_checksum += v[i];
|
||||
|
||||
if (checksum == expected_checksum) {
|
||||
hidden_item = proto_tree_add_boolean(tree, hf_simple_checksum_bad, tvb, offset, 2, FALSE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_item_append_text(checksum_item, " [correct]");
|
||||
} else {
|
||||
hidden_item = proto_tree_add_boolean(tree, hf_simple_checksum_bad, tvb, offset, 2, TRUE);
|
||||
PROTO_ITEM_SET_HIDDEN(hidden_item);
|
||||
proto_item_append_text(checksum_item, " [incorrect, should be 0x%04x]", expected_checksum);
|
||||
expert_add_info_format(pinfo, checksum_item, &ei_simple_checksum_bad,
|
||||
"SIMPLE Checksum Incorrect, should be 0x%04x", expected_checksum);
|
||||
}
|
||||
proto_tree_add_checksum(tree, tvb, offset, hf_simple_checksum, hf_simple_checksum_status, &ei_simple_checksum_bad, pinfo, expected_checksum,
|
||||
ENC_LITTLE_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
|
||||
static int dissect_simple(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)
|
||||
|
@ -669,8 +656,8 @@ void proto_register_simple(void)
|
|||
{ &hf_simple_checksum,
|
||||
{ "Checksum", "simple.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
NULL, HFILL }},
|
||||
{ &hf_simple_checksum_bad,
|
||||
{ "Bad Checksum", "simple.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
{ &hf_simple_checksum_status,
|
||||
{ "Checksum Status", "simple.checksum.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL }}
|
||||
};
|
||||
static gint *ett[] = {
|
||||
|
|
|
@ -93,6 +93,7 @@ static int hf_sml_datatype = -1;
|
|||
static int hf_sml_abortOnError = -1;
|
||||
static int hf_sml_MessageBody = -1;
|
||||
static int hf_sml_crc16 = -1;
|
||||
static int hf_sml_crc16_status = -1;
|
||||
static int hf_sml_endOfSmlMsg = -1;
|
||||
static int hf_sml_end = -1;
|
||||
static int hf_sml_codepage = -1;
|
||||
|
@ -2391,31 +2392,22 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr
|
|||
proto_tree_add_item (crc16_tree, hf_sml_datatype, tvb, *offset, 1, ENC_BIG_ENDIAN);
|
||||
*offset+=1;
|
||||
|
||||
crc16 = proto_tree_add_item (crc16_tree, hf_sml_crc16, tvb, *offset, data, ENC_BIG_ENDIAN);
|
||||
*offset+=data;
|
||||
|
||||
if (sml_crc_enabled) {
|
||||
crc_msg_len = (*offset - crc_msg_len - data - 1);
|
||||
crc_check = crc16_ccitt_tvb_offset(tvb, (*offset - crc_msg_len - data - 1), crc_msg_len);
|
||||
crc_ref = tvb_get_letohs(tvb, *offset-2);
|
||||
crc_msg_len = (*offset - crc_msg_len - 1);
|
||||
crc_check = crc16_ccitt_tvb_offset(tvb, (*offset - crc_msg_len - 1), crc_msg_len);
|
||||
|
||||
if (data == 1){
|
||||
crc_ref = crc_ref & 0xFF00;
|
||||
}
|
||||
|
||||
if (crc_check == crc_ref) {
|
||||
proto_item_append_text(crc16, " [CRC Okay]");
|
||||
}
|
||||
else {
|
||||
/*(little to big endian convert) to display in correct order*/
|
||||
crc_check = ((crc_check >> 8) & 0xFF) + ((crc_check << 8 & 0xFF00));
|
||||
proto_item_append_text(crc16, " [CRC Bad 0x%X]", crc_check);
|
||||
expert_add_info(pinfo, crc16, &ei_sml_crc_error);
|
||||
}
|
||||
proto_tree_add_checksum(crc16_tree, tvb, *offset, hf_sml_crc16, hf_sml_crc16_status, &ei_sml_crc_error, pinfo, crc_check,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
else {
|
||||
proto_item_append_text(crc16, " [CRC validation disabled]");
|
||||
proto_tree_add_checksum(crc16_tree, tvb, *offset, hf_sml_crc16, hf_sml_crc16_status, &ei_sml_crc_error, pinfo, 0,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
*offset+=data;
|
||||
|
||||
/*Message END*/
|
||||
if (tvb_get_guint8 (tvb, *offset) == 0){
|
||||
|
@ -2477,27 +2469,19 @@ static void dissect_sml_file(tvbuff_t *tvb, packet_info *pinfo, gint *offset, pr
|
|||
*offset+=1;
|
||||
proto_tree_add_item (msgend_tree, hf_sml_padding, tvb, *offset, 1, ENC_NA);
|
||||
*offset+=1;
|
||||
crc16 = proto_tree_add_item (msgend_tree, hf_sml_crc16, tvb, *offset, 2, ENC_BIG_ENDIAN);
|
||||
*offset+=2;
|
||||
|
||||
if (sml_crc_enabled && sml_reassemble){
|
||||
crc_file_len = *offset - crc_file_len - 2;
|
||||
crc_check = crc16_ccitt_tvb_offset(tvb,*offset-crc_file_len-2, crc_file_len);
|
||||
crc_ref = tvb_get_letohs(tvb, *offset-2);
|
||||
crc_file_len = *offset - crc_file_len;
|
||||
crc_check = crc16_ccitt_tvb_offset(tvb,*offset-crc_file_len, crc_file_len);
|
||||
|
||||
if (crc_check == crc_ref){
|
||||
proto_item_append_text(crc16, " [CRC Okay]");
|
||||
}
|
||||
else{
|
||||
/*(little to big endian convert) to display in correct order*/
|
||||
crc_check = ((crc_check >> 8) & 0xFF) + ((crc_check << 8) & 0xFF00);
|
||||
proto_item_append_text(crc16, " [CRC Bad 0x%X]", crc_check);
|
||||
expert_add_info_format(pinfo, msgend, &ei_sml_crc_error, "CRC error (messages not reassembled ?)");
|
||||
}
|
||||
proto_tree_add_checksum(msgend_tree, tvb, *offset, hf_sml_crc16, hf_sml_crc16_status, &ei_sml_crc_error, pinfo, crc_check,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
}
|
||||
else {
|
||||
proto_item_append_text(crc16, " [CRC validation disabled]");
|
||||
proto_tree_add_checksum(msgend_tree, tvb, *offset, hf_sml_crc16, hf_sml_crc16_status, &ei_sml_crc_error, pinfo, crc_check,
|
||||
ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
*offset+=2;
|
||||
|
||||
available = tvb_reported_length_remaining(tvb, *offset);
|
||||
if (available <= 0){
|
||||
|
@ -2556,6 +2540,8 @@ void proto_register_sml (void) {
|
|||
{ "SML Version", "sml.version", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_sml_crc16,
|
||||
{ "CRC16", "sml.crc", FT_UINT16, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_sml_crc16_status,
|
||||
{ "CRC16 Status", "sml.crc.status", FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0, NULL, HFILL }},
|
||||
{ &hf_sml_endOfSmlMsg,
|
||||
{ "End of SML Msg", "sml.end", FT_UINT8, BASE_HEX, NULL, 0x0, NULL, HFILL }},
|
||||
{ &hf_sml_transactionId,
|
||||
|
|
|
@ -74,9 +74,7 @@ static int hf_stt_pkt_len = -1;
|
|||
static int hf_stt_seg_off = -1;
|
||||
static int hf_stt_pkt_id = -1;
|
||||
static int hf_stt_checksum = -1;
|
||||
static int hf_stt_checksum_bad = -1;
|
||||
static int hf_stt_checksum_good = -1;
|
||||
static int hf_stt_checksum_calculated = -1;
|
||||
static int hf_stt_checksum_status = -1;
|
||||
static int hf_stt_tcp_data = -1;
|
||||
static int hf_stt_tcp_data_offset = -1;
|
||||
static int hf_stt_tcp_flags = -1;
|
||||
|
@ -122,7 +120,6 @@ static int hf_reassembled_in = -1;
|
|||
static int hf_reassembled_length = -1;
|
||||
|
||||
static int ett_stt = -1;
|
||||
static int ett_stt_checksum = -1;
|
||||
static int ett_stt_tcp_data = -1;
|
||||
static int ett_stt_tcp_flags = -1;
|
||||
static int ett_stt_flgs = -1;
|
||||
|
@ -221,18 +218,7 @@ handle_segment(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree,
|
|||
static void
|
||||
dissect_stt_checksum(tvbuff_t *tvb, packet_info *pinfo, proto_tree *stt_tree)
|
||||
{
|
||||
proto_tree *checksum_tree;
|
||||
proto_item *item;
|
||||
guint16 checksum = tvb_get_ntohs(tvb, 16);
|
||||
gboolean can_checksum;
|
||||
guint16 computed_cksum;
|
||||
gboolean checksum_good = FALSE, checksum_bad = FALSE;
|
||||
|
||||
item = proto_tree_add_uint_format_value(stt_tree, hf_stt_checksum,
|
||||
tvb, 16, 2, checksum,
|
||||
"0x%04x", checksum);
|
||||
|
||||
can_checksum = !pinfo->fragmented &&
|
||||
gboolean can_checksum = !pinfo->fragmented &&
|
||||
tvb_bytes_exist(tvb, 0, tvb_reported_length(tvb));
|
||||
|
||||
if (can_checksum && pref_check_checksum) {
|
||||
|
@ -262,41 +248,13 @@ dissect_stt_checksum(tvbuff_t *tvb, packet_info *pinfo, proto_tree *stt_tree)
|
|||
break;
|
||||
}
|
||||
SET_CKSUM_VEC_TVB(cksum_vec[3], tvb, 0, tvb_reported_length(tvb));
|
||||
computed_cksum = in_cksum(cksum_vec, 4);
|
||||
|
||||
checksum_good = (computed_cksum == 0);
|
||||
checksum_bad = !checksum_good;
|
||||
|
||||
if (checksum_good) {
|
||||
proto_item_append_text(item, " [correct]");
|
||||
} else if (checksum_bad) {
|
||||
guint16 expected_cksum = in_cksum_shouldbe(checksum, computed_cksum);
|
||||
|
||||
proto_item_append_text(item, " [incorrect, should be 0x%04x (maybe caused by \"TCP checksum offload\"?)]",
|
||||
expected_cksum);
|
||||
|
||||
expert_add_info(pinfo, item, &ei_stt_checksum_bad);
|
||||
checksum = expected_cksum;
|
||||
}
|
||||
} else if (pref_check_checksum) {
|
||||
proto_item_append_text(item, " [unchecked, not all data available]");
|
||||
proto_tree_add_checksum(stt_tree, tvb, 16, hf_stt_checksum, hf_stt_checksum_status, &ei_stt_checksum_bad, pinfo,
|
||||
in_cksum(cksum_vec, 4), ENC_BIG_ENDIAN, PROTO_CHECKSUM_VERIFY);
|
||||
} else {
|
||||
proto_item_append_text(item, " [validation disabled]");
|
||||
proto_tree_add_checksum(stt_tree, tvb, 16, hf_stt_checksum, hf_stt_checksum_status, &ei_stt_checksum_bad, pinfo,
|
||||
0, ENC_BIG_ENDIAN, PROTO_CHECKSUM_NO_FLAGS);
|
||||
}
|
||||
|
||||
checksum_tree = proto_item_add_subtree(item, ett_stt_checksum);
|
||||
|
||||
if (checksum_good || checksum_bad) {
|
||||
item = proto_tree_add_uint(checksum_tree, hf_stt_checksum_calculated,
|
||||
tvb, 16, 2, checksum);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_stt_checksum_good, tvb,
|
||||
16, 2, checksum_good);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
item = proto_tree_add_boolean(checksum_tree, hf_stt_checksum_bad, tvb,
|
||||
16, 2, checksum_bad);
|
||||
PROTO_ITEM_SET_GENERATED(item);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -834,22 +792,10 @@ proto_register_stt(void)
|
|||
"Details at: http://www.wireshark.org/docs/wsug_html_chunked/ChAdvChecksums.html", HFILL
|
||||
},
|
||||
},
|
||||
{ &hf_stt_checksum_good,
|
||||
{ "Good Checksum", "stt.checksum.good",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum matches packet content; False: doesn't match content or not checked", HFILL
|
||||
},
|
||||
},
|
||||
{ &hf_stt_checksum_bad,
|
||||
{ "Bad Checksum", "stt.checksum.bad",
|
||||
FT_BOOLEAN, BASE_NONE, NULL, 0x0,
|
||||
"True: checksum doesn't match packet content; False: matches content or not checked", HFILL
|
||||
},
|
||||
},
|
||||
{ &hf_stt_checksum_calculated,
|
||||
{ "Calculated Checksum", "stt.checksum.calculated",
|
||||
FT_UINT16, BASE_HEX, NULL, 0x0,
|
||||
"The expected STT checksum field as calculated from the STT segment", HFILL
|
||||
{ &hf_stt_checksum_status,
|
||||
{ "Checksum Status", "stt.checksum.status",
|
||||
FT_UINT8, BASE_NONE, VALS(proto_checksum_vals), 0x0,
|
||||
NULL, HFILL
|
||||
},
|
||||
},
|
||||
|
||||
|
@ -923,7 +869,6 @@ proto_register_stt(void)
|
|||
&ett_stt_tcp_flags,
|
||||
&ett_stt_flgs,
|
||||
&ett_stt_vlan,
|
||||
&ett_stt_checksum,
|
||||
&ett_segment,
|
||||
&ett_segments
|
||||
};
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue