aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/peektagged.c
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 /wiretap/peektagged.c
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>
Diffstat (limited to 'wiretap/peektagged.c')
-rw-r--r--wiretap/peektagged.c127
1 files changed, 78 insertions, 49 deletions
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;