aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2015-06-25 12:14:39 -0700
committerGuy Harris <guy@alum.mit.edu>2015-06-25 19:15:56 +0000
commitf1bc598d87aeba56f2bd4a1151543664388bb8c7 (patch)
tree0ae46fdda5a2183986739bbed78f97c5bba59dbd
parent8a89ebbf40b5931fc2a8afd6ed6f5bf166354687 (diff)
Clean up 802.11 radio information handling.
Have a field that holds the PHY type but nothing else. Have a union with structures holding PHY-type-specific information, as a bunch of attributes are PHY-specific. If we have a channel and band, but don't have the frequency, attempt to calculate the frequency, and add that to the radio information if we succeed. If we have the frequency, but don't have the channel, attempt to calculate the channel, and add that to the radio information if we succeed. Handle FHSS information, 11a "half/quarter-clocked" and turbo information, 11g normal vs. Super G, additional 11n and 11ac information, and the "short preamble" flag for 11b and 11g. Add a PHY type for 11 legacy DSSS and detect it if possible. Clean up the AVS dissector - make all fields wlancap. fields (if you want generic fields, use the wlan_radio. fields). Set more fields when writing out Commview Wi-Fi files. Change-Id: I691ac59f5e9e1a23779b56a65124049914b72e69 Reviewed-on: https://code.wireshark.org/review/9146 Reviewed-by: Guy Harris <guy@alum.mit.edu>
-rw-r--r--epan/dissectors/packet-aruba-erm.c4
-rw-r--r--epan/dissectors/packet-cisco-wids.c1
-rw-r--r--epan/dissectors/packet-ieee80211-airopeek.c1
-rw-r--r--epan/dissectors/packet-ieee80211-netmon.c51
-rw-r--r--epan/dissectors/packet-ieee80211-prism.c1
-rw-r--r--epan/dissectors/packet-ieee80211-radio.c300
-rw-r--r--epan/dissectors/packet-ieee80211-radiotap.c222
-rw-r--r--epan/dissectors/packet-ieee80211-wlancap.c375
-rw-r--r--epan/dissectors/packet-ixveriwave.c33
-rw-r--r--epan/dissectors/packet-peekremote.c24
-rw-r--r--epan/dissectors/packet-ppi.c63
-rw-r--r--wiretap/commview.c135
-rw-r--r--wiretap/netmon.c1
-rw-r--r--wiretap/network_instruments.c1
-rw-r--r--wiretap/netxray.c1
-rw-r--r--wiretap/peekclassic.c1
-rw-r--r--wiretap/peektagged.c127
-rw-r--r--wiretap/snoop.c1
-rw-r--r--wiretap/wtap.h185
19 files changed, 1053 insertions, 474 deletions
diff --git a/epan/dissectors/packet-aruba-erm.c b/epan/dissectors/packet-aruba-erm.c
index cfd87b8da8..c46efa272a 100644
--- a/epan/dissectors/packet-aruba-erm.c
+++ b/epan/dissectors/packet-aruba-erm.c
@@ -283,6 +283,8 @@ dissect_aruba_erm_type3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
offset = dissect_aruba_erm_pcap(tvb, pinfo, aruba_erm_tree, offset);
phdr.decrypted = FALSE;
+ phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags =
PHDR_802_11_HAS_DATA_RATE|
PHDR_802_11_HAS_CHANNEL|
@@ -314,8 +316,6 @@ dissect_aruba_erm_type3(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
} else {
phdr.fcs_len = 4; /* We have an FCS */
}
- phdr.decrypted = FALSE;
- phdr.datapad = FALSE;
call_dissector_with_data(wlan_radio_handle, next_tvb, pinfo, tree, &phdr);
}
diff --git a/epan/dissectors/packet-cisco-wids.c b/epan/dissectors/packet-cisco-wids.c
index d194fdb735..94186e3836 100644
--- a/epan/dissectors/packet-cisco-wids.c
+++ b/epan/dissectors/packet-cisco-wids.c
@@ -93,6 +93,7 @@ dissect_cwids(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.fcs_len = 0; /* no FCS */
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = PHDR_802_11_HAS_CHANNEL;
proto_tree_add_item(cwids_tree, hf_cwids_version, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
diff --git a/epan/dissectors/packet-ieee80211-airopeek.c b/epan/dissectors/packet-ieee80211-airopeek.c
index ff82d9892e..72e2561aff 100644
--- a/epan/dissectors/packet-ieee80211-airopeek.c
+++ b/epan/dissectors/packet-ieee80211-airopeek.c
@@ -62,6 +62,7 @@ dissect_airopeek(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.fcs_len = 0;
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags =
PHDR_802_11_HAS_CHANNEL|
PHDR_802_11_HAS_DATA_RATE|
diff --git a/epan/dissectors/packet-ieee80211-netmon.c b/epan/dissectors/packet-ieee80211-netmon.c
index 1b40c6ebd6..d3ddb81349 100644
--- a/epan/dissectors/packet-ieee80211-netmon.c
+++ b/epan/dissectors/packet-ieee80211-netmon.c
@@ -24,8 +24,11 @@
#include "config.h"
#include <epan/packet.h>
+
#include <wiretap/wtap.h>
+#include <wsutil/frequency-utils.h>
+
void proto_register_netmon_802_11(void);
void proto_reg_handoff_netmon_802_11(void);
@@ -79,6 +82,7 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
guint32 phy_type;
guint32 flags;
guint32 channel;
+ gint calc_channel;
gint32 rssi;
guint8 rate;
@@ -128,23 +132,26 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
switch (phy_type) {
case PHY_TYPE_11B:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr->phy = PHDR_802_11_PHY_11B;
break;
case PHY_TYPE_11A:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11A;
+ phdr->phy = PHDR_802_11_PHY_11A;
+ phdr->phy_info.info_11a.presence_flags = 0;
break;
case PHY_TYPE_11G:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11G;
+ phdr->phy = PHDR_802_11_PHY_11G;
+ phdr->phy_info.info_11g.presence_flags = 0;
break;
case PHY_TYPE_11N:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11N;
+ phdr->phy = PHDR_802_11_PHY_11N;
+ phdr->phy_info.info_11n.presence_flags = 0;
+ break;
+
+ default:
+ phdr->phy = PHDR_802_11_PHY_UNKNOWN;
break;
}
proto_tree_add_item(wlan_tree, hf_netmon_802_11_phy_type, tvb, offset, 4,
@@ -157,10 +164,33 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
tvb, offset, 4, channel,
"Unknown");
} else {
+ guint frequency;
+
phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;
phdr->channel = channel;
proto_tree_add_uint(wlan_tree, hf_netmon_802_11_channel,
tvb, offset, 4, channel);
+ switch (phdr->phy) {
+
+ case PHDR_802_11_PHY_11B:
+ case PHDR_802_11_PHY_11G:
+ /* 2.4 GHz channel */
+ frequency = ieee80211_chan_to_mhz(channel, TRUE);
+ break;
+
+ case PHDR_802_11_PHY_11A:
+ /* 5 GHz channel */
+ frequency = ieee80211_chan_to_mhz(channel, FALSE);
+ break;
+
+ default:
+ frequency = 0;
+ break;
+ }
+ if (frequency != 0) {
+ phdr->presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+ phdr->frequency = frequency;
+ }
}
} else {
phdr->presence_flags |= PHDR_802_11_HAS_FREQUENCY;
@@ -168,6 +198,11 @@ dissect_netmon_802_11(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
proto_tree_add_uint_format_value(wlan_tree, hf_netmon_802_11_frequency,
tvb, offset, 4, channel,
"%u Mhz", channel);
+ calc_channel = ieee80211_mhz_to_chan(channel);
+ if (calc_channel != -1) {
+ phdr->presence_flags |= PHDR_802_11_HAS_CHANNEL;
+ phdr->channel = calc_channel;
+ }
}
offset += 4;
rssi = tvb_get_letohl(tvb, offset);
diff --git a/epan/dissectors/packet-ieee80211-prism.c b/epan/dissectors/packet-ieee80211-prism.c
index 3959f09571..504e00c78f 100644
--- a/epan/dissectors/packet-ieee80211-prism.c
+++ b/epan/dissectors/packet-ieee80211-prism.c
@@ -335,6 +335,7 @@ dissect_prism(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.fcs_len = -1;
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "Prism");
diff --git a/epan/dissectors/packet-ieee80211-radio.c b/epan/dissectors/packet-ieee80211-radio.c
index 5a070a53eb..cbcad9bf1f 100644
--- a/epan/dissectors/packet-ieee80211-radio.c
+++ b/epan/dissectors/packet-ieee80211-radio.c
@@ -40,36 +40,66 @@ static int proto_wlan_radio = -1;
/* ************************************************************************* */
/* Header field info values for radio information */
/* ************************************************************************* */
-static int hf_wlan_radio_phy_band = -1;
+static int hf_wlan_radio_phy = -1;
+static int hf_wlan_radio_11_fhss_hop_set = -1;
+static int hf_wlan_radio_11_fhss_hop_pattern = -1;
+static int hf_wlan_radio_11_fhss_hop_index = -1;
+static int hf_wlan_radio_11a_channel_type = -1;
+static int hf_wlan_radio_11a_turbo_type = -1;
+static int hf_wlan_radio_11g_mode = -1;
+static int hf_wlan_radio_11n_mcs_index = -1;
+static int hf_wlan_radio_11n_bandwidth = -1;
+static int hf_wlan_radio_11n_short_gi = -1;
+static int hf_wlan_radio_11n_greenfield = -1;
+static int hf_wlan_radio_11n_ldpc = -1;
+static int hf_wlan_radio_11n_stbc_streams = -1;
+static int hf_wlan_radio_11n_ness = -1;
+static int hf_wlan_radio_11ac_mcs_index = -1;
+static int hf_wlan_radio_11ac_bandwidth = -1;
+static int hf_wlan_radio_11ac_short_gi = -1;
static int hf_wlan_radio_data_rate = -1;
-static int hf_wlan_radio_mcs_index = -1;
-static int hf_wlan_radio_bandwidth = -1;
-static int hf_wlan_radio_short_gi = -1;
static int hf_wlan_radio_channel = -1;
static int hf_wlan_radio_frequency = -1;
+static int hf_wlan_radio_short_preamble = -1;
static int hf_wlan_radio_signal_percent = -1;
static int hf_wlan_radio_signal_dbm = -1;
static int hf_wlan_radio_noise_percent = -1;
static int hf_wlan_radio_noise_dbm = -1;
static int hf_wlan_radio_timestamp = -1;
-static const value_string phy_band_vals[] = {
- { PHDR_802_11_PHY_BAND_11_FHSS, "802.11 FHSS" },
- { PHDR_802_11_PHY_BAND_11B, "802.11b" },
- { PHDR_802_11_PHY_BAND_11A, "802.11a" },
- { PHDR_802_11_PHY_BAND_11G, "802.11g" },
- { PHDR_802_11_PHY_BAND_11G_PURE, "802.11g (pure-g)" },
- { PHDR_802_11_PHY_BAND_11G_MIXED, "802.11g (mixed g/b)" },
- { PHDR_802_11_PHY_BAND_11A_108, "802.11a (turbo)" },
- { PHDR_802_11_PHY_BAND_11G_PURE_108, "802.11g (pure-g, turbo)" },
- { PHDR_802_11_PHY_BAND_11G_MIXED_108, "802.11g (mixed g/b, turbo)" },
- { PHDR_802_11_PHY_BAND_11G_STURBO, "802.11g (static turbo)" },
- { PHDR_802_11_PHY_BAND_11N, "802.11n" },
- { PHDR_802_11_PHY_BAND_11N_5GHZ, "802.11n (5 GHz)" },
- { PHDR_802_11_PHY_BAND_11N_2_4GHZ, "802.11n (2.4 GHz)" },
- { PHDR_802_11_PHY_BAND_11AC, "802.11ac" },
+static const value_string phy_vals[] = {
+ { PHDR_802_11_PHY_11_FHSS, "802.11 FHSS" },
+ { PHDR_802_11_PHY_11_IR, "802.11 IR" },
+ { PHDR_802_11_PHY_11_DSSS, "802.11 DSSS" },
+ { PHDR_802_11_PHY_11B, "802.11b" },
+ { PHDR_802_11_PHY_11A, "802.11a" },
+ { PHDR_802_11_PHY_11G, "802.11g" },
+ { PHDR_802_11_PHY_11N, "802.11n" },
+ { PHDR_802_11_PHY_11AC, "802.11ac" },
{ 0, NULL }
};
+
+static const value_string channel_type_11a_vals[] = {
+ { PHDR_802_11A_CHANNEL_TYPE_NORMAL, "Normal" },
+ { PHDR_802_11A_CHANNEL_TYPE_HALF_CLOCKED, "Half-clocked" },
+ { PHDR_802_11A_CHANNEL_TYPE_QUARTER_CLOCKED, "Quarter-clocked" },
+ { 0, NULL }
+};
+
+static const value_string turbo_type_11a_vals[] = {
+ { PHDR_802_11A_TURBO_TYPE_NORMAL, "Non-turbo" },
+ { PHDR_802_11A_TURBO_TYPE_TURBO, "Turbo" },
+ { PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO, "Dynamic turbo" },
+ { PHDR_802_11A_TURBO_TYPE_STATIC_TURBO, "Static turbo" },
+ { 0, NULL }
+};
+
+static const value_string mode_11g_vals[] = {
+ { PHDR_802_11G_MODE_NORMAL, "None" },
+ { PHDR_802_11G_MODE_SUPER_G, "Super G" },
+ { 0, NULL }
+};
+
static const value_string bandwidth_vals[] = {
{ PHDR_802_11_BANDWIDTH_20_MHZ, "20 MHz" },
{ PHDR_802_11_BANDWIDTH_40_MHZ, "40 MHz" },
@@ -524,33 +554,29 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
have_data_rate = TRUE;
} else {
/* This applies only to 802.11n and 802.11ac */
- if (phdr->presence_flags & PHDR_802_11_HAS_PHY_BAND) {
- switch (phdr->phy_band) {
-
- case PHDR_802_11_PHY_BAND_11N:
- case PHDR_802_11_PHY_BAND_11N_5GHZ:
- case PHDR_802_11_PHY_BAND_11N_2_4GHZ:
- /* Do we have all the fields we need to look it up? */
- {
-#define PHDR_802_11_ALL_MCS_FIELDS \
- (PHDR_802_11_HAS_MCS_INDEX | \
- PHDR_802_11_HAS_BANDWIDTH | \
- PHDR_802_11_HAS_SHORT_GI)
-
- guint bandwidth_40;
-
- if ((phdr->presence_flags & PHDR_802_11_ALL_MCS_FIELDS) == PHDR_802_11_ALL_MCS_FIELDS) {
- bandwidth_40 =
- (phdr->bandwidth == PHDR_802_11_BANDWIDTH_40_MHZ) ?
- 1 : 0;
- if (phdr->mcs_index < MAX_MCS_INDEX) {
- data_rate = ieee80211_float_htrates[phdr->mcs_index][bandwidth_40][phdr->short_gi];
- have_data_rate = TRUE;
- }
+ switch (phdr->phy) {
+
+ case PHDR_802_11_PHY_11N:
+ /* Do we have all the fields we need to look it up? */
+ {
+#define PHDR_802_11N_ALL_MCS_FIELDS \
+ (PHDR_802_11N_HAS_MCS_INDEX | \
+ PHDR_802_11N_HAS_BANDWIDTH | \
+ PHDR_802_11N_HAS_SHORT_GI)
+
+ guint bandwidth_40;
+
+ if ((phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_ALL_MCS_FIELDS) == PHDR_802_11N_ALL_MCS_FIELDS) {
+ bandwidth_40 =
+ (phdr->phy_info.info_11n.bandwidth == PHDR_802_11_BANDWIDTH_40_MHZ) ?
+ 1 : 0;
+ if (phdr->phy_info.info_11n.mcs_index < MAX_MCS_INDEX) {
+ data_rate = ieee80211_float_htrates[phdr->phy_info.info_11n.mcs_index][bandwidth_40][phdr->phy_info.info_11n.short_gi];
+ have_data_rate = TRUE;
}
}
- break;
}
+ break;
}
}
@@ -568,24 +594,99 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
ti = proto_tree_add_item(tree, proto_wlan_radio, tvb, 0, 0, ENC_NA);
radio_tree = proto_item_add_subtree (ti, ett_wlan_radio);
- if (phdr->presence_flags & PHDR_802_11_HAS_PHY_BAND) {
- proto_tree_add_uint(radio_tree, hf_wlan_radio_phy_band, tvb, 0, 0,
- phdr->phy_band);
- }
+ if (phdr->phy != PHDR_802_11_PHY_UNKNOWN) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_phy, tvb, 0, 0,
+ phdr->phy);
- if (phdr->presence_flags & PHDR_802_11_HAS_MCS_INDEX) {
- proto_tree_add_uint(radio_tree, hf_wlan_radio_mcs_index, tvb, 0, 0,
- phdr->mcs_index);
- }
+ switch (phdr->phy) {
- if (phdr->presence_flags & PHDR_802_11_HAS_BANDWIDTH) {
- proto_tree_add_uint(radio_tree, hf_wlan_radio_bandwidth, tvb, 0, 0,
- phdr->bandwidth);
- }
+ case PHDR_802_11_PHY_11_FHSS:
+ if (phdr->phy_info.info_11_fhss.presence_flags & PHDR_802_11_FHSS_HAS_HOP_SET) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11_fhss_hop_set, tvb, 0, 0,
+ phdr->phy_info.info_11_fhss.hop_set);
+ }
+ if (phdr->phy_info.info_11_fhss.presence_flags & PHDR_802_11_FHSS_HAS_HOP_PATTERN) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11_fhss_hop_pattern, tvb, 0, 0,
+ phdr->phy_info.info_11_fhss.hop_pattern);
+ }
+ if (phdr->phy_info.info_11_fhss.presence_flags & PHDR_802_11_FHSS_HAS_HOP_INDEX) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11_fhss_hop_index, tvb, 0, 0,
+ phdr->phy_info.info_11_fhss.hop_index);
+ }
+ break;
+
+ case PHDR_802_11_PHY_11A:
+ if (phdr->phy_info.info_11a.presence_flags & PHDR_802_11A_HAS_CHANNEL_TYPE) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11a_channel_type, tvb, 0, 0,
+ phdr->phy_info.info_11a.channel_type);
+ }
+ if (phdr->phy_info.info_11a.presence_flags & PHDR_802_11A_HAS_TURBO_TYPE) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11a_turbo_type, tvb, 0, 0,
+ phdr->phy_info.info_11a.turbo_type);
+ }
+ break;
+
+ case PHDR_802_11_PHY_11G:
+ if (phdr->phy_info.info_11g.presence_flags & PHDR_802_11G_HAS_MODE) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11g_mode, tvb, 0, 0,
+ phdr->phy_info.info_11g.mode);
+ }
+ break;
+
+ case PHDR_802_11_PHY_11N:
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_MCS_INDEX) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_mcs_index, tvb, 0, 0,
+ phdr->phy_info.info_11n.mcs_index);
+ }
+
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_BANDWIDTH) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11n_bandwidth, tvb, 0, 0,
+ phdr->phy_info.info_11n.bandwidth);
+ }
+
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_SHORT_GI) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_short_gi, tvb, 0, 0,
+ phdr->phy_info.info_11n.short_gi);
+ }
+
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_GREENFIELD) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_greenfield, tvb, 0, 0,
+ phdr->phy_info.info_11n.greenfield);
+ }
+
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_LDPC) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_ldpc, tvb, 0, 0,
+ phdr->phy_info.info_11n.ldpc);
+ }
+
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_STBC_STREAMS) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_stbc_streams, tvb, 0, 0,
+ phdr->phy_info.info_11n.stbc_streams);
+ }
+
+ if (phdr->phy_info.info_11n.presence_flags & PHDR_802_11N_HAS_NESS) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_11n_ness, tvb, 0, 0,
+ phdr->phy_info.info_11n.ness);
+ }
+ break;
+
+ case PHDR_802_11_PHY_11AC:
+ if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_MCS_INDEX) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11ac_mcs_index, tvb, 0, 0,
+ phdr->phy_info.info_11ac.mcs_index);
+ }
- if (phdr->presence_flags & PHDR_802_11_HAS_SHORT_GI) {
- proto_tree_add_boolean(radio_tree, hf_wlan_radio_short_gi, tvb, 0, 0,
- phdr->short_gi);
+ if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_BANDWIDTH) {
+ proto_tree_add_uint(radio_tree, hf_wlan_radio_11ac_bandwidth, tvb, 0, 0,
+ phdr->phy_info.info_11ac.bandwidth);
+ }
+
+ if (phdr->phy_info.info_11ac.presence_flags & PHDR_802_11AC_HAS_SHORT_GI) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_11ac_short_gi, tvb, 0, 0,
+ phdr->phy_info.info_11ac.short_gi);
+ }
+ break;
+ }
}
if (have_data_rate) {
@@ -609,6 +710,11 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
phdr->frequency);
}
+ if (phdr->presence_flags & PHDR_802_11_HAS_SHORT_PREAMBLE) {
+ proto_tree_add_boolean(radio_tree, hf_wlan_radio_short_preamble, tvb, 0, 0,
+ phdr->short_preamble);
+ }
+
if (phdr->presence_flags & PHDR_802_11_HAS_SIGNAL_PERCENT) {
col_add_fstr(pinfo->cinfo, COL_RSSI, "%u%%", phdr->signal_percent);
proto_tree_add_uint_format_value(radio_tree, hf_wlan_radio_signal_percent, tvb, 0, 0,
@@ -651,26 +757,78 @@ dissect_wlan_radio (tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree, void
}
static hf_register_info hf_wlan_radio[] = {
- {&hf_wlan_radio_phy_band,
- {"PHY type and band", "wlan_radio.phy_band", FT_UINT32, BASE_DEC, VALS(phy_band_vals), 0,
+ {&hf_wlan_radio_phy,
+ {"PHY type", "wlan_radio.phy", FT_UINT32, BASE_DEC, VALS(phy_vals), 0,
NULL, HFILL }},
- {&hf_wlan_radio_data_rate,
- {"Data rate", "wlan_radio.data_rate", FT_FLOAT, BASE_NONE, NULL, 0,
- "Data rate (bits/s)", HFILL }},
+ {&hf_wlan_radio_11_fhss_hop_set,
+ {"Hop set", "wlan_radio.fhss.hop_set", FT_UINT8, BASE_HEX, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11_fhss_hop_pattern,
+ {"Hop pattern", "wlan_radio.fhss.hop_pattern", FT_UINT8, BASE_HEX, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11_fhss_hop_index,
+ {"Hop index", "wlan_radio.fhss.hop_index", FT_UINT8, BASE_HEX, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11a_channel_type,
+ {"Channel type", "wlan_radio.11a.channel_type", FT_UINT32, BASE_DEC, VALS(channel_type_11a_vals), 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11a_turbo_type,
+ {"Turbo type", "wlan_radio.11a.turbo_type", FT_UINT32, BASE_DEC, VALS(turbo_type_11a_vals), 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11g_mode,
+ {"Proprietary mode", "wlan_radio.11g.mode", FT_UINT32, BASE_DEC, VALS(mode_11g_vals), 0,
+ NULL, HFILL }},
- {&hf_wlan_radio_mcs_index,
- {"MCS index", "wlan_radio.mcs_index", FT_UINT32, BASE_DEC, NULL, 0,
+ {&hf_wlan_radio_11n_mcs_index,
+ {"MCS index", "wlan_radio.11n.mcs_index", FT_UINT32, BASE_DEC, NULL, 0,
NULL, HFILL }},
- {&hf_wlan_radio_bandwidth,
- {"Bandwidth", "wlan_radio.bandwidth", FT_UINT32, BASE_DEC, VALS(bandwidth_vals), 0,
+ {&hf_wlan_radio_11n_bandwidth,
+ {"Bandwidth", "wlan_radio.11n.bandwidth", FT_UINT32, BASE_DEC, VALS(bandwidth_vals), 0,
NULL, HFILL }},
- {&hf_wlan_radio_short_gi,
- {"Short GI", "wlan_radio.short_gi", FT_BOOLEAN, 0, NULL, 0,
+ {&hf_wlan_radio_11n_short_gi,
+ {"Short GI", "wlan_radio.11n.short_gi", FT_BOOLEAN, 0, NULL, 0,
NULL, HFILL }},
+ {&hf_wlan_radio_11n_greenfield,
+ {"Greenfield", "wlan_radio.11n.greenfield", FT_BOOLEAN, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11n_ldpc,
+ {"FEC is LDPC", "wlan_radio.11n.ldpc", FT_BOOLEAN, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11n_stbc_streams,
+ {"Number of STBC streams", "wlan_radio.11n.stbc_streams", FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11n_ness,
+ {"Number of extension spatial streams", "wlan_radio.11n.ness", FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11ac_mcs_index,
+ {"MCS index", "wlan_radio.11ac.mcs_index", FT_UINT32, BASE_DEC, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11ac_bandwidth,
+ {"Bandwidth", "wlan_radio.11ac.bandwidth", FT_UINT32, BASE_DEC, VALS(bandwidth_vals), 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_11ac_short_gi,
+ {"Short GI", "wlan_radio.11ac.short_gi", FT_BOOLEAN, 0, NULL, 0,
+ NULL, HFILL }},
+
+ {&hf_wlan_radio_data_rate,
+ {"Data rate", "wlan_radio.data_rate", FT_FLOAT, BASE_NONE, NULL, 0,
+ "Data rate (bits/s)", HFILL }},
+
{&hf_wlan_radio_channel,
{"Channel", "wlan_radio.channel", FT_UINT8, BASE_DEC, NULL, 0,
"802.11 channel number that this frame was sent/received on", HFILL }},
@@ -679,6 +837,10 @@ static hf_register_info hf_wlan_radio[] = {
{"Frequency", "wlan_radio.frequency", FT_UINT16, BASE_DEC, NULL, 0,
"Center frequency of the 802.11 channel that this frame was sent/received on", HFILL }},
+ {&hf_wlan_radio_short_preamble,
+ {"Short preamble", "wlan_radio.short_preamble", FT_BOOLEAN, BASE_NONE, NULL, 0,
+ NULL, HFILL }},
+
{&hf_wlan_radio_signal_percent,
{"Signal strength (percentage)", "wlan_radio.signal_dbm", FT_UINT8, BASE_DEC, NULL, 0,
"Signal strength, as percentage of maximum RSSI", HFILL }},
diff --git a/epan/dissectors/packet-ieee80211-radiotap.c b/epan/dissectors/packet-ieee80211-radiotap.c
index 02ac911a95..1a78a224e4 100644
--- a/epan/dissectors/packet-ieee80211-radiotap.c
+++ b/epan/dissectors/packet-ieee80211-radiotap.c
@@ -250,6 +250,8 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree);
*/
#define IEEE80211_CHAN_FHSS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
+#define IEEE80211_CHAN_DSSS \
+ (IEEE80211_CHAN_2GHZ)
#define IEEE80211_CHAN_A \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_B \
@@ -589,6 +591,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
phdr.fcs_len = -1;
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
@@ -826,6 +829,7 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
phdr.fcs_len = 4;
else
phdr.fcs_len = 0;
+ phdr.short_preamble = (rflags & IEEE80211_RADIOTAP_F_SHORTPRE) != 0;
if (tree) {
proto_tree *flags_tree;
@@ -944,38 +948,51 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
switch (cflags & IEEE80211_CHAN_ALLTURBO) {
case IEEE80211_CHAN_FHSS:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11_FHSS;
+ phdr.phy = PHDR_802_11_PHY_11_FHSS;
+ phdr.phy_info.info_11_fhss.presence_flags = 0;
+ break;
+
+ case IEEE80211_CHAN_DSSS:
+ phdr.phy = PHDR_802_11_PHY_11_DSSS;
break;
case IEEE80211_CHAN_A:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11A;
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL;
break;
case IEEE80211_CHAN_B:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr.phy = PHDR_802_11_PHY_11B;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
break;
case IEEE80211_CHAN_PUREG:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_PURE;
+ phdr.phy = PHDR_802_11_PHY_11G;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
break;
case IEEE80211_CHAN_G:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_MIXED;
+ phdr.phy = PHDR_802_11_PHY_11G;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
break;
case IEEE80211_CHAN_108A:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11A_108;
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ /* We assume non-STURBO is dynamic turbo */
+ phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO;
break;
case IEEE80211_CHAN_108PUREG:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_PURE_108;
+ phdr.phy = PHDR_802_11_PHY_11G;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G;
break;
}
if (tree) {
@@ -1015,12 +1032,23 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
}
case IEEE80211_RADIOTAP_FHSS:
+ /*
+ * Just in case we didn't have a Channel field or
+ * it said this was something other than 11 legacy
+ * FHSS.
+ */
+ phdr.phy = PHDR_802_11_PHY_11_FHSS;
+ phdr.phy_info.info_11_fhss.presence_flags =
+ PHDR_802_11_FHSS_HAS_HOP_SET |
+ PHDR_802_11_FHSS_HAS_HOP_PATTERN;
+ phdr.phy_info.info_11_fhss.hop_set = tvb_get_guint8(tvb, offset);
+ phdr.phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(tvb, offset + 1);
proto_tree_add_item(radiotap_tree,
hf_radiotap_fhss_hopset, tvb,
offset, 1, ENC_BIG_ENDIAN);
proto_tree_add_item(radiotap_tree,
hf_radiotap_fhss_pattern, tvb,
- offset, 1, ENC_BIG_ENDIAN);
+ offset + 1, 1, ENC_BIG_ENDIAN);
break;
case IEEE80211_RADIOTAP_DBM_ANTSIGNAL:
@@ -1139,72 +1167,75 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
switch (xcflags & IEEE80211_CHAN_ALLTURBO) {
case IEEE80211_CHAN_FHSS:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11_FHSS;
+ /*
+ * Don't overwrite any FHSS information
+ * we've seen before this.
+ */
+ if (phdr.phy != PHDR_802_11_PHY_11_FHSS) {
+ phdr.phy = PHDR_802_11_PHY_11_FHSS;
+ phdr.phy_info.info_11_fhss.presence_flags = 0;
+ }
+ break;
+
+ case IEEE80211_CHAN_DSSS:
+ phdr.phy = PHDR_802_11_PHY_11_DSSS;
break;
case IEEE80211_CHAN_A:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11A;
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL;
break;
case IEEE80211_CHAN_B:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr.phy = PHDR_802_11_PHY_11B;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
break;
case IEEE80211_CHAN_PUREG:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_PURE;
+ phdr.phy = PHDR_802_11_PHY_11G;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
break;
case IEEE80211_CHAN_G:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_MIXED;
+ phdr.phy = PHDR_802_11_PHY_11G;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
break;
case IEEE80211_CHAN_108A:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11A_108;
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ /* We assume non-STURBO is dynamic turbo */
+ phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO;
break;
case IEEE80211_CHAN_108PUREG:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_PURE_108;
+ phdr.phy = PHDR_802_11_PHY_11G;
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr.phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G;
break;
case IEEE80211_CHAN_ST:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_STURBO;
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ phdr.phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_STATIC_TURBO;
break;
case IEEE80211_CHAN_A|IEEE80211_CHAN_HT20:
case IEEE80211_CHAN_A|IEEE80211_CHAN_HT40D:
case IEEE80211_CHAN_A|IEEE80211_CHAN_HT40U:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11N_5GHZ;
-
- /*
- * This doesn't supply "short GI" information,
- * so use the 0x80 bit in the Flags field,
- * if we have it; it's "Currently unspecified
- * but used" for that purpose, according to
- * the radiotap.org page for that field.
- */
- if (have_rflags) {
- phdr.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
- if (rflags & 0x80)
- phdr.short_gi = 1;
- else
- phdr.short_gi = 0;
- }
- break;
-
case IEEE80211_CHAN_G|IEEE80211_CHAN_HT20:
case IEEE80211_CHAN_G|IEEE80211_CHAN_HT40U:
case IEEE80211_CHAN_G|IEEE80211_CHAN_HT40D:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11N_2_4GHZ;
+ phdr.phy = PHDR_802_11_PHY_11N;
+ /* 11n only has "short preamble" in 11b/11g mode */
+ phdr.presence_flags &= ~PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11n.presence_flags = 0;
/*
* This doesn't supply "short GI" information,
@@ -1214,11 +1245,11 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
* the radiotap.org page for that field.
*/
if (have_rflags) {
- phdr.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
if (rflags & 0x80)
- phdr.short_gi = 1;
+ phdr.phy_info.info_11n.short_gi = 1;
else
- phdr.short_gi = 0;
+ phdr.phy_info.info_11n.short_gi = 0;
}
break;
}
@@ -1280,27 +1311,6 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
guint gi_length;
gboolean can_calculate_rate;
- /* This is for 802.11n */
- if (phdr.presence_flags & PHDR_802_11_HAS_PHY_BAND) {
- /*
- * If we have A or G, this means it's really
- * N in the 5 GHz band or N in the 2.4 GHz
- * band, respectively.
- */
- switch (phdr.phy_band) {
-
- case PHDR_802_11_PHY_BAND_11A:
- phdr.phy_band = PHDR_802_11_PHY_BAND_11N_5GHZ;
- break;
-
- case PHDR_802_11_PHY_BAND_11G:
- case PHDR_802_11_PHY_BAND_11G_PURE:
- case PHDR_802_11_PHY_BAND_11G_MIXED:
- phdr.phy_band = PHDR_802_11_PHY_BAND_11N_2_4GHZ;
- break;
- }
- }
-
/*
* Start out assuming that we can calculate the rate;
* if we are missing any of the MCS index, channel
@@ -1309,44 +1319,55 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
can_calculate_rate = TRUE;
mcs_known = tvb_get_guint8(tvb, offset);
+ /*
+ * If there's actually any data here, not an
+ * empty field, this is 802.11n.
+ */
+ if (mcs_known != 0) {
+ phdr.phy = PHDR_802_11_PHY_11N;
+ /* 11n only has "short preamble" in 11b/11g mode */
+ phdr.presence_flags &= ~PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11n.presence_flags = 0;
+ }
+
mcs_flags = tvb_get_guint8(tvb, offset + 1);
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_MCS) {
mcs = tvb_get_guint8(tvb, offset + 2);
- phdr.presence_flags |= PHDR_802_11_HAS_MCS_INDEX;
- phdr.mcs_index = mcs;
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
+ phdr.phy_info.info_11n.mcs_index = mcs;
} else {
mcs = 0;
can_calculate_rate = FALSE; /* no MCS index */
}
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_BW) {
- phdr.presence_flags |= PHDR_802_11_HAS_BANDWIDTH;
- phdr.bandwidth = (mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK);
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_BANDWIDTH;
+ phdr.phy_info.info_11n.bandwidth = (mcs_flags & IEEE80211_RADIOTAP_MCS_BW_MASK);
}
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_GI) {
gi_length = (mcs_flags & IEEE80211_RADIOTAP_MCS_SGI) ?
1 : 0;
- phdr.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
- phdr.short_gi = (gi_length == 0);
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+ phdr.phy_info.info_11n.short_gi = (gi_length == 0);
} else {
gi_length = 0;
can_calculate_rate = FALSE; /* no GI width */
}
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FMT) {
- phdr.presence_flags |= PHDR_802_11_HAS_GREENFIELD;
- phdr.greenfield = (mcs_flags & IEEE80211_RADIOTAP_MCS_FMT_GF) != 0;
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_GREENFIELD;
+ phdr.phy_info.info_11n.greenfield = (mcs_flags & IEEE80211_RADIOTAP_MCS_FMT_GF) != 0;
}
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_FEC) {
- phdr.presence_flags |= PHDR_802_11_HAS_LDPC;
- phdr.ldpc = (mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC) != 0;
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_LDPC;
+ phdr.phy_info.info_11n.ldpc = (mcs_flags & IEEE80211_RADIOTAP_MCS_FEC_LDPC) != 0;
}
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_STBC) {
- phdr.presence_flags |= PHDR_802_11_HAS_STBC_STREAMS;
- phdr.stbc_streams = (mcs_flags & IEEE80211_RADIOTAP_MCS_STBC_MASK) >> IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_STBC_STREAMS;
+ phdr.phy_info.info_11n.stbc_streams = (mcs_flags & IEEE80211_RADIOTAP_MCS_STBC_MASK) >> IEEE80211_RADIOTAP_MCS_STBC_SHIFT;
}
if (mcs_known & IEEE80211_RADIOTAP_MCS_HAVE_NESS) {
- phdr.presence_flags |= PHDR_802_11_HAS_NESS;
+ phdr.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_NESS;
/* This is stored a bit weirdly */
- phdr.ness =
+ phdr.phy_info.info_11n.ness =
((mcs_known & IEEE80211_RADIOTAP_MCS_NESS_BIT1) >> 6) |
((mcs_flags & IEEE80211_RADIOTAP_MCS_NESS_BIT0) >> 7);
}
@@ -1490,10 +1511,6 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
gboolean can_calculate_rate;
guint i;
- /* This is for 802.11ac */
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11AC;
-
/*
* Start out assuming that we can calculate the rate;
* if we are missing any of the MCS index, channel
@@ -1502,6 +1519,15 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
can_calculate_rate = TRUE;
known = tvb_get_letohs(tvb, offset);
+ /*
+ * If there's actually any data here, not an
+ * empty field, this is 802.11ac.
+ */
+ if (known != 0) {
+ phdr.phy = PHDR_802_11_PHY_11AC;
+ phdr.presence_flags &= ~PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.phy_info.info_11ac.presence_flags = 0;
+ }
vht_flags = tvb_get_guint8(tvb, offset + 2);
if (tree) {
@@ -1546,8 +1572,8 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
if (known & IEEE80211_RADIOTAP_VHT_HAVE_GI) {
gi_length = (vht_flags & IEEE80211_RADIOTAP_VHT_SGI) ? 1 : 0;
- phdr.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
- phdr.short_gi = (gi_length == 0);
+ phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI;
+ phdr.phy_info.info_11ac.short_gi = (gi_length == 0);
if (vht_tree) {
proto_tree_add_item(vht_tree, hf_radiotap_vht_gi,
tvb, offset + 2, 1, ENC_LITTLE_ENDIAN);
@@ -1582,8 +1608,8 @@ dissect_radiotap(tvbuff_t * tvb, packet_info * pinfo, proto_tree * tree)
if (known & IEEE80211_RADIOTAP_VHT_HAVE_BW) {
bw = tvb_get_guint8(tvb, offset + 3) & IEEE80211_RADIOTAP_VHT_BW_MASK;
- phdr.presence_flags |= PHDR_802_11_HAS_BANDWIDTH;
- phdr.bandwidth = bw;
+ phdr.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_BANDWIDTH;
+ phdr.phy_info.info_11ac.bandwidth = bw;
if (bw < sizeof(ieee80211_vht_bw2rate_index)/sizeof(ieee80211_vht_bw2rate_index[0]))
bandwidth = ieee80211_vht_bw2rate_index[bw];
else
diff --git a/epan/dissectors/packet-ieee80211-wlancap.c b/epan/dissectors/packet-ieee80211-wlancap.c
index bd6675cf80..3004c0fdac 100644
--- a/epan/dissectors/packet-ieee80211-wlancap.c
+++ b/epan/dissectors/packet-ieee80211-wlancap.c
@@ -27,6 +27,7 @@
#include <epan/packet.h>
#include <wiretap/wtap.h>
#include <wsutil/pint.h>
+#include <wsutil/frequency-utils.h>
#include "packet-ieee80211.h"
@@ -38,33 +39,35 @@ static dissector_handle_t ieee80211_radio_handle;
static int proto_wlancap = -1;
/* AVS WLANCAP radio header */
-static int hf_wlan_magic = -1;
-static int hf_wlan_version = -1;
-static int hf_wlan_length = -1;
-static int hf_wlan_phytype = -1;
-static int hf_wlan_antenna = -1;
-static int hf_wlan_priority = -1;
-static int hf_wlan_ssi_type = -1;
-static int hf_wlan_preamble = -1;
-static int hf_wlan_encoding = -1;
-static int hf_wlan_sequence = -1;
-static int hf_wlan_drops = -1;
-static int hf_wlan_receiver_addr = -1;
-static int hf_wlan_padding = -1;
-
-static int hf_mactime = -1;
-static int hf_hosttime = -1;
-static int hf_channel_frequency = -1;
-static int hf_data_rate = -1;
-static int hf_channel = -1;
-static int hf_dbm_antnoise = -1;
-static int hf_rawrssi_antnoise = -1;
-static int hf_normrssi_antnoise = -1;
-static int hf_rawrssi_antsignal = -1;
-static int hf_dbm_antsignal = -1;
-static int hf_normrssi_antsignal = -1;
-
-static gint ett_radio = -1;
+static int hf_wlancap_magic = -1;
+static int hf_wlancap_version = -1;
+static int hf_wlancap_length = -1;
+static int hf_wlancap_mactime = -1;
+static int hf_wlancap_hosttime = -1;
+static int hf_wlancap_phytype = -1;
+static int hf_wlancap_hop_set = -1;
+static int hf_wlancap_hop_pattern = -1;
+static int hf_wlancap_hop_index = -1;
+static int hf_wlancap_channel = -1;
+static int hf_wlancap_channel_frequency = -1;
+static int hf_wlancap_data_rate = -1;
+static int hf_wlancap_antenna = -1;
+static int hf_wlancap_priority = -1;
+static int hf_wlancap_ssi_type = -1;
+static int hf_wlancap_normrssi_antsignal = -1;
+static int hf_wlancap_dbm_antsignal = -1;
+static int hf_wlancap_rawrssi_antsignal = -1;
+static int hf_wlancap_normrssi_antnoise = -1;
+static int hf_wlancap_dbm_antnoise = -1;
+static int hf_wlancap_rawrssi_antnoise = -1;
+static int hf_wlancap_preamble = -1;
+static int hf_wlancap_encoding = -1;
+static int hf_wlancap_sequence = -1;
+static int hf_wlancap_drops = -1;
+static int hf_wlancap_receiver_addr = -1;
+static int hf_wlancap_padding = -1;
+
+static gint ett_wlancap = -1;
static dissector_handle_t wlancap_handle;
@@ -355,6 +358,8 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
guint32 version;
guint32 length;
guint32 channel;
+ guint frequency;
+ gint calc_channel;
guint32 datarate;
guint32 ssi_type;
gint32 dbm;
@@ -365,6 +370,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.fcs_len = -1;
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "WLAN");
@@ -384,89 +390,116 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Dissect the AVS header */
if (tree) {
ti = proto_tree_add_item(tree, proto_wlancap, tvb, 0, length, ENC_NA);
- wlan_tree = proto_item_add_subtree(ti, ett_radio);
- proto_tree_add_item(wlan_tree, hf_wlan_magic, tvb, offset, 4, ENC_BIG_ENDIAN);
- proto_tree_add_item(wlan_tree, hf_wlan_version, tvb, offset, 4, ENC_BIG_ENDIAN);
+ wlan_tree = proto_item_add_subtree(ti, ett_wlancap);
+ proto_tree_add_item(wlan_tree, hf_wlancap_magic, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_version, tvb, offset, 4, ENC_BIG_ENDIAN);
}
offset+=4;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_length, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_length, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
phdr.presence_flags |= PHDR_802_11_HAS_TSF_TIMESTAMP;
phdr.tsf_timestamp = tvb_get_ntoh64(tvb, offset);
if (tree)
- proto_tree_add_item(wlan_tree, hf_mactime, tvb, offset, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_mactime, tvb, offset, 8, ENC_BIG_ENDIAN);
offset+=8;
if (tree)
- proto_tree_add_item(wlan_tree, hf_hosttime, tvb, offset, 8, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_hosttime, tvb, offset, 8, ENC_BIG_ENDIAN);
offset+=8;
switch (tvb_get_ntohl(tvb, offset)) {
case 1:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11_FHSS;
+ phdr.phy = PHDR_802_11_PHY_11_FHSS;
+ phdr.phy_info.info_11_fhss.presence_flags = 0;
break;
case 2:
- /* Legacy 802.11 DHSS */
+ phdr.phy = PHDR_802_11_PHY_11_DSSS;
break;
case 3:
- /* Legacy 802.11 IR */
+ phdr.phy = PHDR_802_11_PHY_11_IR;
break;
case 4:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr.phy = PHDR_802_11_PHY_11B;
break;
case 5:
/* 11b PBCC? */
+ phdr.phy = PHDR_802_11_PHY_11B;
break;
case 6:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_PURE;
+ phdr.phy = PHDR_802_11_PHY_11G; /* pure? */
+ phdr.phy_info.info_11g.presence_flags = 0;
break;
case 7:
/* 11a PBCC? */
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = 0;
break;
case 8:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11A;
+ phdr.phy = PHDR_802_11_PHY_11A;
+ phdr.phy_info.info_11a.presence_flags = 0;
break;
case 9:
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11G_MIXED;
+ phdr.phy = PHDR_802_11_PHY_11G; /* mixed? */
+ phdr.phy_info.info_11g.presence_flags = 0;
break;
}
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_phytype, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_phytype, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
- /* XXX cook channel (fh uses different numbers) */
- channel = tvb_get_ntohl(tvb, offset);
- if (channel < 256) {
- col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", channel);
- phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
- phdr.channel = channel;
+ if (phdr.phy == PHDR_802_11_PHY_11_FHSS) {
+ phdr.phy_info.info_11_fhss.presence_flags =
+ PHDR_802_11_FHSS_HAS_HOP_SET |
+ PHDR_802_11_FHSS_HAS_HOP_PATTERN |
+ PHDR_802_11_FHSS_HAS_HOP_INDEX;
+ phdr.phy_info.info_11_fhss.hop_set = tvb_get_guint8(tvb, offset);
if (tree)
- proto_tree_add_uint(wlan_tree, hf_channel, tvb, offset, 4, channel);
- } else if (channel < 10000) {
- col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u MHz", channel);
- phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
- phdr.frequency = channel;
+ proto_tree_add_item(wlan_tree, hf_wlancap_hop_set, tvb, offset, 1, ENC_NA);
+ phdr.phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(tvb, offset + 1);
if (tree)
- proto_tree_add_uint_format(wlan_tree, hf_channel_frequency, tvb, offset,
- 4, channel, "Frequency: %u MHz", channel);
- } else {
- col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u KHz", channel);
+ proto_tree_add_item(wlan_tree, hf_wlancap_hop_pattern, tvb, offset + 1, 1, ENC_NA);
+ phdr.phy_info.info_11_fhss.hop_index = tvb_get_guint8(tvb, offset + 2);
if (tree)
- proto_tree_add_uint_format(wlan_tree, hf_channel_frequency, tvb, offset,
- 4, channel, "Frequency: %u KHz", channel);
+ proto_tree_add_item(wlan_tree, hf_wlancap_hop_index, tvb, offset + 2, 1, ENC_NA);
+ } else {
+ channel = tvb_get_ntohl(tvb, offset);
+ if (channel < 256) {
+ col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u", channel);
+ phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+ phdr.channel = channel;
+ if (tree)
+ proto_tree_add_uint(wlan_tree, hf_wlancap_channel, tvb, offset, 4, channel);
+ frequency = ieee80211_chan_to_mhz(channel, (phdr.phy != PHDR_802_11_PHY_11A));
+ if (frequency != 0) {
+ phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+ phdr.frequency = frequency;
+ }
+ } else if (channel < 10000) {
+ col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u MHz", channel);
+ phdr.presence_flags |= PHDR_802_11_HAS_FREQUENCY;
+ phdr.frequency = channel;
+ if (tree)
+ proto_tree_add_uint_format(wlan_tree, hf_wlancap_channel_frequency, tvb, offset,
+ 4, channel, "Frequency: %u MHz", channel);
+ calc_channel = ieee80211_mhz_to_chan(channel);
+ if (calc_channel != -1) {
+ phdr.presence_flags |= PHDR_802_11_HAS_CHANNEL;
+ phdr.channel = calc_channel;
+ }
+ } else {
+ col_add_fstr(pinfo->cinfo, COL_FREQ_CHAN, "%u KHz", channel);
+ if (tree)
+ proto_tree_add_uint_format(wlan_tree, hf_wlancap_channel_frequency, tvb, offset,
+ 4, channel, "Frequency: %u KHz", channel);
+ }
}
offset+=4;
datarate = tvb_get_ntohl(tvb, offset);
@@ -488,7 +521,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
}
if (tree) {
- proto_tree_add_uint64_format_value(wlan_tree, hf_data_rate, tvb, offset, 4,
+ proto_tree_add_uint64_format_value(wlan_tree, hf_wlancap_data_rate, tvb, offset, 4,
datarate,
"%u.%u Mb/s",
datarate/1000000,
@@ -496,14 +529,14 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
}
offset+=4;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_antenna, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_antenna, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_priority, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_priority, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
ssi_type = tvb_get_ntohl(tvb, offset);
if (tree)
- proto_tree_add_uint(wlan_tree, hf_wlan_ssi_type, tvb, offset, 4, ssi_type);
+ proto_tree_add_uint(wlan_tree, hf_wlancap_ssi_type, tvb, offset, 4, ssi_type);
offset+=4;
switch (ssi_type) {
@@ -516,7 +549,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
/* Normalized RSSI */
col_add_fstr(pinfo->cinfo, COL_RSSI, "%u (norm)", tvb_get_ntohl(tvb, offset));
if (tree)
- proto_tree_add_item(wlan_tree, hf_normrssi_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_normrssi_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
case SSI_DBM:
@@ -526,14 +559,14 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.signal_dbm = dbm;
col_add_fstr(pinfo->cinfo, COL_RSSI, "%d dBm", dbm);
if (tree)
- proto_tree_add_item(wlan_tree, hf_dbm_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_dbm_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
case SSI_RAW_RSSI:
/* Raw RSSI */
col_add_fstr(pinfo->cinfo, COL_RSSI, "%u (raw)", tvb_get_ntohl(tvb, offset));
if (tree)
- proto_tree_add_item(wlan_tree, hf_rawrssi_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_rawrssi_antsignal, tvb, offset, 4, ENC_BIG_ENDIAN);
break;
}
offset+=4;
@@ -550,7 +583,7 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
case SSI_NORM_RSSI:
/* Normalized RSSI */
if (tree)
- proto_tree_add_uint(wlan_tree, hf_normrssi_antnoise, tvb, offset, 4, antnoise);
+ proto_tree_add_uint(wlan_tree, hf_wlancap_normrssi_antnoise, tvb, offset, 4, antnoise);
break;
case SSI_DBM:
@@ -561,35 +594,65 @@ dissect_wlancap(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.noise_dbm = antnoise;
}
if (tree)
- proto_tree_add_int(wlan_tree, hf_dbm_antnoise, tvb, offset, 4, antnoise);
+ proto_tree_add_int(wlan_tree, hf_wlancap_dbm_antnoise, tvb, offset, 4, antnoise);
break;
case SSI_RAW_RSSI:
/* Raw RSSI */
if (tree)
- proto_tree_add_uint(wlan_tree, hf_rawrssi_antnoise, tvb, offset, 4, antnoise);
+ proto_tree_add_uint(wlan_tree, hf_wlancap_rawrssi_antnoise, tvb, offset, 4, antnoise);
break;
}
}
offset+=4;
+ switch (tvb_get_ntohl(tvb, offset)) {
+
+ case 0:
+ /* Undefined, so we don't know if there's a short preamble */
+ break;
+
+ case 1:
+ /*
+ * Short preamble.
+ * We assume this is present only for PHYs that support variable
+ * preamble lengths.
+ */
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.short_preamble = TRUE;
+ break;
+
+ case 2:
+ /*
+ * Long preamble.
+ * We assume this is present only for PHYs that support variable
+ * preamble lengths.
+ */
+ phdr.presence_flags |= PHDR_802_11_HAS_SHORT_PREAMBLE;
+ phdr.short_preamble = FALSE;
+ break;
+
+ default:
+ /* Invalid, so we don't know if there's a short preamble. */
+ break;
+ }
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_preamble, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_preamble, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_encoding, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_encoding, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
if (version > 1) {
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_sequence, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_sequence, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_drops, tvb, offset, 4, ENC_BIG_ENDIAN);
+ proto_tree_add_item(wlan_tree, hf_wlancap_drops, tvb, offset, 4, ENC_BIG_ENDIAN);
offset+=4;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_receiver_addr, tvb, offset, 6, ENC_NA);
+ proto_tree_add_item(wlan_tree, hf_wlancap_receiver_addr, tvb, offset, 6, ENC_NA);
offset+=6;
if (tree)
- proto_tree_add_item(wlan_tree, hf_wlan_padding, tvb, offset, 2, ENC_NA);
+ proto_tree_add_item(wlan_tree, hf_wlancap_padding, tvb, offset, 2, ENC_NA);
/*offset+=2;*/
}
@@ -644,81 +707,117 @@ static const value_string preamble_type[] = {
};
static hf_register_info hf_wlancap[] = {
- {&hf_mactime,
- {"MAC timestamp", "wlan.mactime", FT_UINT64, BASE_DEC, NULL, 0x0,
+ {&hf_wlancap_magic,
+ {"Header magic", "wlancap.magic", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_version,
+ {"Header revision", "wlancap.version", FT_UINT32, BASE_DEC, NULL, 0xF,
+ NULL, HFILL }},
+
+ {&hf_wlancap_length,
+ {"Header length", "wlancap.length", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_mactime,
+ {"MAC timestamp", "wlancap.mactime", FT_UINT64, BASE_DEC, NULL, 0x0,
"Value in microseconds of the MAC's Time Synchronization Function timer when the first bit of the MPDU arrived at the MAC", HFILL }},
- {&hf_hosttime,
- {"Host timestamp", "wlan.hosttime", FT_UINT64, BASE_DEC, NULL, 0x0,
+ {&hf_wlancap_hosttime,
+ {"Host timestamp", "wlancap.hosttime", FT_UINT64, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_phytype,
+ {"PHY type", "wlancap.phytype", FT_UINT32, BASE_DEC, VALS(phy_type), 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_hop_set,
+ {"Hop set", "wlancap.fhss.hop_set", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_hop_pattern,
+ {"Hop pattern", "wlancap.fhss.hop_pattern", FT_UINT8, BASE_HEX, NULL, 0x0,
NULL, HFILL }},
- {&hf_channel_frequency,
- {"Channel frequency", "wlan.channel_frequency", FT_UINT32, BASE_DEC, NULL, 0x0,
+ {&hf_wlancap_hop_index,
+ {"Hop index", "wlancap.fhss.hop_index", FT_UINT8, BASE_HEX, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_channel,
+ {"Channel", "wlancap.channel", FT_UINT8, BASE_DEC, NULL, 0x0,
+ "802.11 channel number that this frame was sent/received on", HFILL }},
+
+ {&hf_wlancap_channel_frequency,
+ {"Channel frequency", "wlancap.channel_frequency", FT_UINT32, BASE_DEC, NULL, 0x0,
"Channel frequency in megahertz that this frame was sent/received on", HFILL }},
- {&hf_data_rate,
- {"Data Rate", "wlan.data_rate", FT_UINT64, BASE_DEC, NULL, 0,
+ {&hf_wlancap_data_rate,
+ {"Data Rate", "wlancap.data_rate", FT_UINT64, BASE_DEC, NULL, 0x0,
"Data rate (b/s)", HFILL }},
- {&hf_channel,
- {"Channel", "wlan.channel", FT_UINT8, BASE_DEC, NULL, 0,
- "802.11 channel number that this frame was sent/received on", HFILL }},
- {&hf_wlan_antenna,
- {"Antenna", "wlan.antenna", FT_UINT32, BASE_DEC, NULL, 0x0,
+ {&hf_wlancap_antenna,
+ {"Antenna", "wlancap.antenna", FT_UINT32, BASE_DEC, NULL, 0x0,
"Antenna number this frame was sent/received over (starting at 0)", HFILL } },
- {&hf_rawrssi_antnoise,
- {"Raw RSSI Noise", "wlan.rawrssi_antnoise", FT_UINT32, BASE_DEC, NULL, 0x0,
- "RF noise power at the antenna, reported as RSSI by the adapter", HFILL }},
- {&hf_dbm_antnoise,
- {"SSI Noise (dBm)", "wlan.dbm_antnoise", FT_INT32, BASE_DEC, NULL, 0x0,
- "RF noise power at the antenna from a fixed, arbitrary value in decibels per one milliwatt", HFILL }},
- {&hf_normrssi_antnoise,
- {"Normalized RSSI Noise", "wlan.normrssi_antnoise", FT_UINT32, BASE_DEC, NULL, 0x0,
- "RF noise power at the antenna, normalized to the range 0-1000", HFILL }},
- {&hf_rawrssi_antsignal,
- {"Raw RSSI Signal", "wlan.rawrssi_antsignal", FT_UINT32, BASE_DEC, NULL, 0x0,
- "RF signal power at the antenna, reported as RSSI by the adapter", HFILL }},
- {&hf_dbm_antsignal,
- {"SSI Signal (dBm)", "wlan.dbm_antsignal", FT_INT32, BASE_DEC, NULL, 0x0,
- "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL }},
+ {&hf_wlancap_priority,
+ {"Priority", "wlancap.priority", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_ssi_type,
+ {"SSI Type", "wlancap.ssi_type", FT_UINT32, BASE_DEC, VALS(ssi_type), 0x0,
+ NULL, HFILL }},
- {&hf_normrssi_antsignal,
- {"Normalized RSSI Signal", "wlan.normrssi_antsignal", FT_UINT32, BASE_DEC, NULL, 0x0,
+ {&hf_wlancap_normrssi_antsignal,
+ {"Normalized RSSI Signal", "wlancap.normrssi_antsignal", FT_UINT32, BASE_DEC, NULL, 0x0,
"RF signal power at the antenna, normalized to the range 0-1000", HFILL }},
- /* AVS-specific header fields.
- XXX - make as many of these generic as possible. */
- {&hf_wlan_magic,
- {"Header magic", "wlancap.magic", FT_UINT32, BASE_HEX, NULL, 0xFFFFFFF0, NULL, HFILL } },
- { &hf_wlan_version, { "Header revision", "wlancap.version", FT_UINT32,
- BASE_DEC, NULL, 0xF, NULL, HFILL } },
- { &hf_wlan_length, { "Header length", "wlancap.length", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL } },
- {&hf_wlan_phytype,
- {"PHY type", "wlan.phytype", FT_UINT32, BASE_DEC, VALS(phy_type), 0x0,
- NULL, HFILL } },
-
- { &hf_wlan_priority, { "Priority", "wlancap.priority", FT_UINT32, BASE_DEC,
- NULL, 0x0, NULL, HFILL } },
- { &hf_wlan_ssi_type, { "SSI Type", "wlancap.ssi_type", FT_UINT32, BASE_DEC,
- VALS(ssi_type), 0x0, NULL, HFILL } },
- { &hf_wlan_preamble, { "Preamble", "wlancap.preamble", FT_UINT32,
- BASE_DEC, VALS(preamble_type), 0x0, NULL, HFILL } },
- { &hf_wlan_encoding, { "Encoding Type", "wlancap.encoding", FT_UINT32,
- BASE_DEC, VALS(encoding_type), 0x0, NULL, HFILL } },
- { &hf_wlan_sequence, { "Receive sequence", "wlancap.sequence", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL } },
- { &hf_wlan_drops, { "Known Dropped Frames", "wlancap.drops", FT_UINT32,
- BASE_DEC, NULL, 0x0, NULL, HFILL } },
- { &hf_wlan_receiver_addr, { "Receiver Address", "wlancap.receiver_addr", FT_ETHER,
- BASE_NONE, NULL, 0x0, "Receiver Hardware Address", HFILL } },
- { &hf_wlan_padding, { "Padding", "wlancap.padding", FT_BYTES,
- BASE_NONE, NULL, 0x0, NULL, HFILL } }
+ {&hf_wlancap_dbm_antsignal,
+ {"SSI Signal (dBm)", "wlancap.dbm_antsignal", FT_INT32, BASE_DEC, NULL, 0x0,
+ "RF signal power at the antenna from a fixed, arbitrary value in decibels from one milliwatt", HFILL }},
+
+ {&hf_wlancap_rawrssi_antsignal,
+ {"Raw RSSI Signal", "wlancap.rawrssi_antsignal", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "RF signal power at the antenna, reported as RSSI by the adapter", HFILL }},
+
+ {&hf_wlancap_normrssi_antnoise,
+ {"Normalized RSSI Noise", "wlancap.normrssi_antnoise", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "RF noise power at the antenna, normalized to the range 0-1000", HFILL }},
+
+ {&hf_wlancap_dbm_antnoise,
+ {"SSI Noise (dBm)", "wlancap.dbm_antnoise", FT_INT32, BASE_DEC, NULL, 0x0,
+ "RF noise power at the antenna from a fixed, arbitrary value in decibels per one milliwatt", HFILL }},
+
+ {&hf_wlancap_rawrssi_antnoise,
+ {"Raw RSSI Noise", "wlancap.rawrssi_antnoise", FT_UINT32, BASE_DEC, NULL, 0x0,
+ "RF noise power at the antenna, reported as RSSI by the adapter", HFILL }},
+
+ {&hf_wlancap_preamble,
+ {"Preamble", "wlancap.preamble", FT_UINT32, BASE_DEC, VALS(preamble_type), 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_encoding,
+ {"Encoding Type", "wlancap.encoding", FT_UINT32, BASE_DEC, VALS(encoding_type), 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_sequence,
+ {"Receive sequence", "wlancap.sequence", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_drops,
+ {"Known Dropped Frames", "wlancap.drops", FT_UINT32, BASE_DEC, NULL, 0x0,
+ NULL, HFILL }},
+
+ {&hf_wlancap_receiver_addr,
+ {"Receiver Address", "wlancap.receiver_addr", FT_ETHER, BASE_NONE, NULL, 0x0,
+ "Receiver Hardware Address", HFILL }},
+
+ {&hf_wlancap_padding,
+ {"Padding", "wlancap.padding", FT_BYTES, BASE_NONE, NULL, 0x0,
+ NULL, HFILL }}
};
static gint *tree_array[] = {
- &ett_radio
+ &ett_wlancap
};
void proto_register_ieee80211_wlancap(void)
diff --git a/epan/dissectors/packet-ixveriwave.c b/epan/dissectors/packet-ixveriwave.c
index 23a6604af0..71870a3af4 100644
--- a/epan/dissectors/packet-ixveriwave.c
+++ b/epan/dissectors/packet-ixveriwave.c
@@ -666,6 +666,7 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
phdr.fcs_len = 0; /* no FCS */
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
/* First add the IFG information, need to grab the info bit field here */
@@ -685,10 +686,6 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
offset += 2;
vw_rflags = tvb_get_letohs(tvb, offset);
- if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT) ) {
- phdr.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
- phdr.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0);
- }
if (tree) {
ft = proto_tree_add_uint(tap_tree, hf_radiotap_flags, tvb, offset, 2, vw_rflags);
flags_tree = proto_item_add_subtree(ft, ett_radiotap_flags);
@@ -727,11 +724,24 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
offset++;
offset++;
- if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT) ) {
- phdr.presence_flags |= (PHDR_802_11_HAS_PHY_BAND|PHDR_802_11_HAS_MCS_INDEX|PHDR_802_11_HAS_NESS);
- phdr.phy_band = (vw_rflags & FLAGS_CHAN_VHT) ? PHDR_802_11_PHY_BAND_11AC : PHDR_802_11_PHY_BAND_11N;
- phdr.mcs_index = mcs_index;
- phdr.ness = ness;
+ if ((vw_rflags & FLAGS_CHAN_HT) || (vw_rflags & FLAGS_CHAN_VHT)) {
+ if (vw_rflags & FLAGS_CHAN_VHT) {
+ phdr.phy = PHDR_802_11_PHY_11AC;
+ phdr.phy_info.info_11ac.presence_flags =
+ PHDR_802_11AC_HAS_MCS_INDEX |
+ PHDR_802_11AC_HAS_SHORT_GI;
+ phdr.phy_info.info_11ac.mcs_index = mcs_index;
+ phdr.phy_info.info_11ac.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0);
+ } else {
+ phdr.phy = PHDR_802_11_PHY_11N;
+ phdr.phy_info.info_11ac.presence_flags =
+ PHDR_802_11N_HAS_MCS_INDEX |
+ PHDR_802_11N_HAS_SHORT_GI |
+ PHDR_802_11N_HAS_NESS;
+ phdr.phy_info.info_11n.mcs_index = mcs_index;
+ phdr.phy_info.info_11n.short_gi = ((vw_rflags & FLAGS_CHAN_SHORTGI) != 0);
+ phdr.phy_info.info_11n.ness = ness;
+ }
if (tree) {
proto_tree_add_item(tap_tree, hf_radiotap_mcsindex,
tvb, offset - 2, 1, ENC_BIG_ENDIAN);
@@ -744,11 +754,10 @@ wlantap_dissect(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, proto_tree
"%.1f (MCS %d)", phyRate, mcs_index);
}
} else {
+ /* XXX - CHAN_OFDM could be 11a or 11g */
if (vw_chanflags & CHAN_CCK) {
- phdr.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr.phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr.phy = PHDR_802_11_PHY_11B;
}
- /* XXX - 11A vs. 11G */
phdr.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
phdr.data_rate = tvb_get_letohs(tvb, offset-5) / 5;
if (tree) {
diff --git a/epan/dissectors/packet-peekremote.c b/epan/dissectors/packet-peekremote.c
index 23e2bde86e..41612b55ab 100644
--- a/epan/dissectors/packet-peekremote.c
+++ b/epan/dissectors/packet-peekremote.c
@@ -406,6 +406,7 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
struct ieee_802_11_phdr phdr;
guint32 extflags;
guint16 frequency;
+ guint16 mcs_index;
tvbuff_t *next_tvb;
if (tvb_memeql(tvb, 0, magic, 4) == -1) {
@@ -420,6 +421,7 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
phdr.fcs_len = 4; /* has an FCS */
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
col_set_str(pinfo->cinfo, COL_PROTOCOL, "PEEKREMOTE");
@@ -445,8 +447,6 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
offset += (header_size - 9);
} else {
phdr.presence_flags |=
- PHDR_802_11_HAS_PHY_BAND|
- PHDR_802_11_HAS_MCS_INDEX|
PHDR_802_11_HAS_CHANNEL|
PHDR_802_11_HAS_SIGNAL_PERCENT|
PHDR_802_11_HAS_NOISE_PERCENT|
@@ -455,7 +455,7 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
PHDR_802_11_HAS_TSF_TIMESTAMP;
proto_tree_add_item(peekremote_tree, &hfi_peekremote_type, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
- phdr.mcs_index = tvb_get_ntohs(tvb, offset);
+ mcs_index = tvb_get_ntohs(tvb, offset);
proto_tree_add_item(peekremote_tree, &hfi_peekremote_mcs_index, tvb, offset, 2, ENC_BIG_ENDIAN);
offset += 2;
phdr.channel = tvb_get_ntohs(tvb, offset);
@@ -470,15 +470,16 @@ dissect_peekremote_new(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void
offset += 4;
proto_tree_add_item(peekremote_tree, &hfi_peekremote_band, tvb, offset, 4, ENC_BIG_ENDIAN);
offset +=4;
- /*
- * XXX - can the band field be used to distinguish between 2.4 GHz
- * and 5 GHz 11n?
- */
extflags = tvb_get_ntohl(tvb, offset);
- if (extflags & EXT_FLAG_802_11ac)
- phdr.phy_band = PHDR_802_11_PHY_BAND_11AC;
- else
- phdr.phy_band = PHDR_802_11_PHY_BAND_11N;
+ if (extflags & EXT_FLAG_802_11ac) {
+ phdr.phy = PHDR_802_11_PHY_11AC;
+ phdr.phy_info.info_11ac.presence_flags = PHDR_802_11AC_HAS_MCS_INDEX;
+ phdr.phy_info.info_11ac.mcs_index = mcs_index;
+ } else {
+ phdr.phy = PHDR_802_11_PHY_11N;
+ phdr.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_MCS_INDEX;
+ phdr.phy_info.info_11n.mcs_index = mcs_index;
+ }
offset += dissect_peekremote_extflags(tvb, pinfo, peekremote_tree, offset);
phdr.signal_percent = tvb_get_guint8(tvb, offset);
proto_tree_add_item(peekremote_tree, &hfi_peekremote_signal_percent, tvb, offset, 1, ENC_NA);
@@ -580,6 +581,7 @@ dissect_peekremote_legacy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, v
phdr.fcs_len = 4; /* We have an FCS */
}
phdr.decrypted = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags =
PHDR_802_11_HAS_CHANNEL|
PHDR_802_11_HAS_DATA_RATE|
diff --git a/epan/dissectors/packet-ppi.c b/epan/dissectors/packet-ppi.c
index ab48e23b2a..11c1b4ff2b 100644
--- a/epan/dissectors/packet-ppi.c
+++ b/epan/dissectors/packet-ppi.c
@@ -157,6 +157,8 @@
*/
#define IEEE80211_CHAN_FHSS \
(IEEE80211_CHAN_2GHZ | IEEE80211_CHAN_GFSK)
+#define IEEE80211_CHAN_DSSS \
+ (IEEE80211_CHAN_2GHZ)
#define IEEE80211_CHAN_A \
(IEEE80211_CHAN_5GHZ | IEEE80211_CHAN_OFDM)
#define IEEE80211_CHAN_B \
@@ -555,38 +557,49 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
switch (chan_flags & IEEE80211_CHAN_ALLTURBO) {
case IEEE80211_CHAN_FHSS:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11_FHSS;
+ phdr->phy = PHDR_802_11_PHY_11_FHSS;
+ phdr->phy_info.info_11_fhss.presence_flags =
+ PHDR_802_11_FHSS_HAS_HOP_SET |
+ PHDR_802_11_FHSS_HAS_HOP_PATTERN;
+ break;
+
+ case IEEE80211_CHAN_DSSS:
+ phdr->phy = PHDR_802_11_PHY_11_DSSS;
break;
case IEEE80211_CHAN_A:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11A;
+ phdr->phy = PHDR_802_11_PHY_11A;
+ phdr->phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ phdr->phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_NORMAL;
break;
case IEEE80211_CHAN_B:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr->phy = PHDR_802_11_PHY_11B;
break;
case IEEE80211_CHAN_PUREG:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11G_PURE;
+ phdr->phy = PHDR_802_11_PHY_11G;
+ phdr->phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
break;
case IEEE80211_CHAN_G:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11G_MIXED;
+ phdr->phy = PHDR_802_11_PHY_11G;
+ phdr->phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_NORMAL;
break;
case IEEE80211_CHAN_108A:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11A_108;
+ phdr->phy = PHDR_802_11_PHY_11A;
+ phdr->phy_info.info_11a.presence_flags = PHDR_802_11A_HAS_TURBO_TYPE;
+ /* We assume non-STURBO is dynamic turbo */
+ phdr->phy_info.info_11a.turbo_type = PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO;
break;
case IEEE80211_CHAN_108PUREG:
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11G_PURE_108;
+ phdr->phy = PHDR_802_11_PHY_11G;
+ phdr->phy_info.info_11g.presence_flags = PHDR_802_11G_HAS_MODE;
+ phdr->phy_info.info_11g.mode = PHDR_802_11G_MODE_SUPER_G;
break;
}
ptvcursor_add_with_subtree(csr, hf_80211_common_chan_flags, 2, ENC_LITTLE_ENDIAN,
@@ -602,7 +615,11 @@ dissect_80211_common(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int of
ptvcursor_pop_subtree(csr);
+ if (phdr->phy == PHDR_802_11_PHY_11_FHSS)
+ phdr->phy_info.info_11_fhss.hop_set = tvb_get_guint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
ptvcursor_add(csr, hf_80211_common_fhss_hopset, 1, ENC_LITTLE_ENDIAN);
+ if (phdr->phy == PHDR_802_11_PHY_11_FHSS)
+ phdr->phy_info.info_11_fhss.hop_pattern = tvb_get_guint8(ptvcursor_tvbuff(csr), ptvcursor_current_offset(csr));
ptvcursor_add(csr, hf_80211_common_fhss_pattern, 1, ENC_LITTLE_ENDIAN);
dbm_value = (gint8) tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
@@ -643,8 +660,7 @@ dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int
int subtree_off = add_subtree ? 4 : 0;
guint32 flags;
- phdr->presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->phy_band = PHDR_802_11_PHY_BAND_11N;
+ phdr->phy = PHDR_802_11_PHY_11N;
*n_mac_flags = tvb_get_letohl(tvb, offset + subtree_off);
*ampdu_id = tvb_get_letohl(tvb, offset + 4 + subtree_off);
@@ -663,9 +679,9 @@ dissect_80211n_mac(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int
csr = ptvcursor_new(ftree, tvb, offset);
flags = tvb_get_letohl(tvb, ptvcursor_current_offset(csr));
- phdr->presence_flags |= PHDR_802_11_HAS_SHORT_GI|PHDR_802_11_HAS_GREENFIELD;
- phdr->short_gi = ((flags & DOT11N_FLAG_SHORT_GI) != 0);
- phdr->greenfield = ((flags & DOT11N_FLAG_GREENFIELD) != 0);
+ phdr->phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_SHORT_GI|PHDR_802_11N_HAS_GREENFIELD;
+ phdr->phy_info.info_11n.short_gi = ((flags & DOT11N_FLAG_SHORT_GI) != 0);
+ phdr->phy_info.info_11n.greenfield = ((flags & DOT11N_FLAG_GREENFIELD) != 0);
ptvcursor_add_with_subtree(csr, hf_80211n_mac_flags, 4, ENC_LITTLE_ENDIAN,
ett_dot11n_mac_flags);
ptvcursor_add_no_advance(csr, hf_80211n_mac_flags_greenfield, 4, ENC_LITTLE_ENDIAN);
@@ -715,14 +731,14 @@ dissect_80211n_mac_phy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int
mcs = tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
if (mcs != 255) {
- phdr->presence_flags |= PHDR_802_11_HAS_MCS_INDEX;
- phdr->mcs_index = mcs;
+ phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
+ phdr->phy_info.info_11n.mcs_index = mcs;
}
ptvcursor_add_invalid_check(csr, hf_80211n_mac_phy_mcs, 1, 255);
ness = tvb_get_guint8(tvb, ptvcursor_current_offset(csr));
- phdr->presence_flags |= PHDR_802_11_HAS_NESS;
- phdr->ness = ness;
+ phdr->phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_NESS;
+ phdr->phy_info.info_11n.ness = ness;
ti = ptvcursor_add(csr, hf_80211n_mac_phy_num_streams, 1, ENC_LITTLE_ENDIAN);
if (tvb_get_guint8(tvb, ptvcursor_current_offset(csr) - 1) == 0)
proto_item_append_text(ti, " (unknown)");
@@ -894,6 +910,7 @@ dissect_ppi(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree)
phdr.fcs_len = -1;
phdr.decrypted = FALSE;
phdr.datapad = FALSE;
+ phdr.phy = PHDR_802_11_PHY_UNKNOWN;
phdr.presence_flags = 0;
while (tot_len > 0) {
diff --git a/wiretap/commview.c b/wiretap/commview.c
index d995e034a0..c852709f29 100644
--- a/wiretap/commview.c
+++ b/wiretap/commview.c
@@ -38,6 +38,8 @@
#include "file_wrappers.h"
#include "commview.h"
+#include <wsutil/frequency-utils.h>
+
typedef struct commview_header {
guint16 data_len;
guint16 source_data_len;
@@ -75,9 +77,9 @@ typedef struct commview_header {
#define BAND_11G 0x04
#define BAND_11A_TURBO 0x08
#define BAND_SUPERG 0x10
-#define BAND_PUBLIC_SAFETY 0x20 /* 499 GHz public safety */
+#define BAND_PUBLIC_SAFETY 0x20 /* 4.99 GHz public safety */
#define BAND_11N_5GHZ 0x40
-#define BAND_11N_2_4GHZ 0x80
+#define BAND_11N_2_4GHZ 0x80
/* Capture mediums as defined by the commview file format */
#define MEDIUM_ETHERNET 0
@@ -140,6 +142,7 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
{
commview_header_t cv_hdr;
struct tm tm;
+ guint frequency;
if(!commview_read_header(&cv_hdr, fh, err, err_info))
return FALSE;
@@ -156,6 +159,7 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
phdr->pseudo_header.ieee_802_11.fcs_len = -1; /* Unknown */
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
phdr->pseudo_header.ieee_802_11.presence_flags =
PHDR_802_11_HAS_CHANNEL |
PHDR_802_11_HAS_DATA_RATE |
@@ -163,41 +167,69 @@ commview_read_packet(FILE_T fh, struct wtap_pkthdr *phdr, Buffer *buf,
switch (cv_hdr.band) {
case BAND_11A:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11A;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11A;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11a.presence_flags =
+ PHDR_802_11A_HAS_TURBO_TYPE;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type =
+ PHDR_802_11A_TURBO_TYPE_NORMAL;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, FALSE);
break;
case BAND_11B:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11B;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11B;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
break;
case BAND_11G:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11G;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11G;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11g.presence_flags =
+ PHDR_802_11G_HAS_MODE;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11g.mode =
+ PHDR_802_11G_MODE_NORMAL;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
break;
case BAND_11A_TURBO:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11A_108;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11A;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11a.presence_flags =
+ PHDR_802_11A_HAS_TURBO_TYPE;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type =
+ PHDR_802_11A_TURBO_TYPE_TURBO;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, FALSE);
break;
case BAND_SUPERG:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- /* So what is "SuperG" here? */
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11G_STURBO;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11G;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11g.presence_flags =
+ PHDR_802_11G_HAS_MODE;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11g.mode =
+ PHDR_802_11G_MODE_SUPER_G;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
break;
case BAND_11N_5GHZ:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11N_5GHZ;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11N;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11n.presence_flags =
+ 0;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, FALSE);
break;
case BAND_11N_2_4GHZ:
- phdr->pseudo_header.ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- phdr->pseudo_header.ieee_802_11.phy_band = PHDR_802_11_PHY_BAND_11N_2_4GHZ;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_11N;
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11n.presence_flags =
+ 0;
+ frequency = ieee80211_chan_to_mhz(cv_hdr.channel, TRUE);
+ break;
+
+ default:
+ frequency = 0;
break;
}
+ if (frequency != 0) {
+ phdr->pseudo_header.ieee_802_11.presence_flags |=
+ PHDR_802_11_HAS_FREQUENCY;
+ phdr->pseudo_header.ieee_802_11.frequency = frequency;
+ }
phdr->pseudo_header.ieee_802_11.channel = cv_hdr.channel;
phdr->pseudo_header.ieee_802_11.data_rate =
cv_hdr.rate | (cv_hdr.direction << 8);
@@ -407,6 +439,75 @@ static gboolean commview_dump(wtap_dumper *wdh,
case WTAP_ENCAP_IEEE_802_11_WITH_RADIO :
cv_hdr.flags |= MEDIUM_WIFI;
+ switch (phdr->pseudo_header.ieee_802_11.phy) {
+
+ case PHDR_802_11_PHY_11A:
+ /*
+ * If we don't know whether it's turbo, say it's
+ * not.
+ */
+ if (!(phdr->pseudo_header.ieee_802_11.phy_info.info_11a.presence_flags & PHDR_802_11A_HAS_TURBO_TYPE) ||
+ phdr->pseudo_header.ieee_802_11.phy_info.info_11a.turbo_type == PHDR_802_11A_TURBO_TYPE_NORMAL)
+ cv_hdr.band = BAND_11A;
+ else
+ cv_hdr.band = BAND_11A_TURBO;
+ break;
+
+ case PHDR_802_11_PHY_11B:
+ cv_hdr.band = BAND_11B;
+ break;
+
+ case PHDR_802_11_PHY_11G:
+ /*
+ * If we don't know whether it's Super G, say it's
+ * not.
+ */
+ if (!(phdr->pseudo_header.ieee_802_11.phy_info.info_11g.presence_flags & PHDR_802_11G_HAS_MODE))
+ cv_hdr.band = BAND_11G;
+ else {
+ switch (phdr->pseudo_header.ieee_802_11.phy_info.info_11g.mode) {
+
+ case PHDR_802_11G_MODE_NORMAL:
+ cv_hdr.band = BAND_11G;
+ break;
+
+ case PHDR_802_11G_MODE_SUPER_G:
+ cv_hdr.band = BAND_SUPERG;
+ break;
+
+ default:
+ cv_hdr.band = BAND_11G;
+ break;
+ }
+ }
+ break;
+
+ case PHDR_802_11_PHY_11N:
+ /*
+ * Pick the band based on the frequency.
+ */
+ if (phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_FREQUENCY) {
+ if (phdr->pseudo_header.ieee_802_11.frequency > 2484) {
+ /* 5 GHz band */
+ cv_hdr.band = BAND_11N_5GHZ;
+ } else {
+ /* 2.4 GHz band */
+ cv_hdr.band = BAND_11N_2_4GHZ;
+ }
+ } else {
+ /* Band is unknown. */
+ cv_hdr.band = 0;
+ }
+ break;
+
+ default:
+ /*
+ * It's not documented how they handle 11ac,
+ * and they don't support the older PHYs.
+ */
+ cv_hdr.band = 0;
+ break;
+ }
cv_hdr.channel =
(phdr->pseudo_header.ieee_802_11.presence_flags & PHDR_802_11_HAS_CHANNEL) ?
phdr->pseudo_header.ieee_802_11.channel :
diff --git a/wiretap/netmon.c b/wiretap/netmon.c
index 4c104cd46b..7abc7c677d 100644
--- a/wiretap/netmon.c
+++ b/wiretap/netmon.c
@@ -431,6 +431,7 @@ netmon_set_pseudo_header_info(struct wtap_pkthdr *phdr, Buffer *buf)
phdr->pseudo_header.ieee_802_11.fcs_len = -2;
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* radio data is in the packet data */
break;
}
diff --git a/wiretap/network_instruments.c b/wiretap/network_instruments.c
index a4e3b67bd7..93e9005728 100644
--- a/wiretap/network_instruments.c
+++ b/wiretap/network_instruments.c
@@ -377,6 +377,7 @@ read_packet_header(wtap *wth, FILE_T fh, union wtap_pseudo_header *pseudo_header
pseudo_header->ieee_802_11.fcs_len = 0;
pseudo_header->ieee_802_11.decrypted = FALSE;
pseudo_header->ieee_802_11.datapad = FALSE;
+ pseudo_header->ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
pseudo_header->ieee_802_11.presence_flags = 0;
/* Updated below */
break;
diff --git a/wiretap/netxray.c b/wiretap/netxray.c
index 4c55904195..536afc3dfd 100644
--- a/wiretap/netxray.c
+++ b/wiretap/netxray.c
@@ -1252,6 +1252,7 @@ netxray_process_rec_header(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
/*
* XXX - any other information, such as PHY
diff --git a/wiretap/peekclassic.c b/wiretap/peekclassic.c
index 3a880ed117..3552a91901 100644
--- a/wiretap/peekclassic.c
+++ b/wiretap/peekclassic.c
@@ -448,6 +448,7 @@ static int peekclassic_read_packet_v7(wtap *wth, FILE_T fh,
phdr->pseudo_header.ieee_802_11.fcs_len = 0; /* no FCS */
phdr->pseudo_header.ieee_802_11.decrypted = FALSE;
phdr->pseudo_header.ieee_802_11.datapad = FALSE;
+ phdr->pseudo_header.ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
phdr->pseudo_header.ieee_802_11.presence_flags = 0; /* not present */
/*
diff --git a/wiretap/peektagged.c b/wiretap/peektagged.c
index b475d8ced5..db63650554 100644
--- a/wiretap/peektagged.c
+++ b/wiretap/peektagged.c
@@ -437,7 +437,11 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
timestamp.upper = 0;
timestamp.lower = 0;
- memset(&ieee_802_11, 0, sizeof ieee_802_11);
+ ieee_802_11.fcs_len = -1; /* Unknown */
+ ieee_802_11.decrypted = FALSE;
+ ieee_802_11.datapad = FALSE;
+ ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
+ ieee_802_11.presence_flags = 0;
/* Extract the fields from the packet header */
do {
@@ -601,52 +605,72 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
* for other frames.
*/
ext_flags = pletoh32(&tag_value[2]);
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_PHY_BAND;
- /* XXX - any way to determine the band? */
- ieee_802_11.phy_band = (ext_flags & EXT_FLAG_802_11ac) ? PHDR_802_11_PHY_BAND_11AC : PHDR_802_11_PHY_BAND_11N;
-
- switch (ext_flags & EXT_FLAGS_BANDWIDTH) {
-
- case 0:
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_BANDWIDTH;
- ieee_802_11.bandwidth = PHDR_802_11_BANDWIDTH_20_MHZ;
- break;
-
- case EXT_FLAG_20_MHZ_LOWER:
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_BANDWIDTH;
- ieee_802_11.bandwidth = PHDR_802_11_BANDWIDTH_20_20L;
- break;
-
- case EXT_FLAG_20_MHZ_UPPER:
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_BANDWIDTH;
- ieee_802_11.bandwidth = PHDR_802_11_BANDWIDTH_20_20U;
- break;
-
- case EXT_FLAG_40_MHZ:
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_BANDWIDTH;
- ieee_802_11.bandwidth = PHDR_802_11_BANDWIDTH_40_MHZ;
- break;
-
- default:
- /* Mutually exclusive flags set */
- break;
- }
-
- switch (ext_flags & EXT_FLAGS_GI) {
-
- case EXT_FLAG_HALF_GI:
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
- ieee_802_11.short_gi = 1;
- break;
-
- case EXT_FLAG_FULL_GI:
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_SHORT_GI;
- ieee_802_11.short_gi = 0;
- break;
-
- default:
- /* Mutually exclusive flags set or nothing set */
- break;
+ if (ext_flags & EXT_FLAG_802_11ac) {
+ ieee_802_11.phy = PHDR_802_11_PHY_11AC;
+ ieee_802_11.phy_info.info_11ac.presence_flags = 0;
+
+ switch (ext_flags & EXT_FLAGS_GI) {
+
+ case EXT_FLAG_HALF_GI:
+ ieee_802_11.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI;
+ ieee_802_11.phy_info.info_11ac.short_gi = 1;
+ break;
+
+ case EXT_FLAG_FULL_GI:
+ ieee_802_11.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_SHORT_GI;
+ ieee_802_11.phy_info.info_11ac.short_gi = 0;
+ break;
+
+ default:
+ /* Mutually exclusive flags set or nothing set */
+ break;
+ }
+ } else {
+ ieee_802_11.phy = PHDR_802_11_PHY_11N;
+ switch (ext_flags & EXT_FLAGS_BANDWIDTH) {
+
+ case 0:
+ ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+ ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_20_MHZ;
+ break;
+
+ case EXT_FLAG_20_MHZ_LOWER:
+ ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+ ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_20_20L;
+ break;
+
+ case EXT_FLAG_20_MHZ_UPPER:
+ ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+ ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_20_20U;
+ break;
+
+ case EXT_FLAG_40_MHZ:
+ ieee_802_11.phy_info.info_11n.presence_flags = PHDR_802_11N_HAS_BANDWIDTH;
+ ieee_802_11.phy_info.info_11n.bandwidth = PHDR_802_11_BANDWIDTH_40_MHZ;
+ break;
+
+ default:
+ /* Mutually exclusive flags set */
+ ieee_802_11.phy_info.info_11n.presence_flags = 0;
+ break;
+ }
+
+ switch (ext_flags & EXT_FLAGS_GI) {
+
+ case EXT_FLAG_HALF_GI:
+ ieee_802_11.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+ ieee_802_11.phy_info.info_11n.short_gi = 1;
+ break;
+
+ case EXT_FLAG_FULL_GI:
+ ieee_802_11.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_SHORT_GI;
+ ieee_802_11.phy_info.info_11n.short_gi = 0;
+ break;
+
+ default:
+ /* Mutually exclusive flags set or nothing set */
+ break;
+ }
}
break;
@@ -711,8 +735,13 @@ peektagged_read_packet(wtap *wth, FILE_T fh, struct wtap_pkthdr *phdr,
if (saw_data_rate_or_mcs_index) {
if (ext_flags & EXT_FLAG_MCS_INDEX_USED) {
/* It's an MCS index. */
- ieee_802_11.presence_flags |= PHDR_802_11_HAS_MCS_INDEX;
- ieee_802_11.mcs_index = data_rate_or_mcs_index;
+ if (ext_flags & EXT_FLAG_802_11ac) {
+ ieee_802_11.phy_info.info_11ac.presence_flags |= PHDR_802_11AC_HAS_MCS_INDEX;
+ ieee_802_11.phy_info.info_11ac.mcs_index = data_rate_or_mcs_index;
+ } else {
+ ieee_802_11.phy_info.info_11n.presence_flags |= PHDR_802_11N_HAS_MCS_INDEX;
+ ieee_802_11.phy_info.info_11n.mcs_index = data_rate_or_mcs_index;
+ }
} else {
/* It's a data rate. */
ieee_802_11.presence_flags |= PHDR_802_11_HAS_DATA_RATE;
diff --git a/wiretap/snoop.c b/wiretap/snoop.c
index b50912da05..7ed4f7d6fb 100644
--- a/wiretap/snoop.c
+++ b/wiretap/snoop.c
@@ -741,6 +741,7 @@ snoop_read_shomiti_wireless_pseudoheader(FILE_T fh,
pseudo_header->ieee_802_11.fcs_len = 4;
pseudo_header->ieee_802_11.decrypted = FALSE;
pseudo_header->ieee_802_11.datapad = FALSE;
+ pseudo_header->ieee_802_11.phy = PHDR_802_11_PHY_UNKNOWN;
pseudo_header->ieee_802_11.presence_flags =
PHDR_802_11_HAS_CHANNEL |
PHDR_802_11_HAS_DATA_RATE |
diff --git a/wiretap/wtap.h b/wiretap/wtap.h
index 5da0261956..76cd194e79 100644
--- a/wiretap/wtap.h
+++ b/wiretap/wtap.h
@@ -554,14 +554,81 @@ struct p2p_phdr {
* The signal strength can be represented as a percentage, which is 100
* times the ratio of the RSSI and the maximum RSSI.
*/
-struct ieee_802_11_phdr {
- gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */
- gboolean decrypted; /* TRUE if frame is decrypted even if "protected" bit is set */
- gboolean datapad; /* TRUE if frame has padding between 802.11 header and payload */
- guint32 presence_flags; /* Flags indicating presence of fields */
- guint16 phy_band; /* Type of PHY and band */
- guint16 channel; /* Channel number */
- guint16 data_rate; /* Data rate, in .5 Mb/s units */
+
+/*
+ * PHY types.
+ */
+#define PHDR_802_11_PHY_UNKNOWN 0 /* PHY not known */
+#define PHDR_802_11_PHY_11_FHSS 1 /* 802.11 FHSS */
+#define PHDR_802_11_PHY_11_IR 2 /* 802.11 IR */
+#define PHDR_802_11_PHY_11_DSSS 3 /* 802.11 DSSS */
+#define PHDR_802_11_PHY_11B 4 /* 802.11b */
+#define PHDR_802_11_PHY_11A 5 /* 802.11a */
+#define PHDR_802_11_PHY_11G 6 /* 802.11g */
+#define PHDR_802_11_PHY_11N 7 /* 802.11n */
+#define PHDR_802_11_PHY_11AC 8 /* 802.11ac */
+
+/*
+ * PHY-specific information.
+ */
+struct ieee_802_11_fhss { /* 802.11 legacy FHSS */
+ guint32 presence_flags; /* Which of this information is present? */
+ guint8 hop_set; /* Hop set */
+ guint8 hop_pattern; /* Hop pattern */
+ guint8 hop_index; /* Hop index */
+};
+
+/*
+ * Presence flags for legacy FHSS.
+ */
+#define PHDR_802_11_FHSS_HAS_HOP_SET 0x0000001
+#define PHDR_802_11_FHSS_HAS_HOP_PATTERN 0x0000002
+#define PHDR_802_11_FHSS_HAS_HOP_INDEX 0x0000004
+
+/*
+ * Presence flags for 802.11a.
+ */
+#define PHDR_802_11A_HAS_CHANNEL_TYPE 0x0000001 /* Normal, half-clocked, quarter-clocked */
+#define PHDR_802_11A_HAS_TURBO_TYPE 0x0000002 /* Normal, turbo, "static turbo" */
+
+struct ieee_802_11a { /* 802.11a */
+ guint32 presence_flags; /* Which of this information is present? */
+ guint channel_type:2;
+ guint turbo_type:2;
+};
+
+#define PHDR_802_11A_CHANNEL_TYPE_NORMAL 0
+#define PHDR_802_11A_CHANNEL_TYPE_HALF_CLOCKED 1
+#define PHDR_802_11A_CHANNEL_TYPE_QUARTER_CLOCKED 2
+
+/*
+ * "Turbo" is an Atheros proprietary extension with 40 MHz-wide channels.
+ * It can be dynamic or static.
+ *
+ * See
+ *
+ * http://wifi-insider.com/atheros/turbo.htm
+ */
+#define PHDR_802_11A_TURBO_TYPE_NORMAL 0
+#define PHDR_802_11A_TURBO_TYPE_TURBO 1 /* If we don't know wehther it's static or dynamic */
+#define PHDR_802_11A_TURBO_TYPE_DYNAMIC_TURBO 2
+#define PHDR_802_11A_TURBO_TYPE_STATIC_TURBO 3
+
+struct ieee_802_11g { /* 802.11g */
+ guint32 presence_flags; /* Which of this information is present? */
+ guint32 mode; /* Various proprietary extensions */
+};
+
+/*
+ * Presence flags for 802.11g.
+ */
+#define PHDR_802_11G_HAS_MODE 0x0000001 /* Proprietary extensions */
+
+#define PHDR_802_11G_MODE_NORMAL 0
+#define PHDR_802_11G_MODE_SUPER_G 1 /* Atheros Super G */
+
+struct ieee_802_11n { /* 802.11n */
+ guint32 presence_flags; /* Which of this information is present? */
guint16 mcs_index; /* MCS index */
guint bandwidth; /* Bandwidth = 20 MHz, 40 MHz, etc. */
guint short_gi:1; /* True for short guard interval */
@@ -569,47 +636,20 @@ struct ieee_802_11_phdr {
guint ldpc:1; /* True for LDPC FEC */
guint stbc_streams:2; /* Number of STBC streams */
guint ness; /* Number of extension spatial streams */
- guint32 frequency; /* Channel center frequency */
- guint8 signal_percent; /* Signal level, as a percentage */
- guint8 noise_percent; /* Noise level, as a percentage */
- gint8 signal_dbm; /* Signal level, in dBm */
- gint8 noise_dbm; /* Noise level, in dBm */
- guint64 tsf_timestamp;
};
-#define PHDR_802_11_HAS_PHY_BAND 0x00000001 /* phy_band */
-#define PHDR_802_11_HAS_CHANNEL 0x00000002 /* channel */
-#define PHDR_802_11_HAS_DATA_RATE 0x00000004 /* data_rate */
-#define PHDR_802_11_HAS_MCS_INDEX 0x00000008 /* mcs */
-#define PHDR_802_11_HAS_BANDWIDTH 0x00000010 /* bandwidth */
-#define PHDR_802_11_HAS_SHORT_GI 0x00000020 /* short_gi */
-#define PHDR_802_11_HAS_GREENFIELD 0x00000040 /* greenfield */
-#define PHDR_802_11_HAS_LDPC 0x00000080 /* ldpc */
-#define PHDR_802_11_HAS_STBC_STREAMS 0x00000100 /* stbc_streams */
-#define PHDR_802_11_HAS_NESS 0x00000200 /* ness */
-#define PHDR_802_11_HAS_FREQUENCY 0x00000400 /* frequency */
-#define PHDR_802_11_HAS_SIGNAL_PERCENT 0x00000800 /* signal_percent */
-#define PHDR_802_11_HAS_NOISE_PERCENT 0x00001000 /* noise_percent */
-#define PHDR_802_11_HAS_SIGNAL_DBM 0x00002000 /* signal_dbm */
-#define PHDR_802_11_HAS_NOISE_DBM 0x00004000 /* noise_dbm */
-#define PHDR_802_11_HAS_TSF_TIMESTAMP 0x00008000 /* tsf_timestamp */
-
-#define PHDR_802_11_PHY_BAND_11_FHSS 0 /* 802.11 FHSS (2.4 GHz GFSK) */
-#define PHDR_802_11_PHY_BAND_11_DSSS 1 /* 802.11 DSSS (2.4 GHz not GFSK) */
-#define PHDR_802_11_PHY_BAND_11B 2 /* 802.11b (2.4 GHz CCK) */
-#define PHDR_802_11_PHY_BAND_11A 3 /* 802.11a (5 GHz OFDM) */
-#define PHDR_802_11_PHY_BAND_11G 4 /* 802.11g (2.4 GHz, unknown modulation) */
-#define PHDR_802_11_PHY_BAND_11G_PURE 5 /* pure 802.11g (2.4 GHz OFDM) */
-#define PHDR_802_11_PHY_BAND_11G_MIXED 6 /* 802.11g (2.4 GHz dynamic CCK-OFDM) */
-#define PHDR_802_11_PHY_BAND_11A_108 7 /* turbo 802.11a */
-#define PHDR_802_11_PHY_BAND_11G_PURE_108 8 /* turbo pure 802.11g */
-#define PHDR_802_11_PHY_BAND_11G_MIXED_108 9 /* turbo 802.11g (dynamic CCK-OFDM) */
-#define PHDR_802_11_PHY_BAND_11G_STURBO 10 /* static turbo 802.11g */
-#define PHDR_802_11_PHY_BAND_11N 11 /* 802.11n (HT, unknown band) */
-#define PHDR_802_11_PHY_BAND_11N_5GHZ 12 /* 802.11n (5 GHz HT) */
-#define PHDR_802_11_PHY_BAND_11N_2_4GHZ 13 /* 802.11n (2.4 GHz HT) */
-#define PHDR_802_11_PHY_BAND_11AC 14 /* 802.11ac (VHT) */
-
+/*
+ * Presence flags for 802.11n.
+ */
+#define PHDR_802_11N_HAS_MCS_INDEX 0x00000001 /* mcs */
+#define PHDR_802_11N_HAS_BANDWIDTH 0x00000002 /* bandwidth */
+#define PHDR_802_11N_HAS_SHORT_GI 0x00000004 /* short_gi */
+#define PHDR_802_11N_HAS_GREENFIELD 0x00000008 /* greenfield */
+#define PHDR_802_11N_HAS_LDPC 0x00000010 /* ldpc */
+#define PHDR_802_11N_HAS_STBC_STREAMS 0x00000020 /* stbc_streams */
+#define PHDR_802_11N_HAS_NESS 0x00000040 /* ness */
+
+/* Used for both 11n and 11ac */
#define PHDR_802_11_BANDWIDTH_20_MHZ 0 /* 20 MHz */
#define PHDR_802_11_BANDWIDTH_40_MHZ 1 /* 40 MHz */
#define PHDR_802_11_BANDWIDTH_20_20L 2 /* 20 + 20L, 40 MHz */
@@ -637,6 +677,57 @@ struct ieee_802_11_phdr {
#define PHDR_802_11_BANDWIDTH_20UUL 24 /* ???, 160 MHz */
#define PHDR_802_11_BANDWIDTH_20UUU 25 /* ???, 160 MHz */
+struct ieee_802_11ac { /* 802.11ac */
+ guint32 presence_flags; /* Which of this information is present? */
+ guint16 mcs_index; /* MCS index */
+ guint bandwidth; /* Bandwidth = 20 MHz, 40 MHz, etc. */
+ guint short_gi:1; /* True for short guard interval */
+};
+
+/*
+ * Presence flags for 802.11ac.
+ */
+#define PHDR_802_11AC_HAS_MCS_INDEX 0x00000001 /* mcs */
+#define PHDR_802_11AC_HAS_BANDWIDTH 0x00000002 /* bandwidth */
+#define PHDR_802_11AC_HAS_SHORT_GI 0x00000004 /* short_gi */
+
+struct ieee_802_11_phdr {
+ gint fcs_len; /* Number of bytes of FCS - -1 means "unknown" */
+ gboolean decrypted; /* TRUE if frame is decrypted even if "protected" bit is set */
+ gboolean datapad; /* TRUE if frame has padding between 802.11 header and payload */
+ guint phy; /* PHY type */
+ union {
+ struct ieee_802_11_fhss info_11_fhss;
+ struct ieee_802_11a info_11a;
+ struct ieee_802_11g info_11g;
+ struct ieee_802_11n info_11n;
+ struct ieee_802_11ac info_11ac;
+ } phy_info;
+ guint32 presence_flags; /* Flags indicating presence of fields below */
+ guint16 channel; /* Channel number */
+ guint32 frequency; /* Channel center frequency */
+ gboolean short_preamble; /* Short preamble */
+ guint16 data_rate; /* Data rate, in .5 Mb/s units */
+ guint8 signal_percent; /* Signal level, as a percentage */
+ guint8 noise_percent; /* Noise level, as a percentage */
+ gint8 signal_dbm; /* Signal level, in dBm */
+ gint8 noise_dbm; /* Noise level, in dBm */
+ guint64 tsf_timestamp;
+};
+
+/*
+ * Presence bits for non-PHY-specific data.
+ */
+#define PHDR_802_11_HAS_CHANNEL 0x00000001 /* channel */
+#define PHDR_802_11_HAS_FREQUENCY 0x00000002 /* frequency */
+#define PHDR_802_11_HAS_SHORT_PREAMBLE 0x00000004 /* short_preamble */
+#define PHDR_802_11_HAS_DATA_RATE 0x00000008 /* data_rate */
+#define PHDR_802_11_HAS_SIGNAL_PERCENT 0x00000010 /* signal_percent */
+#define PHDR_802_11_HAS_NOISE_PERCENT 0x00000020 /* noise_percent */
+#define PHDR_802_11_HAS_SIGNAL_DBM 0x00000040 /* signal_dbm */
+#define PHDR_802_11_HAS_NOISE_DBM 0x00000080 /* noise_dbm */
+#define PHDR_802_11_HAS_TSF_TIMESTAMP 0x00000100 /* tsf_timestamp */
+
/* Packet "pseudo-header" for the output from CoSine L2 debug output. */
#define COSINE_MAX_IF_NAME_LEN 128