Use the PHY type in the radio information to recognize HT packets.

Rather than having a separate "802.11 HT" dissector, just look for the
802.11n (HT) PHY.

(As a side-effect, This also causes PPI HT frames to have the radio
information dissected by the wlan_radio dissector, as is the case with
other 802.11 frames accompanied by radio information.)

Change-Id: I854c42e19481a17767e64a3b92222b09dbaa02dd
Reviewed-on: https://code.wireshark.org/review/9185
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2015-06-26 19:25:05 -07:00
parent d6e53793ad
commit b401fb0380
2 changed files with 35 additions and 34 deletions

View File

@ -16571,10 +16571,11 @@ typedef enum {
static int
dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
proto_tree *tree, gboolean fixed_length_header,
gboolean wlan_broken_fc, gboolean is_ht,
gboolean is_centrino, struct ieee_802_11_phdr *phdr)
gboolean wlan_broken_fc, gboolean is_centrino,
struct ieee_802_11_phdr *phdr)
{
guint16 fcf, flags, frame_type_subtype, ctrl_fcf, ctrl_type_subtype;
gboolean is_ht;
guint16 seq_control;
guint32 seq_number, frag_number;
gboolean more_frags;
@ -16631,6 +16632,30 @@ dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
else
ctrl_fcf = 0;
switch (phdr->phy) {
case PHDR_802_11_PHY_UNKNOWN:
is_ht = FALSE; /* don't know, pick false */
break;
case PHDR_802_11_PHY_11_FHSS:
case PHDR_802_11_PHY_11_IR:
case PHDR_802_11_PHY_11_DSSS:
case PHDR_802_11_PHY_11B:
case PHDR_802_11_PHY_11A:
case PHDR_802_11_PHY_11G:
is_ht = FALSE; /* not HT */
break;
case PHDR_802_11_PHY_11N:
is_ht = TRUE; /* HT */
break;
case PHDR_802_11_PHY_11AC:
is_ht = TRUE; /* VHT XXX */
break;
}
if (fixed_length_header)
hdr_len = DATA_LONG_HDR_LEN;
else
@ -17783,7 +17808,6 @@ dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
* decrypted; dissect the protections parameters and decrypt the data,
* if we have a matching key. Otherwise display it as data.
*/
gboolean can_decrypt = FALSE;
proto_tree *wep_tree = NULL;
guint32 iv;
@ -18297,7 +18321,7 @@ dissect_ieee80211 (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *da
ourphdr.presence_flags = 0;
phdr = &ourphdr;
}
return dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, FALSE, phdr);
return dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, phdr);
}
/*
@ -18314,7 +18338,7 @@ dissect_ieee80211_withfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.presence_flags = 0;
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, FALSE, &phdr);
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, &phdr);
}
/*
@ -18331,7 +18355,7 @@ dissect_ieee80211_withoutfcs (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tre
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.presence_flags = 0;
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, FALSE, &phdr);
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, &phdr);
}
/*
@ -18347,7 +18371,7 @@ dissect_ieee80211_centrino(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.presence_flags = 0;
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, FALSE, TRUE, &phdr);
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, TRUE, &phdr);
}
/*
@ -18365,7 +18389,7 @@ dissect_ieee80211_bsfc (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.presence_flags = 0;
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, TRUE, FALSE, FALSE, &phdr);
dissect_ieee80211_common (tvb, pinfo, tree, FALSE, TRUE, FALSE, &phdr);
}
/*
@ -18382,20 +18406,7 @@ dissect_ieee80211_fixed (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
phdr.presence_flags = 0;
dissect_ieee80211_common (tvb, pinfo, tree, TRUE, FALSE, FALSE, FALSE, &phdr);
}
/*
* Dissect an HT 802.11 frame with a variable-length link-layer header.
* XXX - Can we tell if a frame is +HTC just by looking at the MAC header?
* If so, we can dispense with this.
*/
static int
dissect_ieee80211_ht (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data)
{
struct ieee_802_11_phdr *phdr = (struct ieee_802_11_phdr *)data;
return dissect_ieee80211_common (tvb, pinfo, tree, FALSE, FALSE, TRUE, FALSE, phdr);
dissect_ieee80211_common (tvb, pinfo, tree, TRUE, FALSE, FALSE, &phdr);
}
static void
@ -26948,7 +26959,6 @@ proto_register_ieee80211 (void)
register_dissector("wlan_withoutfcs", dissect_ieee80211_withoutfcs, proto_wlan);
register_dissector("wlan_fixed", dissect_ieee80211_fixed, proto_wlan);
register_dissector("wlan_bsfc", dissect_ieee80211_bsfc, proto_wlan);
new_register_dissector("wlan_ht", dissect_ieee80211_ht, proto_wlan);
register_init_routine(wlan_defragment_init);
register_init_routine(wlan_retransmit_init);

View File

@ -349,7 +349,6 @@ static dissector_handle_t ppi_handle;
static dissector_handle_t data_handle;
static dissector_handle_t ieee80211_radio_handle;
static dissector_handle_t ieee80211_ht_handle;
static dissector_handle_t ppi_gps_handle, ppi_vector_handle, ppi_sensor_handle, ppi_antenna_handle;
static dissector_handle_t ppi_fnet_handle;
@ -865,7 +864,6 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
gchar *mpdu_str;
gboolean first_mpdu = TRUE;
guint last_frame = 0;
gboolean is_ht = FALSE;
gint len_remain, /*pad_len = 0,*/ ampdu_len = 0;
struct ieee_802_11_phdr phdr;
@ -927,13 +925,11 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case PPI_80211N_MAC:
dissect_80211n_mac(tvb, pinfo, ppi_tree, offset, data_len,
TRUE, &n_ext_flags, &ampdu_id, &phdr);
is_ht = TRUE;
break;
case PPI_80211N_MAC_PHY:
dissect_80211n_mac_phy(tvb, pinfo, ppi_tree, offset,
data_len, &n_ext_flags, &ampdu_id, &phdr);
is_ht = TRUE;
break;
case PPI_SPECTRUM_MAP:
@ -1117,7 +1113,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
add_new_data_source(pinfo, next_tvb, mpdu_str);
ampdu_tree = proto_tree_add_subtree(agg_tree, next_tvb, 0, -1, ett_ampdu_segment, NULL, mpdu_str);
call_dissector_with_data(ieee80211_ht_handle, next_tvb, pinfo, ampdu_tree, &phdr);
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, ampdu_tree, &phdr);
}
fd_head = fd_head->next;
}
@ -1146,11 +1142,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
*/
if (dlt == 105) {
/* LINKTYPE_IEEE802_11 */
if (is_ht) { /* We didn't hit the reassembly code */
call_dissector_with_data(ieee80211_ht_handle, next_tvb, pinfo, tree, &phdr);
} else {
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
}
call_dissector_with_data(ieee80211_radio_handle, next_tvb, pinfo, tree, &phdr);
} else {
/* Everything else. This will pass a NULL data argument. */
dissector_try_uint(wtap_encap_dissector_table,
@ -1523,7 +1515,6 @@ proto_reg_handoff_ppi(void)
{
data_handle = find_dissector("data");
ieee80211_radio_handle = find_dissector("wlan_radio");
ieee80211_ht_handle = find_dissector("wlan_ht");
ppi_gps_handle = find_dissector("ppi_gps");
ppi_vector_handle = find_dissector("ppi_vector");
ppi_sensor_handle = find_dissector("ppi_sensor");