From Francesco Fondelli:
authorjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 2 Oct 2009 07:01:20 +0000 (07:01 +0000)
committerjake <jake@f5534014-38df-0310-8fa8-9805f1628bb7>
Fri, 2 Oct 2009 07:01:20 +0000 (07:01 +0000)
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.

git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@30244 f5534014-38df-0310-8fa8-9805f1628bb7

AUTHORS
epan/dissectors/packet-lmp.c

diff --git a/AUTHORS b/AUTHORS
index fe3fdf732755d91c81336bf50b71ed98f0bca748..c0065d670bd4b70ab7e9e74ac4721382ac728e62 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -2319,6 +2319,7 @@ Francesco Fondelli        <francesco.fondelli [AT] gmail.com> {
        enhanced "what's past last MPLS label?" heuristic
        Ethernet PW (with/without CW) support, RFC 4448
        ATM PW (with/without CW) support, RFC 4717
+       LMP, update to RFC 4204
 }
 
 Artem Tamazov           <artem.tamazov [AT] tellabs.com> {
index 51d034cbf3f008e582a25157ae62c9006dfbf927..d7212dceee3d7f94e47dd73ba605039bb0bf3f69 100644 (file)
@@ -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");
 }