From 3978462fd31665f30432689634812a15c476406b Mon Sep 17 00:00:00 2001 From: Simon Barber Date: Tue, 20 Jun 2017 08:21:09 +0100 Subject: ieee80211-radio: allow 0 duration and handle missing phy type Allows duration to be calculated to 0 Handles generators where PHY type is not reported, but it can be determined from the rate. Change-Id: Ic0b9e1b0e3e51f4d5b670d25fea064daf250a55f Reviewed-on: https://code.wireshark.org/review/22261 Petri-Dish: Michael Mann Tested-by: Petri Dish Buildbot Reviewed-by: Michael Mann --- epan/dissectors/packet-ieee80211-radio.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'epan') diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c index 73f1821c61..0a7a7a6fdb 100644 --- a/epan/dissectors/packet-ieee80211-radio.c +++ b/epan/dissectors/packet-ieee80211-radio.c @@ -466,7 +466,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, /* durations in microseconds */ guint preamble = 0, agg_preamble = 0; /* duration of plcp */ - guint duration = 0; /* duration of whole frame (plcp + mac data + any trailing parts) */ + guint duration = G_MAXUINT; /* duration of whole frame (plcp + mac data + any trailing parts) */ guint prior_duration = 0; /* duration of previous part of aggregate */ struct wlan_radio *wlan_radio_info; @@ -885,8 +885,18 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, data_rate == 5.5f || data_rate == 11.0f || data_rate == 22.0f || data_rate == 33.0f)) { phy = PHDR_802_11_PHY_11B; + } else if (phy == PHDR_802_11_PHY_UNKNOWN && + (data_rate == 1.0f || data_rate == 2.0f || + data_rate == 5.5f || data_rate == 11.0f || + data_rate == 22.0f || data_rate == 33.0f)) { + phy = PHDR_802_11_PHY_11B; + } else if (phy == PHDR_802_11_PHY_UNKNOWN && + (data_rate == 6.0f || data_rate == 9.0f || + data_rate == 12.0f || data_rate == 18.0f || + data_rate == 24.0f || data_rate == 36.0f || + data_rate == 48.0f || data_rate == 54.0f)) { + phy = PHDR_802_11_PHY_11A; } - switch (phy) { case PHDR_802_11_PHY_11_FHSS: @@ -1069,7 +1079,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } } - if (!pinfo->fd->flags.visited && duration && phdr->has_tsf_timestamp) { + if (!pinfo->fd->flags.visited && duration != G_MAXUINT && phdr->has_tsf_timestamp) { if (current_aggregate) { current_aggregate->duration = agg_preamble + prior_duration + duration; if (previous_frame.radio_info && previous_frame.radio_info->aggregate == current_aggregate) @@ -1117,7 +1127,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, } } - if (duration) { + if (duration != G_MAXUINT) { proto_item *item = proto_tree_add_uint(radio_tree, hf_wlan_radio_duration, tvb, 0, 0, duration); proto_tree *d_tree = proto_item_add_subtree(item, ett_wlan_radio_duration); PROTO_ITEM_SET_GENERATED(item); -- cgit v1.2.1