From 00e217a732dc7d8c38ea5fac93dd81fcc0bc0ef2 Mon Sep 17 00:00:00 2001 From: Alexis La Goutte Date: Thu, 16 Nov 2017 21:40:54 +0100 Subject: ieee80211: Add dissection of BSS Transition Query Bug: 14220 Change-Id: Iec155a6fbb179bd0e0aaf8b10fd7d420dc1a69bb Reviewed-on: https://code.wireshark.org/review/24453 Petri-Dish: Alexis La Goutte Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman --- epan/dissectors/packet-ieee80211.c | 66 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c index dc90690ff9..e64f69ebe0 100644 --- a/epan/dissectors/packet-ieee80211.c +++ b/epan/dissectors/packet-ieee80211.c @@ -961,6 +961,30 @@ static const value_string ieee80211_status_code[] = { }; static value_string_ext ieee80211_status_code_ext = VALUE_STRING_EXT_INIT(ieee80211_status_code); +static const value_string ieee80211_transition_reasons[] = { + { 0, "Unspecified" }, + { 1, "Excessive frame loss rates and/or poor conditions" }, + { 2, "Excessive delay for current traffic streams" }, + { 3, "Insufficient QoS capacity for current traffic streams (TSPEC rejected)" }, + { 4, "First association to ESS (the association initiated by an Association Request frame instead of a Reassociation Request frame)" }, + { 5, "Load balancing" }, + { 6, "Better AP found" }, + { 7, "Deauthenticated or Disassociated from the previous AP" }, + { 8, "AP failed IEEE 802.1X EAP Authentication" }, + { 9, "AP failed 4-way handshake" }, + { 10, "Received too many replay counter failures" }, + { 11, "Received too many data MIC failures" }, + { 12, "Exceeded maximum number of retransmissions" }, + { 13, "Received too many broadcast disassociations" }, + { 14, "Received too many broadcast deauthentications" }, + { 15, "Previous transition failed" }, + { 16, "Low RSSI" }, + { 17, "Roam from a non-IEEE-802.11 system" }, + { 18, "Transition due to received BSS Transition Request frame" }, + { 19, "Preferred BSS transition candidate list included" }, + { 20, "Leaving ESS" }, + { 0, NULL} +}; /* ************************************************************************* */ /* Frame types, and their names */ /* ************************************************************************* */ @@ -3150,6 +3174,7 @@ static int hf_ieee80211_ff_bss_termination_duration = -1; static int hf_ieee80211_ff_url_len = -1; static int hf_ieee80211_ff_url = -1; static int hf_ieee80211_ff_target_bss = -1; +static int hf_ieee80211_ff_bss_transition_query_reason = -1; static int hf_ieee80211_ff_bss_transition_status_code = -1; static int hf_ieee80211_ff_bss_termination_delay = -1; static int hf_ieee80211_ff_bss_transition_candidate_list_entries = -1; @@ -8359,6 +8384,39 @@ add_ff_vht_action(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo _U_, int o return 1; } +static guint +wnm_bss_trans_mgmt_query(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset) +{ + int start = offset; + gint left; + int tmp_sublen; + const guint8 ids[] = { TAG_NEIGHBOR_REPORT }; + + + offset += add_ff_dialog_token(tree, tvb, pinfo, offset); + + proto_tree_add_item(tree, hf_ieee80211_ff_bss_transition_query_reason, tvb, offset, 1, + ENC_NA); + offset += 1; + + left = tvb_reported_length_remaining(tvb, offset); + if (left > 0) { + proto_tree_add_item(tree, hf_ieee80211_ff_bss_transition_candidate_list_entries, + tvb, offset, left, ENC_NA); + + while (left > 0){ + tmp_sublen = tvb_get_guint8(tvb, offset + 1); + if(add_tagged_field(pinfo, tree, tvb, offset, 0, ids, G_N_ELEMENTS(ids), NULL) == 0){ + break; + } + left -= (tmp_sublen + 2); + offset += (tmp_sublen + 2); + } + } + + return offset - start; +} + static guint wnm_bss_trans_mgmt_req(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offset) @@ -8527,6 +8585,9 @@ add_ff_action_wnm(proto_tree *tree, tvbuff_t *tvb, packet_info *pinfo, int offse code = tvb_get_guint8(tvb, offset); offset += add_ff_wnm_action_code(tree, tvb, pinfo, offset); switch (code) { + case WNM_BSS_TRANS_MGMT_QUERY: + offset += wnm_bss_trans_mgmt_query(tree, tvb, pinfo, offset); + break; case WNM_BSS_TRANS_MGMT_REQ: offset += wnm_bss_trans_mgmt_req(tree, tvb, pinfo, offset); break; @@ -20532,6 +20593,11 @@ proto_register_ieee80211(void) FT_ETHER, BASE_NONE, NULL, 0, NULL, HFILL }}, + {&hf_ieee80211_ff_bss_transition_query_reason, + {"BSS Transition Query Reason", "wlan.fixed.bss_transition_query_reason", + FT_UINT8, BASE_DEC, VALS(ieee80211_transition_reasons), 0, + NULL, HFILL }}, + {&hf_ieee80211_ff_bss_transition_candidate_list_entries, {"BSS Transition Candidate List Entries", "wlan.fixed.bss_transition_candidate_list_entries", FT_BYTES, BASE_NONE, NULL, 0, -- cgit v1.2.3