summaryrefslogtreecommitdiff
path: root/packet-clnp.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2001-06-05 09:06:19 +0000
committerGuy Harris <guy@alum.mit.edu>2001-06-05 09:06:19 +0000
commitf2e04def43530c4e42c9aa128da97a7a4ca30c4f (patch)
treede9ebbd5bbbb05574f9d481c9a16ed2f62e4e20b /packet-clnp.c
parent2851b7ef7678a6dbe177c33efc545033a38c6628 (diff)
downloadwireshark-f2e04def43530c4e42c9aa128da97a7a4ca30c4f.tar.gz
Correctly compute the OSI checksum.
Have "calc_checksum()" just return an indication of the status of the checksum. Check the CLNP header checksum, and put display its status. svn path=/trunk/; revision=3514
Diffstat (limited to 'packet-clnp.c')
-rw-r--r--packet-clnp.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/packet-clnp.c b/packet-clnp.c
index d1cd4c8abb..78ec69e43d 100644
--- a/packet-clnp.c
+++ b/packet-clnp.c
@@ -1,14 +1,13 @@
/* packet-clnp.c
* Routines for ISO/OSI network and transport protocol packet disassembly
*
- * $Id: packet-clnp.c,v 1.28 2001/05/27 04:14:52 guy Exp $
+ * $Id: packet-clnp.c,v 1.29 2001/06/05 09:06:19 guy Exp $
* Laurent Deniel <deniel@worldnet.fr>
* Ralf Schneider <Ralf.Schneider@t-online.de>
*
* Ethereal - Network traffic analyzer
- * By Gerald Combs <gerald@zing.org>
+ * By Gerald Combs <gerald@ethereal.com>
* Copyright 1998 Gerald Combs
- *
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -1675,10 +1674,42 @@ static void dissect_clnp(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
proto_tree_add_uint(clnp_tree, hf_clnp_pdu_length, tvb, P_CLNP_SEGLEN, 2,
segment_length);
cnf_cksum = tvb_get_ntohs(tvb, P_CLNP_CKSUM);
- proto_tree_add_uint_format(clnp_tree, hf_clnp_checksum, tvb, P_CLNP_CKSUM, 2,
+ switch (calc_checksum(tvb, 0, cnf_hdr_len, cnf_cksum)) {
+
+ default:
+ /*
+ * No checksum present, or not enough of the header present to
+ * checksum it.
+ */
+ proto_tree_add_uint_format(clnp_tree, hf_clnp_checksum, tvb,
+ P_CLNP_CKSUM, 2,
cnf_cksum,
"Checksum : 0x%04x",
cnf_cksum);
+ break;
+
+ case CKSUM_OK:
+ /*
+ * Checksum is correct.
+ */
+ proto_tree_add_uint_format(clnp_tree, hf_clnp_checksum, tvb,
+ P_CLNP_CKSUM, 2,
+ cnf_cksum,
+ "Checksum : 0x%04x (correct)",
+ cnf_cksum);
+ break;
+
+ case CKSUM_NOT_OK:
+ /*
+ * Checksum is not correct.
+ */
+ proto_tree_add_uint_format(clnp_tree, hf_clnp_checksum, tvb,
+ P_CLNP_CKSUM, 2,
+ cnf_cksum,
+ "Checksum : 0x%04x (incorrect)",
+ cnf_cksum);
+ break;
+ }
opt_len -= 9; /* Fixed part of Hesder */
} /* tree */