Print frame type name in debug output

"stype=4" becomes "stype=4 (WLAN_FC_STYPE_PROBE_REQ)" etc.

Signed-off-by: Pontus Fuchs <pontus.fuchs@gmail.com>
This commit is contained in:
Pontus Fuchs 2014-06-03 10:24:53 +02:00 committed by Jouni Malinen
parent 57a8f8af38
commit dedfa440ed
4 changed files with 70 additions and 10 deletions

View file

@ -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
}

View file

@ -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 */