Wireshark-dev: [Wireshark-dev] [PATCH] ISIS Checksum
From: Sebastien Tandel <sebastien@xxxxxxxxx>
Date: Tue, 26 Dec 2006 04:33:23 +0100
Hi all, Here is a patch for the management of the bad/good checksum for ISIS (like TCP/UDP/IP). support added for : - booleans hf_isis_lsp_checksum_good, hf_isis_lsp_checksum_bad in the tree, - information in the info column if bad checksum, - expert info for bad checksum, - color filters update Best Regards, Sebastien Tandel
Index: colorfilters =================================================================== --- colorfilters (révision 20213) +++ colorfilters (copie de travail) @@ -8,7 +8,7 @@ @ICMP@icmp@[49680,49737,65535][0,0,0] @TCP RST@tcp.flags.reset eq 1@[37008,0,0][65535,63121,32911] @Low TTL@xxxxxx < 5@[37008,0,0][65535,65535,65535] -@Checksum Errors@cdp.checksum_bad==1 || edp.checksum_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1@[0,0,0][65535,24383,24383] +@Checksum Errors@edp.checksum_bad==1 || ip.checksum_bad==1 || tcp.checksum_bad==1 || udp.checksum_bad==1 || isis.lsp.checksum_bad==1@[0,0,0][65535,24383,24383] @SMB@smb || nbss || nbns || nbipx || ipxsap || netbios@[65534,64008,39339][0,0,0] @HTTP@http || tcp.port == 80@[36107,65535,32590][0,0,0] @IPX@ipx || spx@[65534,58325,58808][0,0,0] Index: epan/dissectors/packet-isis-lsp.c =================================================================== --- epan/dissectors/packet-isis-lsp.c (révision 20213) +++ epan/dissectors/packet-isis-lsp.c (copie de travail) @@ -40,6 +40,7 @@ #include "packet-isis-lsp.h" #include <epan/addr_resolv.h> #include <epan/addr_and_mask.h> +#include <epan/expert.h> /* lsp packets */ static int hf_isis_lsp_pdu_length = -1; @@ -47,6 +48,7 @@ static int hf_isis_lsp_sequence_number = -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_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; @@ -59,6 +61,7 @@ static gint ett_isis_lsp = -1; static gint ett_isis_lsp_info = -1; static gint ett_isis_lsp_att = -1; +static gint ett_isis_lsp_cksum = -1; static gint ett_isis_lsp_clv_area_addr = -1; static gint ett_isis_lsp_clv_is_neighbors = -1; static gint ett_isis_lsp_clv_ext_is_reachability = -1; /* CLV 22 */ @@ -1727,6 +1730,27 @@ } } +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_format(pinfo, item, PI_CHECKSUM, PI_ERROR, "Bad checksum"); + if (check_col(pinfo->cinfo, COL_INFO)) + col_append_fstr(pinfo->cinfo, COL_INFO, " [ISIS CHECKSUM INCORRECT]"); + } +} + + /* * Name: isis_dissect_isis_lsp() * @@ -1754,6 +1778,7 @@ guint16 pdu_length, checksum, cacl_checksum=0; guint8 lsp_info, lsp_att; int len, offset_checksum; + proto_item *it_cksum; if (tree) { ti = proto_tree_add_text(tree, tvb, offset, -1, @@ -1813,17 +1838,15 @@ tvb_length_remaining(tvb, offset_checksum)); break; case CKSUM_NOT_OK : - proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum, + it_cksum = proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum, "Checksum: 0x%04x [incorrect, should be 0x%04x]", checksum, cacl_checksum); - proto_tree_add_boolean_hidden(lsp_tree, hf_isis_lsp_checksum_bad, - tvb, offset, 2, TRUE); + isis_lsp_checkum_additional_info(tvb, pinfo, it_cksum, offset, FALSE); break; case CKSUM_OK : - proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum, + it_cksum = proto_tree_add_uint_format(lsp_tree, hf_isis_lsp_checksum, tvb, offset, 2, checksum, "Checksum: 0x%04x [correct]", checksum); - proto_tree_add_boolean_hidden(lsp_tree, hf_isis_lsp_checksum_bad, - tvb, offset, 2, FALSE); + isis_lsp_checkum_additional_info(tvb, pinfo, it_cksum, offset, TRUE); break; default : g_message("'check_and_get_checksum' returned an invalid value"); @@ -1915,6 +1938,10 @@ { "Checksum", "isis.lsp.checksum",FT_UINT16, BASE_HEX, NULL, 0x0, "", HFILL }}, + { &hf_isis_lsp_checksum_good, + { "Good Checksum", "isis.lsp.checksum_good", FT_BOOLEAN, BASE_NONE, + NULL, 0, "Good IS-IS LSP Checksum", HFILL }}, + { &hf_isis_lsp_checksum_bad, { "Bad Checksum", "isis.lsp.checksum_bad", FT_BOOLEAN, BASE_NONE, NULL, 0, "Bad IS-IS LSP Checksum", HFILL }}, @@ -1953,12 +1980,13 @@ { &hf_isis_lsp_is_type, { "Type of Intermediate System", "isis.lsp.is_type", FT_UINT8, BASE_DEC, VALS(isis_lsp_istype_vals), ISIS_LSP_IS_TYPE_MASK, - "", HFILL }}, + "", HFILL }} }; static gint *ett[] = { &ett_isis_lsp, &ett_isis_lsp_info, &ett_isis_lsp_att, + &ett_isis_lsp_cksum, &ett_isis_lsp_clv_area_addr, &ett_isis_lsp_clv_is_neighbors, &ett_isis_lsp_clv_ext_is_reachability, /* CLV 22 */ @@ -1985,7 +2013,7 @@ &ett_isis_lsp_clv_mt_is, &ett_isis_lsp_part_of_clv_mt_is, &ett_isis_lsp_clv_mt_reachable_IPv4_prefx, - &ett_isis_lsp_clv_mt_reachable_IPv6_prefx, + &ett_isis_lsp_clv_mt_reachable_IPv6_prefx }; proto_register_field_array(proto_isis, hf, array_length(hf));
- Follow-Ups:
- Re: [Wireshark-dev] [PATCH] ISIS Checksum
- From: Jaap Keuter
- Re: [Wireshark-dev] [PATCH] ISIS Checksum
- Prev by Date: Re: [Wireshark-dev] build problem
- Next by Date: Re: [Wireshark-dev] build problem
- Previous by thread: Re: [Wireshark-dev] build problem
- Next by thread: Re: [Wireshark-dev] [PATCH] ISIS Checksum
- Index(es):