Add hidden fields for bad checksums to various IP-family protocols.
authorguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 28 Feb 2001 19:33:49 +0000 (19:33 +0000)
committerguy <guy@f5534014-38df-0310-8fa8-9805f1628bb7>
Wed, 28 Feb 2001 19:33:49 +0000 (19:33 +0000)
Initialize the "hf_" value for "icmp.checksum_bad" to -1, the way all
other "hf_" values are initialized, and declare it and "ip.checksum_bad"
to have base BASE_NONE, not 4.

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

packet-icmpv6.c
packet-ip.c
packet-tcp.c
packet-udp.c

index e617020e97cd916dad24c7626ad70f783c04f441..61fc1967766467e1f43973fbbf0999d1036471b7 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-icmpv6.c
  * Routines for ICMPv6 packet disassembly
  *
- * $Id: packet-icmpv6.c,v 1.36 2001/01/23 02:49:55 gerald Exp $
+ * $Id: packet-icmpv6.c,v 1.37 2001/02/28 19:33:49 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@ethereal.com>
@@ -66,6 +66,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 gint ett_icmpv6 = -1;
 static gint ett_icmpv6opt = -1;
@@ -987,6 +988,10 @@ dissect_icmpv6(const u_char *pd, int offset, frame_data *fd, proto_tree *tree)
                        cksum,
                        "Checksum: 0x%04x (correct)", cksum);
            } else {
+               proto_tree_add_item_hidden(icmp6_tree, hf_icmpv6_checksum_bad,
+                       NullTVB,
+                       offset + offsetof(struct icmp6_hdr, icmp6_cksum), 2,
+                       TRUE);
                proto_tree_add_uint_format(icmp6_tree, hf_icmpv6_checksum,
                        NullTVB,
                        offset + offsetof(struct icmp6_hdr, icmp6_cksum), 2,
@@ -1207,7 +1212,10 @@ proto_register_icmpv6(void)
        "" }},
     { &hf_icmpv6_checksum,
       { "Checksum",       "icmpv6.checksum",   FT_UINT16, BASE_HEX, NULL, 0x0,
-       "" }}
+       "" }},
+    { &hf_icmpv6_checksum_bad,
+      { "Bad Checksum",   "icmpv6.checksum_bad", FT_BOOLEAN, BASE_NONE,        NULL, 0x0,
+       "" }},
   };
   static gint *ett[] = {
     &ett_icmpv6,
index 850cecc7a296dc608410d36ae6f341bbd4512269..b5422ffaa8fc4e380a908927efc7f52ecaedf8c6 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-ip.c
  * Routines for IP and miscellaneous IP protocol packet disassembly
  *
- * $Id: packet-ip.c,v 1.124 2001/02/21 19:42:37 gram Exp $
+ * $Id: packet-ip.c,v 1.125 2001/02/28 19:33:49 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -114,7 +114,7 @@ static 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 = 0;
+static int hf_icmp_checksum_bad = -1;
 
 static gint ett_icmp = -1;
 
@@ -1443,7 +1443,7 @@ proto_register_ip(void)
                        "" }},
 
                { &hf_ip_checksum_bad,
-               { "Bad Header checksum",        "ip.checksum_bad", FT_BOOLEAN, 4, NULL, 0x0,
+               { "Bad Header checksum",        "ip.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
                        "" }},
        };
        static gint *ett[] = {
@@ -1508,9 +1508,9 @@ proto_register_icmp(void)
       { "Checksum",    "icmp.checksum",        FT_UINT16, BASE_HEX,    NULL, 0x0,
        "" }},
 
-       { &hf_icmp_checksum_bad,
-       { "Bad Checksum",       "icmp.checksum_bad", FT_BOOLEAN, 4, NULL, 0x0,
-               "" }},
+    { &hf_icmp_checksum_bad,
+      { "Bad Checksum",        "icmp.checksum_bad",    FT_BOOLEAN, BASE_NONE,  NULL, 0x0,
+       "" }},
   };
   static gint *ett[] = {
     &ett_icmp,
index 6ce9db3d9c8282a9511c2f27c3efb96c53edcd3e..f7bef0b6f828318a42ebaad108364a55fc4f2718 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-tcp.c
  * Routines for TCP packet disassembly
  *
- * $Id: packet-tcp.c,v 1.99 2001/01/28 21:17:26 guy Exp $
+ * $Id: packet-tcp.c,v 1.100 2001/02/28 19:33:49 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -79,6 +79,7 @@ static int hf_tcp_flags_syn = -1;
 static int hf_tcp_flags_fin = -1;
 static int hf_tcp_window_size = -1;
 static int hf_tcp_checksum = -1;
+static int hf_tcp_checksum_bad = -1;
 static int hf_tcp_urgent_pointer = -1;
 
 static gint ett_tcp = -1;
@@ -557,6 +558,8 @@ dissect_tcp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
            offset + 16, 2, th.th_sum, "Checksum: 0x%04x (correct)", th.th_sum);
       } else {
+       proto_tree_add_item_hidden(tcp_tree, hf_tcp_checksum_bad, tvb,
+          offset + 16, 2, TRUE);
         proto_tree_add_uint_format(tcp_tree, hf_tcp_checksum, tvb,
            offset + 16, 2, th.th_sum,
           "Checksum: 0x%04x (incorrect, should be 0x%04x)", th.th_sum,
@@ -706,6 +709,10 @@ proto_register_tcp(void)
                { "Checksum",                   "tcp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
                        "" }},
 
+               { &hf_tcp_checksum_bad,
+               { "Bad Checksum",               "tcp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+                       "" }},
+
                { &hf_tcp_urgent_pointer,
                { "Urgent pointer",             "tcp.urgent_pointer", FT_UINT16, BASE_DEC, NULL, 0x0,
                        "" }},
index bc36905876e8c9662644885d9334b643b3a43ac8..4609ebf216ec174c711c484d6255d202e9f51f33 100644 (file)
@@ -1,7 +1,7 @@
 /* packet-udp.c
  * Routines for UDP packet disassembly
  *
- * $Id: packet-udp.c,v 1.87 2001/01/28 21:17:26 guy Exp $
+ * $Id: packet-udp.c,v 1.88 2001/02/28 19:33:49 guy Exp $
  *
  * Ethereal - Network traffic analyzer
  * By Gerald Combs <gerald@zing.org>
@@ -58,6 +58,7 @@ static int hf_udp_dstport = -1;
 static int hf_udp_port = -1;
 static int hf_udp_length = -1;
 static int hf_udp_checksum = -1;
+static int hf_udp_checksum_bad = -1;
 
 static gint ett_udp = -1;
 
@@ -192,6 +193,8 @@ dissect_udp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
         proto_tree_add_uint_format(udp_tree, hf_udp_checksum, tvb,
           offset + 6, 2, uh_sum, "Checksum: 0x%04x (correct)", uh_sum);
       } else {
+       proto_tree_add_item_hidden(udp_tree, hf_udp_checksum_bad, tvb,
+          offset + 6, 2, TRUE);
         proto_tree_add_uint_format(udp_tree, hf_udp_checksum, tvb,
           offset + 6, 2, uh_sum,
          "Checksum: 0x%04x (incorrect, should be 0x%04x)", uh_sum,
@@ -235,6 +238,10 @@ proto_register_udp(void)
                { "Length",             "udp.length", FT_UINT16, BASE_DEC, NULL, 0x0,
                        "" }},
 
+               { &hf_udp_checksum_bad,
+               { "Bad Checksum",       "udp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0x0,
+                       "" }},
+
                { &hf_udp_checksum,
                { "Checksum",           "udp.checksum", FT_UINT16, BASE_HEX, NULL, 0x0,
                        "" }},