]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Add 802.11 reason code strings into wpa_supplicant messages
authorAlex Khouderchah <akhouderchah@google.com>
Mon, 15 Apr 2019 19:20:05 +0000 (12:20 -0700)
committerJouni Malinen <j@w1.fi>
Mon, 22 Apr 2019 19:08:05 +0000 (22:08 +0300)
Logs involving IEEE 802.11 Reason Codes output the Reason Code value,
but do not provide any explanation of what the value means. This change
provides a terse explanation of each Reason Code using the latter part
of the reason code #define names.

Signed-off-by: Alex Khouderchah <akhouderchah@chromium.org>
src/common/ieee802_11_common.c
src/common/ieee802_11_common.h
wpa_supplicant/events.c
wpa_supplicant/wpa_supplicant.c

index e42a327449eb86f89c3bdbef1c2d84b8630590cd..e03f59e224b0200af80ddd93f92e3a4bbbbd7386 100644 (file)
@@ -1315,6 +1315,77 @@ const char * fc2str(u16 fc)
 }
 
 
+const char * reason2str(u16 reason)
+{
+#define R2S(r) case WLAN_REASON_ ## r: return #r;
+       switch (reason) {
+       R2S(UNSPECIFIED)
+       R2S(PREV_AUTH_NOT_VALID)
+       R2S(DEAUTH_LEAVING)
+       R2S(DISASSOC_DUE_TO_INACTIVITY)
+       R2S(DISASSOC_AP_BUSY)
+       R2S(CLASS2_FRAME_FROM_NONAUTH_STA)
+       R2S(CLASS3_FRAME_FROM_NONASSOC_STA)
+       R2S(DISASSOC_STA_HAS_LEFT)
+       R2S(STA_REQ_ASSOC_WITHOUT_AUTH)
+       R2S(PWR_CAPABILITY_NOT_VALID)
+       R2S(SUPPORTED_CHANNEL_NOT_VALID)
+       R2S(BSS_TRANSITION_DISASSOC)
+       R2S(INVALID_IE)
+       R2S(MICHAEL_MIC_FAILURE)
+       R2S(4WAY_HANDSHAKE_TIMEOUT)
+       R2S(GROUP_KEY_UPDATE_TIMEOUT)
+       R2S(IE_IN_4WAY_DIFFERS)
+       R2S(GROUP_CIPHER_NOT_VALID)
+       R2S(PAIRWISE_CIPHER_NOT_VALID)
+       R2S(AKMP_NOT_VALID)
+       R2S(UNSUPPORTED_RSN_IE_VERSION)
+       R2S(INVALID_RSN_IE_CAPAB)
+       R2S(IEEE_802_1X_AUTH_FAILED)
+       R2S(CIPHER_SUITE_REJECTED)
+       R2S(TDLS_TEARDOWN_UNREACHABLE)
+       R2S(TDLS_TEARDOWN_UNSPECIFIED)
+       R2S(SSP_REQUESTED_DISASSOC)
+       R2S(NO_SSP_ROAMING_AGREEMENT)
+       R2S(BAD_CIPHER_OR_AKM)
+       R2S(NOT_AUTHORIZED_THIS_LOCATION)
+       R2S(SERVICE_CHANGE_PRECLUDES_TS)
+       R2S(UNSPECIFIED_QOS_REASON)
+       R2S(NOT_ENOUGH_BANDWIDTH)
+       R2S(DISASSOC_LOW_ACK)
+       R2S(EXCEEDED_TXOP)
+       R2S(STA_LEAVING)
+       R2S(END_TS_BA_DLS)
+       R2S(UNKNOWN_TS_BA)
+       R2S(TIMEOUT)
+       R2S(PEERKEY_MISMATCH)
+       R2S(AUTHORIZED_ACCESS_LIMIT_REACHED)
+       R2S(EXTERNAL_SERVICE_REQUIREMENTS)
+       R2S(INVALID_FT_ACTION_FRAME_COUNT)
+       R2S(INVALID_PMKID)
+       R2S(INVALID_MDE)
+       R2S(INVALID_FTE)
+       R2S(MESH_PEERING_CANCELLED)
+       R2S(MESH_MAX_PEERS)
+       R2S(MESH_CONFIG_POLICY_VIOLATION)
+       R2S(MESH_CLOSE_RCVD)
+       R2S(MESH_MAX_RETRIES)
+       R2S(MESH_CONFIRM_TIMEOUT)
+       R2S(MESH_INVALID_GTK)
+       R2S(MESH_INCONSISTENT_PARAMS)
+       R2S(MESH_INVALID_SECURITY_CAP)
+       R2S(MESH_PATH_ERROR_NO_PROXY_INFO)
+       R2S(MESH_PATH_ERROR_NO_FORWARDING_INFO)
+       R2S(MESH_PATH_ERROR_DEST_UNREACHABLE)
+       R2S(MAC_ADDRESS_ALREADY_EXISTS_IN_MBSS)
+       R2S(MESH_CHANNEL_SWITCH_REGULATORY_REQ)
+       R2S(MESH_CHANNEL_SWITCH_UNSPECIFIED)
+       }
+       return "UNKNOWN";
+#undef R2S
+}
+
+
 int mb_ies_info_by_ies(struct mb_ies_info *info, const u8 *ies_buf,
                       size_t ies_len)
 {
index d41bd39e7a93c0131e8a088abf28142a25240be5..e402e934403f24d92a9105ac395cd55b85d5ae79 100644 (file)
@@ -185,6 +185,7 @@ int mb_ies_info_by_ies(struct mb_ies_info *info, const u8 *ies_buf,
 struct wpabuf * mb_ies_by_info(struct mb_ies_info *info);
 
 const char * fc2str(u16 fc);
+const char * reason2str(u16 reason);
 
 struct oper_class_map {
        enum hostapd_hw_mode mode;
index f6ec111b77b6eb6d720012c9874d28c3838d866b..3ff8ba92d89691f845357897d05b3cd825479116 100644 (file)
@@ -3596,8 +3596,9 @@ static void wpas_event_disassoc(struct wpa_supplicant *wpa_s,
                ie_len = info->ie_len;
                reason_code = info->reason_code;
                locally_generated = info->locally_generated;
-               wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s", reason_code,
-                       locally_generated ? " (locally generated)" : "");
+               wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u (%s)%s", reason_code,
+                       reason2str(reason_code),
+                       locally_generated ? " locally_generated=1" : "");
                if (addr)
                        wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR,
                                MAC2STR(addr));
@@ -3650,9 +3651,9 @@ static void wpas_event_deauth(struct wpa_supplicant *wpa_s,
                ie_len = info->ie_len;
                reason_code = info->reason_code;
                locally_generated = info->locally_generated;
-               wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u%s",
-                       reason_code,
-                       locally_generated ? " (locally generated)" : "");
+               wpa_dbg(wpa_s, MSG_DEBUG, " * reason %u (%s)%s",
+                       reason_code, reason2str(reason_code),
+                       locally_generated ? " locally_generated=1" : "");
                if (addr) {
                        wpa_dbg(wpa_s, MSG_DEBUG, " * address " MACSTR,
                                MAC2STR(addr));
index 96a3691cf3cf3d873debef40b784742e94481e74..8050ad3e7620b0ccf911f17f9d387709dc5b15a5 100644 (file)
@@ -36,6 +36,7 @@
 #include "rsn_supp/preauth.h"
 #include "rsn_supp/pmksa_cache.h"
 #include "common/wpa_ctrl.h"
+#include "common/ieee802_11_common.h"
 #include "common/ieee802_11_defs.h"
 #include "common/hw_features_common.h"
 #include "common/gas_server.h"
@@ -3428,9 +3429,10 @@ void wpa_supplicant_deauthenticate(struct wpa_supplicant *wpa_s,
        int zero_addr = 0;
 
        wpa_dbg(wpa_s, MSG_DEBUG, "Request to deauthenticate - bssid=" MACSTR
-               " pending_bssid=" MACSTR " reason=%d state=%s",
+               " pending_bssid=" MACSTR " reason=%d (%s) state=%s",
                MAC2STR(wpa_s->bssid), MAC2STR(wpa_s->pending_bssid),
-               reason_code, wpa_supplicant_state_txt(wpa_s->wpa_state));
+               reason_code, reason2str(reason_code),
+               wpa_supplicant_state_txt(wpa_s->wpa_state));
 
        if (!is_zero_ether_addr(wpa_s->pending_bssid) &&
            (wpa_s->wpa_state == WPA_AUTHENTICATING ||