diff options
author | Guy Harris <guy@alum.mit.edu> | 2019-02-28 18:45:45 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2019-03-01 03:03:30 +0000 |
commit | 1cbcc57e0a0b0d4a27458799066e48fb49e2a0b5 (patch) | |
tree | 4236cfda0824fdf64e763159e649c6166b2ac61d /epan | |
parent | 74a776d391b6d7aa1d9662987cc3f09abfb8abaf (diff) |
Put a fake "FCS OK" value into the tree if we don't have FCS information.
That was what was being done before; do it in the main dissector
routine, as 1) the main dissector routine doesn't call the FCS or TI
CC24xx dissector if we don't have an FCS or TI CC24xx metadata trailer
and 2) that means we pull duplicate code out of those dissectors.
Also, those routines are only called if we have the full FCS/metadata
available, so there's no need for them to check for that. (Arguably,
they should be called if the data is present, according to the reported
length, even if it's not available in the captured data, so we mark the
frame as having been cut off so the full data isn't available.)
Change-Id: I6be2a1f71a27bc41aea93e3c92743fc12c997c94
Reviewed-on: https://code.wireshark.org/review/32281
Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan')
-rw-r--r-- | epan/dissectors/packet-ieee802154.c | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/epan/dissectors/packet-ieee802154.c b/epan/dissectors/packet-ieee802154.c index ee85a59e6a..d3c5fb677c 100644 --- a/epan/dissectors/packet-ieee802154.c +++ b/epan/dissectors/packet-ieee802154.c @@ -2049,6 +2049,14 @@ dissect_ieee802154_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, g /* Flag packet as having a bad crc. */ expert_add_info(pinfo, proto_tree_get_parent(ieee802154_tree), &ei_ieee802154_fcs); } + } else { + if (ieee802154_tree) { + /* Even if the FCS isn't present, add the fcs_ok field to the tree to + * help with filter. Be sure not to make it visible though. + */ + proto_item *ti = proto_tree_add_boolean_format_value(ieee802154_tree, hf_ieee802154_fcs_ok, tvb, 0, 0, fcs_ok, "Unknown"); + PROTO_ITEM_SET_HIDDEN(ti); + } } if (ieee802154_ack_tracking && fcs_ok && (packet->ack_request || packet->frame_type == IEEE802154_FCF_ACK)) { @@ -2800,7 +2808,7 @@ ieee802154_dissect_fcs(tvbuff_t *tvb, proto_tree *ieee802154_tree, guint fcs_len * reported length to cover the original packet length), so if the snapshot * is too short for an FCS don't make a fuss. */ - if (fcs_len && tvb_bytes_exist(tvb, offset, fcs_len) && (ieee802154_tree)) { + if (ieee802154_tree) { if (fcs_len == 2) { guint16 fcs = tvb_get_letohs(tvb, offset); @@ -2830,13 +2838,6 @@ ieee802154_dissect_fcs(tvbuff_t *tvb, proto_tree *ieee802154_tree, guint fcs_len PROTO_ITEM_SET_HIDDEN(ti); } } - else if (ieee802154_tree) { - /* Even if the FCS isn't present, add the fcs_ok field to the tree to - * help with filter. Be sure not to make it visible though. - */ - ti = proto_tree_add_boolean_format_value(ieee802154_tree, hf_ieee802154_fcs_ok, tvb, offset, 2, fcs_ok, "Unknown"); - PROTO_ITEM_SET_HIDDEN(ti); - } } /* ieee802154_dissect_fcs */ /** @@ -2850,7 +2851,6 @@ ieee802154_dissect_fcs(tvbuff_t *tvb, proto_tree *ieee802154_tree, guint fcs_len static void ieee802154_dissect_cc24xx_metadata(tvbuff_t *tvb, proto_tree *ieee802154_tree, gboolean fcs_ok) { - proto_item *ti; /* The metadata should be the last 2 bytes of the reported packet. */ guint offset = tvb_reported_length(tvb)-2; /* Dissect the metadata only if it exists (captures which don't or can't get the @@ -2858,7 +2858,7 @@ ieee802154_dissect_cc24xx_metadata(tvbuff_t *tvb, proto_tree *ieee802154_tree, g * reported length to cover the original packet length), so if the snapshot * is too short for the metadata don't make a fuss. */ - if (tvb_bytes_exist(tvb, offset, 2) && (ieee802154_tree)) { + if (ieee802154_tree) { proto_tree *field_tree; guint16 metadata = tvb_get_letohs(tvb, offset); @@ -2870,13 +2870,6 @@ ieee802154_dissect_cc24xx_metadata(tvbuff_t *tvb, proto_tree *ieee802154_tree, g proto_tree_add_int(field_tree, hf_ieee802154_rssi, tvb, offset++, 1, (gint8) (metadata & IEEE802154_CC24xx_RSSI)); proto_tree_add_uint(field_tree, hf_ieee802154_correlation, tvb, offset, 1, (guint8) ((metadata & IEEE802154_CC24xx_CORRELATION) >> 8)); } - else if (ieee802154_tree) { - /* Even if the FCS isn't present, add the fcs_ok field to the tree to - * help with filter. Be sure not to make it visible though. - */ - ti = proto_tree_add_boolean_format_value(ieee802154_tree, hf_ieee802154_fcs_ok, tvb, offset, 2, fcs_ok, "Unknown"); - PROTO_ITEM_SET_HIDDEN(ti); - } } /* ieee802154_dissect_cc24xx_metadata */ static void |