diff --git a/src/mpdu.h b/src/mpdu.h index 1407862f..2cbf86f5 100644 --- a/src/mpdu.h +++ b/src/mpdu.h @@ -52,6 +52,66 @@ enum mpdu_authentication_algorithm_number { MPDU_AUTH_ALGO_SHARED_KEY, }; +/* + * 802.11-2012, Section 8.4.1.7: +*/ +enum mpdu_reason_code { + MPDU_REASON_CODE_UNSPECIFIED = 1, + MPDU_REASON_CODE_PREV_AUTH_NOT_VALID = 2, + MPDU_REASON_CODE_DEAUTH_LEAVING = 3, + MPDU_REASON_CODE_DISASSOC_DUE_TO_INACTIVITY = 4, + MPDU_REASON_CODE_DISASSOC_AP_BUSY = 5, + MPDU_REASON_CODE_CLASS2_FRAME_FROM_NONAUTH_STA = 6, + MPDU_REASON_CODE_CLASS3_FRAME_FROM_NONASSOC_STA = 7, + MPDU_REASON_CODE_DISASSOC_STA_HAS_LEFT = 8, + MPDU_REASON_CODE_STA_REQ_ASSOC_WITHOUT_AUTH = 9, + /* 802.11h */ + MPDU_REASON_CODE_DISASSOC_BAD_POWER = 10, + MPDU_REASON_CODE_DISASSOC_BAD_SUPP_CHAN = 11, + /* 802.11i */ + MPDU_REASON_CODE_INVALID_IE = 13, + MPDU_REASON_CODE_MIC_FAILURE = 14, + MPDU_REASON_CODE_4WAY_HANDSHAKE_TIMEOUT = 15, + MPDU_REASON_CODE_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, + MPDU_REASON_CODE_IE_DIFFERENT = 17, + MPDU_REASON_CODE_INVALID_GROUP_CIPHER = 18, + MPDU_REASON_CODE_INVALID_PAIRWISE_CIPHER = 19, + MPDU_REASON_CODE_INVALID_AKMP = 20, + MPDU_REASON_CODE_UNSUPP_RSN_VERSION = 21, + MPDU_REASON_CODE_INVALID_RSN_IE_CAP = 22, + MPDU_REASON_CODE_IEEE8021X_FAILED = 23, + MPDU_REASON_CODE_CIPHER_SUITE_REJECTED = 24, + /* TDLS (802.11z) */ + MPDU_REASON_CODE_TDLS_TEARDOWN_UNREACHABLE = 25, + MPDU_REASON_CODE_TDLS_TEARDOWN_UNSPECIFIED = 26, + /* 802.11e */ + MPDU_REASON_CODE_DISASSOC_UNSPECIFIED_QOS = 32, + MPDU_REASON_CODE_DISASSOC_QAP_NO_BANDWIDTH = 33, + MPDU_REASON_CODE_DISASSOC_LOW_ACK = 34, + MPDU_REASON_CODE_DISASSOC_QAP_EXCEED_TXOP = 35, + MPDU_REASON_CODE_QSTA_LEAVE_QBSS = 36, + MPDU_REASON_CODE_QSTA_NOT_USE = 37, + MPDU_REASON_CODE_QSTA_REQUIRE_SETUP = 38, + MPDU_REASON_CODE_QSTA_TIMEOUT = 39, + MPDU_REASON_CODE_QSTA_CIPHER_NOT_SUPP = 45, + /* 802.11s */ + MPDU_REASON_CODE_MESH_PEER_CANCELED = 52, + MPDU_REASON_CODE_MESH_MAX_PEERS = 53, + MPDU_REASON_CODE_MESH_CONFIG = 54, + MPDU_REASON_CODE_MESH_CLOSE = 55, + MPDU_REASON_CODE_MESH_MAX_RETRIES = 56, + MPDU_REASON_CODE_MESH_CONFIRM_TIMEOUT = 57, + MPDU_REASON_CODE_MESH_INVALID_GTK = 58, + MPDU_REASON_CODE_MESH_INCONSISTENT_PARAM = 59, + MPDU_REASON_CODE_MESH_INVALID_SECURITY = 60, + MPDU_REASON_CODE_MESH_PATH_ERROR = 61, + MPDU_REASON_CODE_MESH_PATH_NOFORWARD = 62, + MPDU_REASON_CODE_MESH_PATH_DEST_UNREACHABLE = 63, + MPDU_REASON_CODE_MAC_EXISTS_IN_MBSS = 64, + MPDU_REASON_CODE_MESH_CHAN_REGULATORY = 65, + MPDU_REASON_CODE_MESH_CHAN = 66, +}; + /* 802.11, Section 8.2.4.1.1, Figure 8-2 */ struct mpdu_fc { #if defined(__LITTLE_ENDIAN_BITFIELD) diff --git a/src/wiphy.c b/src/wiphy.c index 255561c2..1bfca711 100644 --- a/src/wiphy.c +++ b/src/wiphy.c @@ -45,6 +45,7 @@ #include "src/agent.h" #include "src/crypto.h" #include "src/netdev.h" +#include "src/mpdu.h" static struct l_genl *genl = NULL; static struct l_genl_family *nl80211 = NULL; @@ -95,66 +96,6 @@ struct wiphy { static struct l_queue *wiphy_list = NULL; -/* - * WLAN reason codes from Linux kernel ieee80211.h file. -*/ -enum ieee80211_reasoncode { - WLAN_REASON_UNSPECIFIED = 1, - WLAN_REASON_PREV_AUTH_NOT_VALID = 2, - WLAN_REASON_DEAUTH_LEAVING = 3, - WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4, - WLAN_REASON_DISASSOC_AP_BUSY = 5, - WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6, - WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7, - WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8, - WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9, - /* 802.11h */ - WLAN_REASON_DISASSOC_BAD_POWER = 10, - WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11, - /* 802.11i */ - WLAN_REASON_INVALID_IE = 13, - WLAN_REASON_MIC_FAILURE = 14, - WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15, - WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16, - WLAN_REASON_IE_DIFFERENT = 17, - WLAN_REASON_INVALID_GROUP_CIPHER = 18, - WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19, - WLAN_REASON_INVALID_AKMP = 20, - WLAN_REASON_UNSUPP_RSN_VERSION = 21, - WLAN_REASON_INVALID_RSN_IE_CAP = 22, - WLAN_REASON_IEEE8021X_FAILED = 23, - WLAN_REASON_CIPHER_SUITE_REJECTED = 24, - /* TDLS (802.11z) */ - WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25, - WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26, - /* 802.11e */ - WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32, - WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33, - WLAN_REASON_DISASSOC_LOW_ACK = 34, - WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35, - WLAN_REASON_QSTA_LEAVE_QBSS = 36, - WLAN_REASON_QSTA_NOT_USE = 37, - WLAN_REASON_QSTA_REQUIRE_SETUP = 38, - WLAN_REASON_QSTA_TIMEOUT = 39, - WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45, - /* 802.11s */ - WLAN_REASON_MESH_PEER_CANCELED = 52, - WLAN_REASON_MESH_MAX_PEERS = 53, - WLAN_REASON_MESH_CONFIG = 54, - WLAN_REASON_MESH_CLOSE = 55, - WLAN_REASON_MESH_MAX_RETRIES = 56, - WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57, - WLAN_REASON_MESH_INVALID_GTK = 58, - WLAN_REASON_MESH_INCONSISTENT_PARAM = 59, - WLAN_REASON_MESH_INVALID_SECURITY = 60, - WLAN_REASON_MESH_PATH_ERROR = 61, - WLAN_REASON_MESH_PATH_NOFORWARD = 62, - WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63, - WLAN_REASON_MAC_EXISTS_IN_MBSS = 64, - WLAN_REASON_MESH_CHAN_REGULATORY = 65, - WLAN_REASON_MESH_CHAN = 66, -}; - static void do_debug(const char *str, void *user_data) { const char *prefix = user_data; @@ -658,7 +599,7 @@ static struct l_dbus_message *device_disconnect(struct l_dbus *dbus, { struct netdev *netdev = user_data; struct l_genl_msg *msg; - uint16_t reason_code = WLAN_REASON_DEAUTH_LEAVING; + uint16_t reason_code = MPDU_REASON_CODE_DEAUTH_LEAVING; l_debug("");