diff options
author | Jaap Keuter <jaap.keuter@xs4all.nl> | 2009-10-02 07:01:20 +0000 |
---|---|---|
committer | Jaap Keuter <jaap.keuter@xs4all.nl> | 2009-10-02 07:01:20 +0000 |
commit | 1551cccaff7c7a5b2df8592573842c38f85cd71e (patch) | |
tree | 499e4ec9995ec98ef961ae5cb42e3a3c3ab764ae /epan/dissectors/packet-lmp.c | |
parent | 469012ca8713d5f3924143608eb7d95df7e929b9 (diff) |
From Francesco Fondelli:
Back in August 2002 the check-sum field was removed from the
LMP specification (draft-ietf-ccamp-lmp-05). This patch aligns
packet-lmp.c dissector with RFC 4204.
svn path=/trunk/; revision=30244
Diffstat (limited to 'epan/dissectors/packet-lmp.c')
-rw-r--r-- | epan/dissectors/packet-lmp.c | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/epan/dissectors/packet-lmp.c b/epan/dissectors/packet-lmp.c index 51d034cbf3..d7212dceee 100644 --- a/epan/dissectors/packet-lmp.c +++ b/epan/dissectors/packet-lmp.c @@ -72,6 +72,8 @@ static int proto_lmp = -1; static guint lmp_udp_port = UDP_PORT_LMP_DEFAULT; static guint lmp_udp_port_config = UDP_PORT_LMP_DEFAULT; +static gboolean lmp_checksum_config = FALSE; + static dissector_handle_t lmp_handle; /*---------------------------------------------------------------------- @@ -735,28 +737,32 @@ dissect_lmp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree) return tvb_length(tvb); } - cksum = tvb_get_ntohs(tvb, offset+6); - if (!pinfo->fragmented && (int) tvb_length(tvb) >= msg_length) { - /* The packet isn't part of a fragmented datagram and isn't - truncated, so we can checksum it. */ - cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, msg_length); - cksum_vec[0].len = msg_length; - computed_cksum = in_cksum(&cksum_vec[0], 1); - - if (computed_cksum == 0) { - proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, - "Message Checksum: 0x%04x [correct]", - cksum); - } else { - proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, - "Message Checksum: 0x%04x [incorrect, should be 0x%04x]", - cksum, - in_cksum_shouldbe(cksum, computed_cksum)); - } + if (lmp_checksum_config) { + cksum = tvb_get_ntohs(tvb, offset+6); + if (!pinfo->fragmented && (int) tvb_length(tvb) >= msg_length) { + /* The packet isn't part of a fragmented datagram and isn't + truncated, so we can checksum it. */ + cksum_vec[0].ptr = tvb_get_ptr(tvb, 0, msg_length); + cksum_vec[0].len = msg_length; + computed_cksum = in_cksum(&cksum_vec[0], 1); + + if (computed_cksum == 0) { + proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, + "Message Checksum: 0x%04x [correct]", + cksum); + } else { + proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, + "Message Checksum: 0x%04x [incorrect, should be 0x%04x]", + cksum, + in_cksum_shouldbe(cksum, computed_cksum)); + } + } else { + proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, + "Message Checksum: 0x%04x", + cksum); + } } else { - proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, - "Message Checksum: 0x%04x", - cksum); + proto_tree_add_text(lmp_header_tree, tvb, offset+6, 2, "No checksum"); } offset += 8; @@ -2032,6 +2038,9 @@ register_lmp_prefs (void) prefs_register_uint_preference( lmp_module, "udp_port", "LMP UDP Port", "UDP port number to use for LMP", 10, &lmp_udp_port_config); + prefs_register_bool_preference( + lmp_module, "checksum", "LMP checksum field", + "Whether LMP contains a checksum which can be checked", &lmp_checksum_config); prefs_register_obsolete_preference( lmp_module, "version"); } |