aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2017-11-28 17:28:55 -0800
committerGuy Harris <guy@alum.mit.edu>2017-11-29 01:29:30 +0000
commite74800d3479a937692114aa026522ff4768d9ad2 (patch)
tree4018dca27d15f80b8ddb8659925d5cc7bd44566d
parentae65dc20eae7e21010b6e33b2cb11724d403acd9 (diff)
Use a separate Boolean to indicate whether we have a duration.
Reserved values are a bit of a hack. (If this were Swift....) Change-Id: I243e8f497345f44d94af6106287556b8831fba92 Reviewed-on: https://code.wireshark.org/review/24633 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-ieee80211-radio.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c
index ecde74458b..d9f5319131 100644
--- a/epan/dissectors/packet-ieee80211-radio.c
+++ b/epan/dissectors/packet-ieee80211-radio.c
@@ -468,7 +468,8 @@ 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 = G_MAXUINT; /* duration of whole frame (plcp + mac data + any trailing parts) */
+ gboolean have_duration = FALSE;
+ guint duration = 0; /* 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;
@@ -944,6 +945,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
* - rate
*/
/* round up to whole microseconds */
+ have_duration = TRUE;
duration = (guint) ceil(preamble + frame_length * 8 / data_rate);
break;
@@ -964,6 +966,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
guint bits = 16 + 8 * frame_length + 6;
guint symbols = (guint) ceil(bits / (data_rate * 4));
+ have_duration = TRUE;
duration = preamble + symbols * 4;
break;
}
@@ -1072,10 +1075,12 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
preamble = 0;
}
prior_duration = calculate_11n_duration(wlan_radio_info->prior_aggregate_data, info_n, stbc_streams);
+ have_duration = TRUE;
duration = preamble +
calculate_11n_duration(frame_length + wlan_radio_info->prior_aggregate_data, info_n, stbc_streams)
- prior_duration;
} else {
+ have_duration = TRUE;
duration = preamble + calculate_11n_duration(frame_length, info_n, stbc_streams);
}
break;
@@ -1096,17 +1101,19 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
preamble = 0;
}
prior_duration = calculate_11ac_duration(wlan_radio_info->prior_aggregate_data, data_rate);
+ have_duration = TRUE;
duration = preamble +
calculate_11ac_duration(wlan_radio_info->prior_aggregate_data + frame_length, data_rate)
- prior_duration;
} else {
+ have_duration = TRUE;
duration = preamble + calculate_11ac_duration(frame_length, data_rate);
}
break;
}
}
- if (!pinfo->fd->flags.visited && duration != G_MAXUINT && phdr->has_tsf_timestamp) {
+ if (!pinfo->fd->flags.visited && have_duration && 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)
@@ -1154,7 +1161,7 @@ dissect_wlan_radio_phdr (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree,
}
}
- if (duration != G_MAXUINT) {
+ if (have_duration) {
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);