aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2014-06-23 12:16:31 -0700
committerDmitry Shmidt <dimitrysh@google.com>2014-06-23 12:16:31 -0700
commit2271d3fdd5982d0e5e81cf9999a861bba933eacb (patch)
tree3fbd05084770c6f00b0ba3b102b3af91e3a80a5c /src/common
parent0c08fdcf5231617f2340cb18e45769a8ed3a1dc4 (diff)
downloadandroid_external_wpa_supplicant_8-2271d3fdd5982d0e5e81cf9999a861bba933eacb.tar.gz
android_external_wpa_supplicant_8-2271d3fdd5982d0e5e81cf9999a861bba933eacb.tar.bz2
android_external_wpa_supplicant_8-2271d3fdd5982d0e5e81cf9999a861bba933eacb.zip
Cumulative patch from commit f95a4524c2c00476e46b7999426ffdcbc7cd538f
f95a452 nl80211: Improve debug output by printing SA and DA in frames dedfa44 Print frame type name in debug output 57a8f8a nl80211: Use low-priority scan for OBSS scan 1b928f9 P2P: Allow passphrase length to be configured e985246 eapol_test: Add PC/SC reader and PIN command line arguments 5a62060 Use pcsc_reader configuration in one for scard_init() call f3c6b23 EAP-SIM': Fix AT_KDF parser to avoid infinite loop 79122f9 EAP-SIM/AKA: Remove unused RESULT_FAILURE state Change-Id: I142bed35a75ed228e145e50c961dcde22a9815f7 Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'src/common')
-rw-r--r--src/common/ieee802_11_common.c57
-rw-r--r--src/common/ieee802_11_common.h1
2 files changed, 58 insertions, 0 deletions
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index faa6a39b..173a400d 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -546,3 +546,60 @@ int supp_rates_11b_only(struct ieee802_11_elems *elems)
return num_11b > 0 && num_others == 0;
}
+
+
+const char * fc2str(u16 fc)
+{
+ u16 stype = WLAN_FC_GET_STYPE(fc);
+#define C2S(x) case x: return #x;
+
+ switch (WLAN_FC_GET_TYPE(fc)) {
+ case WLAN_FC_TYPE_MGMT:
+ switch (stype) {
+ C2S(WLAN_FC_STYPE_ASSOC_REQ)
+ C2S(WLAN_FC_STYPE_ASSOC_RESP)
+ C2S(WLAN_FC_STYPE_REASSOC_REQ)
+ C2S(WLAN_FC_STYPE_REASSOC_RESP)
+ C2S(WLAN_FC_STYPE_PROBE_REQ)
+ C2S(WLAN_FC_STYPE_PROBE_RESP)
+ C2S(WLAN_FC_STYPE_BEACON)
+ C2S(WLAN_FC_STYPE_ATIM)
+ C2S(WLAN_FC_STYPE_DISASSOC)
+ C2S(WLAN_FC_STYPE_AUTH)
+ C2S(WLAN_FC_STYPE_DEAUTH)
+ C2S(WLAN_FC_STYPE_ACTION)
+ }
+ break;
+ case WLAN_FC_TYPE_CTRL:
+ switch (stype) {
+ C2S(WLAN_FC_STYPE_PSPOLL)
+ C2S(WLAN_FC_STYPE_RTS)
+ C2S(WLAN_FC_STYPE_CTS)
+ C2S(WLAN_FC_STYPE_ACK)
+ C2S(WLAN_FC_STYPE_CFEND)
+ C2S(WLAN_FC_STYPE_CFENDACK)
+ }
+ break;
+ case WLAN_FC_TYPE_DATA:
+ switch (stype) {
+ C2S(WLAN_FC_STYPE_DATA)
+ C2S(WLAN_FC_STYPE_DATA_CFACK)
+ C2S(WLAN_FC_STYPE_DATA_CFPOLL)
+ C2S(WLAN_FC_STYPE_DATA_CFACKPOLL)
+ C2S(WLAN_FC_STYPE_NULLFUNC)
+ C2S(WLAN_FC_STYPE_CFACK)
+ C2S(WLAN_FC_STYPE_CFPOLL)
+ C2S(WLAN_FC_STYPE_CFACKPOLL)
+ C2S(WLAN_FC_STYPE_QOS_DATA)
+ C2S(WLAN_FC_STYPE_QOS_DATA_CFACK)
+ C2S(WLAN_FC_STYPE_QOS_DATA_CFPOLL)
+ C2S(WLAN_FC_STYPE_QOS_DATA_CFACKPOLL)
+ C2S(WLAN_FC_STYPE_QOS_NULL)
+ C2S(WLAN_FC_STYPE_QOS_CFPOLL)
+ C2S(WLAN_FC_STYPE_QOS_CFACKPOLL)
+ }
+ break;
+ }
+ return "WLAN_FC_TYPE_UNKNOWN";
+#undef C2S
+}
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index 9b8bbd1c..cf83057b 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -98,4 +98,5 @@ enum hostapd_hw_mode ieee80211_freq_to_chan(int freq, u8 *channel);
int supp_rates_11b_only(struct ieee802_11_elems *elems);
+const char * fc2str(u16 fc);
#endif /* IEEE802_11_COMMON_H */