From 404b35cc30e277169edb57d98085ac2619f1b662 Mon Sep 17 00:00:00 2001 From: sfisher Date: Tue, 2 Jan 2007 19:55:55 +0000 Subject: [PATCH] Add a good/bad tree to the FCS item. git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@20273 f5534014-38df-0310-8fa8-9805f1628bb7 --- epan/dissectors/packet-ieee80211.c | 45 +++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 4 deletions(-) diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index b664097b51..a035fb299f 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -596,6 +596,8 @@ static int hf_seq_number = -1; /* Header values for Frame Check field */ /* ************************************************************************* */ static int hf_fcs = -1; +static int hf_fcs_good = -1; +static int hf_fcs_bad = -1; /* ************************************************************************* */ /* Header values for reassembly */ @@ -771,6 +773,8 @@ static gint ett_80211_mgt_ie = -1; static gint ett_tsinfo_tree = -1; static gint ett_sched_tree = -1; +static gint ett_fcs = -1; + static const fragment_items frag_items = { &ett_fragment, &ett_fragments, @@ -2626,11 +2630,13 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo, proto_item *ti = NULL; proto_item *flag_item; proto_item *fc_item; + proto_item *fcs_item; proto_tree *hdr_tree = NULL; proto_tree *flag_tree; proto_tree *fc_tree; + proto_tree *fcs_tree; guint16 hdr_len, ohdr_len; - gboolean has_fcs; + gboolean has_fcs, fcs_good, fcs_bad; gint len, reported_len, ivlen; gboolean save_fragmented; tvbuff_t *volatile next_tvb = NULL; @@ -3174,15 +3180,37 @@ dissect_ieee80211_common (tvbuff_t * tvb, packet_info * pinfo, fcs = crc32_802_tvb_padded(tvb, ohdr_len, hdr_len, len); else fcs = crc32_802_tvb(tvb, hdr_len + len); - if (fcs == sent_fcs) - proto_tree_add_uint_format(hdr_tree, hf_fcs, tvb, + if (fcs == sent_fcs) { + fcs_good = TRUE; + fcs_bad = FALSE; + } else { + fcs_good = FALSE; + fcs_bad = TRUE; + } + + if(fcs_good) + fcs_item = proto_tree_add_uint_format(hdr_tree, hf_fcs, tvb, hdr_len + len, 4, sent_fcs, "Frame check sequence: 0x%08x [correct]", sent_fcs); else - proto_tree_add_uint_format(hdr_tree, hf_fcs, tvb, + fcs_item = proto_tree_add_uint_format(hdr_tree, hf_fcs, tvb, hdr_len + len, 4, sent_fcs, "Frame check sequence: 0x%08x [incorrect, should be 0x%08x]", sent_fcs, fcs); + + fcs_tree = proto_item_add_subtree(fcs_item, ett_fcs); + + fcs_item = proto_tree_add_boolean(fcs_tree, + hf_fcs_good, tvb, + hdr_len + len, 2, + fcs_good); + PROTO_ITEM_SET_GENERATED(fcs_item); + + fcs_item = proto_tree_add_boolean(fcs_tree, + hf_fcs_bad, tvb, + hdr_len + len, 2, + fcs_bad); + PROTO_ITEM_SET_GENERATED(fcs_item); } } } @@ -4343,6 +4371,14 @@ proto_register_ieee80211 (void) {"Frame check sequence", "wlan.fcs", FT_UINT32, BASE_HEX, NULL, 0, "FCS", HFILL }}, + {&hf_fcs_good, + {"Good", "wlan.fcs_good", FT_BOOLEAN, BASE_NONE, + NULL, 0, "True if the FCS is correct", HFILL }}, + + {&hf_fcs_bad, + {"Bad", "wlan.fcs_bad", FT_BOOLEAN, BASE_NONE, + NULL, 0, "True if the FCS is incorrect", HFILL }}, + {&hf_fragment_overlap, {"Fragment overlap", "wlan.fragment.overlap", FT_BOOLEAN, BASE_NONE, NULL, 0x0, "Fragment overlaps with other fragments", HFILL }}, @@ -4902,6 +4938,7 @@ proto_register_ieee80211 (void) &ett_80211_mgt_ie, &ett_tsinfo_tree, &ett_sched_tree, + &ett_fcs }; module_t *wlan_module; -- 2.34.1