2014-12-12 11:17:43 +01:00
|
|
|
/*
|
|
|
|
*
|
|
|
|
* Wireless daemon for Linux
|
|
|
|
*
|
2019-10-25 00:43:08 +02:00
|
|
|
* Copyright (C) 2014-2019 Intel Corporation. All rights reserved.
|
2014-12-12 11:17:43 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <stdbool.h>
|
2014-12-18 00:44:44 +01:00
|
|
|
#include <asm/byteorder.h>
|
|
|
|
#include <linux/types.h>
|
2014-12-12 11:17:43 +01:00
|
|
|
|
2017-03-10 12:29:05 +01:00
|
|
|
/* Std 802.11, Section 8.2.3 */
|
|
|
|
#define IEEE80211_MAX_DATA_LEN 2304
|
|
|
|
|
2014-12-16 21:21:18 +01:00
|
|
|
/* 802.11, Table 8-1 "Valid type and subtype combinations" */
|
2014-12-12 11:17:43 +01:00
|
|
|
enum mpdu_type {
|
|
|
|
MPDU_TYPE_MANAGEMENT = 0,
|
|
|
|
};
|
|
|
|
|
2017-09-22 05:06:28 +02:00
|
|
|
/* 802.11-2016, Table 9-1 "Valid type and subtype combinations" */
|
2014-12-17 23:22:06 +01:00
|
|
|
enum mpdu_management_subtype {
|
2015-01-21 12:36:44 +01:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_ASSOCIATION_REQUEST = 0x0,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_ASSOCIATION_RESPONSE = 0x1,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_REASSOCIATION_REQUEST = 0x2,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_REASSOCIATION_RESPONSE = 0x3,
|
2015-01-21 12:36:45 +01:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_PROBE_REQUEST = 0x4,
|
2015-01-21 12:36:46 +01:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_PROBE_RESPONSE = 0x5,
|
2015-01-21 12:36:47 +01:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_TIMING_ADVERTISEMENT = 0x6,
|
2015-01-21 12:36:48 +01:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_BEACON = 0x8,
|
2015-01-21 12:36:44 +01:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_ATIM = 0x9,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION = 0xA,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION = 0xB,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION = 0xC,
|
2017-09-22 05:06:28 +02:00
|
|
|
MPDU_MANAGEMENT_SUBTYPE_ACTION = 0xD,
|
|
|
|
MPDU_MANAGEMENT_SUBTYPE_ACTION_NO_ACK = 0xE,
|
2014-12-12 11:17:43 +01:00
|
|
|
};
|
|
|
|
|
2017-09-22 05:06:30 +02:00
|
|
|
/* 802.11-2016, Section 9.4.1.1 Authentication Algorithm Number field */
|
2017-08-31 04:04:41 +02:00
|
|
|
enum mmpdu_authentication_algorithm_number {
|
|
|
|
MMPDU_AUTH_ALGO_OPEN_SYSTEM = 0,
|
|
|
|
MMPDU_AUTH_ALGO_SHARED_KEY,
|
2017-09-22 05:06:30 +02:00
|
|
|
MMPDU_AUTH_ALGO_FT,
|
|
|
|
MMPDU_AUTH_ALGO_SAE,
|
2019-04-05 00:29:39 +02:00
|
|
|
MMPDU_AUTH_ALGO_FILS_SK,
|
|
|
|
MMPDU_AUTH_ALGO_FILS_SK_PFS,
|
|
|
|
MMPDU_AUTH_ALGO_FILS_PK,
|
2014-12-12 11:17:43 +01:00
|
|
|
};
|
|
|
|
|
2015-03-30 03:27:57 +02:00
|
|
|
/*
|
2019-02-27 22:30:43 +01:00
|
|
|
* 802.11-2016, Section 9.4.1.7 Reason Code field
|
2017-09-22 05:06:30 +02:00
|
|
|
*/
|
2017-08-31 04:04:41 +02:00
|
|
|
enum mmpdu_reason_code {
|
|
|
|
MMPDU_REASON_CODE_UNSPECIFIED = 1,
|
|
|
|
MMPDU_REASON_CODE_PREV_AUTH_NOT_VALID = 2,
|
|
|
|
MMPDU_REASON_CODE_DEAUTH_LEAVING = 3,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_DUE_TO_INACTIVITY = 4,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_AP_BUSY = 5,
|
|
|
|
MMPDU_REASON_CODE_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
|
|
|
|
MMPDU_REASON_CODE_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_STA_HAS_LEFT = 8,
|
|
|
|
MMPDU_REASON_CODE_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
|
2015-03-30 03:27:57 +02:00
|
|
|
/* 802.11h */
|
2017-08-31 04:04:41 +02:00
|
|
|
MMPDU_REASON_CODE_DISASSOC_BAD_POWER = 10,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_BAD_SUPP_CHAN = 11,
|
2015-03-30 03:27:57 +02:00
|
|
|
/* 802.11i */
|
2017-08-31 04:04:41 +02:00
|
|
|
MMPDU_REASON_CODE_INVALID_IE = 13,
|
|
|
|
MMPDU_REASON_CODE_MIC_FAILURE = 14,
|
|
|
|
MMPDU_REASON_CODE_4WAY_HANDSHAKE_TIMEOUT = 15,
|
|
|
|
MMPDU_REASON_CODE_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
|
|
|
|
MMPDU_REASON_CODE_IE_DIFFERENT = 17,
|
|
|
|
MMPDU_REASON_CODE_INVALID_GROUP_CIPHER = 18,
|
|
|
|
MMPDU_REASON_CODE_INVALID_PAIRWISE_CIPHER = 19,
|
|
|
|
MMPDU_REASON_CODE_INVALID_AKMP = 20,
|
|
|
|
MMPDU_REASON_CODE_UNSUPP_RSN_VERSION = 21,
|
|
|
|
MMPDU_REASON_CODE_INVALID_RSN_IE_CAP = 22,
|
|
|
|
MMPDU_REASON_CODE_IEEE8021X_FAILED = 23,
|
|
|
|
MMPDU_REASON_CODE_CIPHER_SUITE_REJECTED = 24,
|
2015-03-30 03:27:57 +02:00
|
|
|
/* TDLS (802.11z) */
|
2017-08-31 04:04:41 +02:00
|
|
|
MMPDU_REASON_CODE_TDLS_TEARDOWN_UNREACHABLE = 25,
|
|
|
|
MMPDU_REASON_CODE_TDLS_TEARDOWN_UNSPECIFIED = 26,
|
2015-03-30 03:27:57 +02:00
|
|
|
/* 802.11e */
|
2017-08-31 04:04:41 +02:00
|
|
|
MMPDU_REASON_CODE_DISASSOC_UNSPECIFIED_QOS = 32,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_QAP_NO_BANDWIDTH = 33,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_LOW_ACK = 34,
|
|
|
|
MMPDU_REASON_CODE_DISASSOC_QAP_EXCEED_TXOP = 35,
|
|
|
|
MMPDU_REASON_CODE_QSTA_LEAVE_QBSS = 36,
|
|
|
|
MMPDU_REASON_CODE_QSTA_NOT_USE = 37,
|
|
|
|
MMPDU_REASON_CODE_QSTA_REQUIRE_SETUP = 38,
|
|
|
|
MMPDU_REASON_CODE_QSTA_TIMEOUT = 39,
|
|
|
|
MMPDU_REASON_CODE_QSTA_CIPHER_NOT_SUPP = 45,
|
2015-03-30 03:27:57 +02:00
|
|
|
/* 802.11s */
|
2017-08-31 04:04:41 +02:00
|
|
|
MMPDU_REASON_CODE_MESH_PEER_CANCELED = 52,
|
|
|
|
MMPDU_REASON_CODE_MESH_MAX_PEERS = 53,
|
|
|
|
MMPDU_REASON_CODE_MESH_CONFIG = 54,
|
|
|
|
MMPDU_REASON_CODE_MESH_CLOSE = 55,
|
|
|
|
MMPDU_REASON_CODE_MESH_MAX_RETRIES = 56,
|
|
|
|
MMPDU_REASON_CODE_MESH_CONFIRM_TIMEOUT = 57,
|
|
|
|
MMPDU_REASON_CODE_MESH_INVALID_GTK = 58,
|
|
|
|
MMPDU_REASON_CODE_MESH_INCONSISTENT_PARAM = 59,
|
|
|
|
MMPDU_REASON_CODE_MESH_INVALID_SECURITY = 60,
|
|
|
|
MMPDU_REASON_CODE_MESH_PATH_ERROR = 61,
|
|
|
|
MMPDU_REASON_CODE_MESH_PATH_NOFORWARD = 62,
|
|
|
|
MMPDU_REASON_CODE_MESH_PATH_DEST_UNREACHABLE = 63,
|
|
|
|
MMPDU_REASON_CODE_MAC_EXISTS_IN_MBSS = 64,
|
|
|
|
MMPDU_REASON_CODE_MESH_CHAN_REGULATORY = 65,
|
|
|
|
MMPDU_REASON_CODE_MESH_CHAN = 66,
|
2019-02-27 22:30:43 +01:00
|
|
|
/* 67 - 65535 reserved */
|
2019-02-27 22:30:40 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
2021-07-09 17:58:54 +02:00
|
|
|
* 802.11-2020, Section 9.4.1.9 Status Code field
|
2019-02-27 22:30:40 +01:00
|
|
|
*/
|
|
|
|
enum mmpdu_status_code {
|
2021-07-09 17:58:54 +02:00
|
|
|
MMPDU_STATUS_CODE_SUCCESS = 0,
|
2019-02-27 22:30:40 +01:00
|
|
|
MMPDU_STATUS_CODE_UNSPECIFIED = 1,
|
|
|
|
MMPDU_STATUS_CODE_TDLS_REJECTED_ALT_PROV = 2,
|
|
|
|
MMPDU_STATUS_CODE_TDLS_REJECTED = 3,
|
|
|
|
/* 4 reserved */
|
|
|
|
MMPDU_STATUS_CODE_SECURITY_DISABLED = 5,
|
|
|
|
MMPDU_STATUS_CODE_UNACCEPTABLE_LIFETIME = 6,
|
|
|
|
MMPDU_STATUS_CODE_NOT_IN_SAME_BSS = 7,
|
|
|
|
/* 8-9 reserved */
|
|
|
|
MMPDU_STATUS_CODE_CAPABILITIES_MISMATCH = 10,
|
|
|
|
MMPDU_STATUS_CODE_NO_ASSOC_EXISTS = 11,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_OTHER_REASON = 12,
|
|
|
|
MMPDU_STATUS_CODE_UNSUP_AUTH_ALG = 13,
|
|
|
|
MMPDU_STATUS_CODE_TRANS_SEQ_ERROR = 14,
|
|
|
|
MMPDU_STATUS_CODE_CHALLENGE_FAILURE = 15,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_SEQ_TIMEOUT = 16,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_NO_MORE_STAS = 17,
|
|
|
|
MMPDU_STATUS_CODE_REFUSED_RATE_MISMATCH = 18,
|
|
|
|
MMPDU_STATUS_CODE_NO_SHORT_PREAMBLE_SUPP = 19,
|
|
|
|
/* 20-21 reserved */
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_SPECTRUM_MGMT = 22,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_BAD_POWER_CAP = 23,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_BAD_SUPP_CHAN = 24,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_NO_SHORT_SLOT_TIME = 25,
|
|
|
|
/* 26 reserved */
|
|
|
|
MMPDU_STATUS_CODE_DENIED_NO_HT_SUPP = 27,
|
|
|
|
MMPDU_STATUS_CODE_R0KH_UNREACHABLE = 28,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_PCO_TIME_NOT_SUPP = 29,
|
|
|
|
MMPDU_STATUS_CODE_REFUSED_TEMPORARILY = 30,
|
|
|
|
MMPDU_STATUS_CODE_ROBUST_MGMT_POLICY_VIOLATION = 31,
|
|
|
|
MMPDU_STATUS_CODE_UNSPECIFIED_QOS_FAILURE = 32,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_UNSUFFICIENT_BANDWIDTH = 33,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_POOR_CHAN_CONDITIONS = 34,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_QOS_NOT_SUPP = 35,
|
|
|
|
/* 36 reserved */
|
|
|
|
MMPDU_STATUS_CODE_REQUEST_DECLINED = 37,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_PARAMETERS = 38,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_WITH_SUGG_CHANGES = 39,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_ELEMENT = 40,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_GROUP_CIPHER = 41,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_PAIRWISE_CIPHER = 42,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_AKMP = 43,
|
|
|
|
MMPDU_STATUS_CODE_UNSUPP_RSNE_VERSION = 44,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_RSNE_CAP = 45,
|
|
|
|
MMPDU_STATUS_CODE_CIPHER_OUT_OF_POLICY = 46,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_FOR_DELAY_PERIOD = 47,
|
|
|
|
MMPDU_STATUS_CODE_DLS_NOT_ALLOWED = 48,
|
|
|
|
MMPDU_STATUS_CODE_NOT_PRESENT = 49,
|
|
|
|
MMPDU_STATUS_CODE_NOT_QOS_STA = 50,
|
|
|
|
MMPDU_STATUS_CODE_LISTEN_INTERVAL_TOO_LARGE = 51,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_FT_ACTION_FRAME_COUNT = 52,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_PMKID = 53,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_MDE = 54,
|
|
|
|
MMPDU_STATUS_CODE_INVALID_FTE = 55,
|
|
|
|
MMPDU_STATUS_CODE_REQ_TCLAS_NOT_SUPP = 56,
|
|
|
|
MMPDU_STATUS_CODE_INSUFFICIENT_TCLAS_PROCESS_RESOURCE = 57,
|
|
|
|
MMPDU_STATUS_CODE_TRY_ANOTHER_BSS = 58,
|
|
|
|
MMPDU_STATUS_CODE_GAS_ADVERTISEMENT_NOT_SUPP = 59,
|
|
|
|
MMPDU_STATUS_CODE_NO_OUTSTANDING_GAS_REQ = 60,
|
|
|
|
MMPDU_STATUS_CODE_GAS_RESP_NOT_RECEIVED = 61,
|
|
|
|
MMPDU_STATUS_CODE_GAS_QUERY_TIMEOUT = 62,
|
|
|
|
MMPDU_STATUS_CODE_GAS_QUERY_RESP_TOO_LARGE = 63,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_HOME_SUGG_CHANGES = 64,
|
|
|
|
MMPDU_STATUS_CODE_SERVER_UNREACHABLE = 65,
|
|
|
|
/* 66 reserved */
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_FOR_SSP_PERMISSIONS = 67,
|
|
|
|
MMPDU_STATUS_CODE_REFUSED_UNAUTH_ACCESS_NOT_SUPP = 68,
|
|
|
|
/* 69-71 reserved */
|
|
|
|
MMPDU_STATUS_CODE_INVALID_RSNE = 72,
|
|
|
|
MMPDU_STATUS_CODE_U_APSD_COEX_NOT_SUPP = 73,
|
|
|
|
MMPDU_STATUS_CODE_U_APSD_COEX_MODE_NOT_SUPP = 74,
|
|
|
|
MMPDU_STATUS_CODE_BAD_INTERVAL_WITH_U_APSD_COEX = 75,
|
|
|
|
MMPDU_STATUS_CODE_ANTI_CLOGGING_TOKEN_REQ = 76,
|
|
|
|
MMPDU_STATUS_CODE_UNSUPP_FINITE_CYCLIC_GROUP = 77,
|
|
|
|
MMPDU_STATUS_CODE_CANNOT_FIND_ALT_TBTT = 78,
|
|
|
|
MMPDU_STATUS_CODE_TRANSMISSION_FAILURE = 79,
|
|
|
|
/* Spec has 2 errors with the same name (56 above) bug? */
|
|
|
|
MMPDU_STATUS_CODE_REQ_TCLAS_NOT_SUPP2 = 80,
|
|
|
|
MMPDU_STATUS_CODE_TCLAS_RESOURCE_EXAUSTED = 81,
|
|
|
|
MMPDU_STATUS_CODE_REJECTED_WITH_SUGG_BSS_TRANS = 82,
|
|
|
|
MMPDU_STATUS_CODE_REJECT_WITH_SCHEDULE = 83,
|
|
|
|
MMPDU_STATUS_CODE_REJECT_NO_WAKEUP_SPECIFIED = 84,
|
|
|
|
MMPDU_STATUS_CODE_SUCCESS_POWER_SAVE_MODE = 85,
|
|
|
|
MMPDU_STATUS_CODE_PENDING_ADMITTING_FST_SESSION = 86,
|
|
|
|
MMPDU_STATUS_CODE_PERFORMING_FST_NOW = 87,
|
|
|
|
MMPDU_STATUS_CODE_PENDING_GAP_IN_BA_WINDOW = 88,
|
|
|
|
MMPDU_STATUS_CODE_REJECT_U_PID_SETTING = 89,
|
|
|
|
/* 90-91 reserved */
|
|
|
|
MMPDU_STATUS_CODE_REFUSED_EXTERNAL_REASON = 92,
|
|
|
|
MMPDU_STATUS_CODE_REFUSED_AP_OOM = 93,
|
|
|
|
MMPDU_STATUS_CODE_REJECT_EMERGENCY_SERVICE_NOT_SUPP = 94,
|
|
|
|
MMPDU_STATUS_CODE_QUERY_RESPONSE_OUTSTANDING = 95,
|
|
|
|
MMPDU_STATUS_CODE_REJECT_DSE_BAND = 96,
|
|
|
|
MMPDU_STATUS_CODE_TCLAS_PROCESSING_TERM = 97,
|
|
|
|
MMPDU_STATUS_CODE_TS_SCHEDULE_CONFLICT = 98,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_WITH_SUGG_BAND = 99,
|
|
|
|
MMPDU_STATUS_CODE_MCCAOP_RESERVATION_CONFLICT = 100,
|
|
|
|
MMPDU_STATUS_CODE_MAF_LIMIT_EXCEEDED = 101,
|
|
|
|
MMPDU_STATUS_CODE_MCCA_TRACK_LIMIT_EXCEEDED = 102,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_SPECTRUM_MGMT = 103,
|
|
|
|
MMPDU_STATUS_CODE_DENIED_VHT_NOT_SUPP = 104,
|
|
|
|
MMPDU_STATUS_CODE_ENABLEMENT_DENIED = 105,
|
|
|
|
MMPDU_STATUS_CODE_RESTRICT_AUTH_GDB = 106,
|
|
|
|
MMPDU_STATUS_CODE_AUTHORIZATION_DEENABLED = 107,
|
2023-12-05 16:46:45 +01:00
|
|
|
MMPDU_STATUS_CODE_UNKNOWN_PASSWORD_IDENTIFIER = 123,
|
2021-07-09 17:58:54 +02:00
|
|
|
MMPDU_STATUS_CODE_SAE_HASH_TO_ELEMENT = 126,
|
2021-09-08 23:31:59 +02:00
|
|
|
MMPDU_STATUS_CODE_SAE_PK = 127,
|
2015-03-30 03:27:57 +02:00
|
|
|
};
|
|
|
|
|
2014-12-16 21:21:18 +01:00
|
|
|
/* 802.11, Section 8.2.4.1.1, Figure 8-2 */
|
2014-12-12 11:17:43 +01:00
|
|
|
struct mpdu_fc {
|
2014-12-18 00:44:44 +01:00
|
|
|
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
2014-12-17 23:22:06 +01:00
|
|
|
uint8_t protocol_version:2;
|
|
|
|
uint8_t type:2;
|
|
|
|
uint8_t subtype:4;
|
|
|
|
bool to_ds:1;
|
|
|
|
bool from_ds:1;
|
|
|
|
bool more_fragments:1;
|
|
|
|
bool retry:1;
|
|
|
|
bool power_mgmt:1;
|
|
|
|
bool more_data:1;
|
|
|
|
bool protected_frame:1;
|
|
|
|
bool order:1;
|
2014-12-18 00:44:44 +01:00
|
|
|
#elif defined (__BIG_ENDIAN_BITFIELD)
|
|
|
|
uint8_t subtype:4;
|
|
|
|
uint8_t type:2;
|
|
|
|
uint8_t protocol_version:2;
|
|
|
|
bool order:1;
|
|
|
|
bool protected_frame:1;
|
|
|
|
bool more_data:1;
|
|
|
|
bool power_mgmt:1;
|
|
|
|
bool retry:1;
|
|
|
|
bool more_fragments:1;
|
|
|
|
bool from_ds:1;
|
|
|
|
bool to_ds:1;
|
|
|
|
#else
|
|
|
|
#error "Please fix <asm/byteorder.h>"
|
|
|
|
#endif
|
2014-12-17 23:22:06 +01:00
|
|
|
} __attribute__ ((packed));
|
2014-12-12 11:17:43 +01:00
|
|
|
|
2014-12-16 21:21:18 +01:00
|
|
|
/* 802.11, Section 8.3.3.1 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_header {
|
|
|
|
struct mpdu_fc fc;
|
2014-12-18 00:44:44 +01:00
|
|
|
__le16 duration;
|
2014-12-12 11:17:43 +01:00
|
|
|
unsigned char address_1[6];
|
|
|
|
unsigned char address_2[6];
|
|
|
|
unsigned char address_3[6];
|
2014-12-18 00:44:44 +01:00
|
|
|
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
2014-12-19 19:17:46 +01:00
|
|
|
uint8_t fragment_number:4;
|
|
|
|
uint8_t sequence_number_low:4;
|
2014-12-18 00:44:44 +01:00
|
|
|
#elif defined (__BIG_ENDIAN_BITFIELD)
|
2014-12-19 19:17:46 +01:00
|
|
|
uint8_t sequence_number_low:4;
|
|
|
|
uint8_t fragment_number:4;
|
2014-12-18 00:44:44 +01:00
|
|
|
#else
|
|
|
|
#error "Please fix <asm/byteorder.h>"
|
|
|
|
#endif
|
2014-12-19 19:17:46 +01:00
|
|
|
uint8_t sequence_number_high;
|
2014-12-18 00:44:44 +01:00
|
|
|
__le32 ht_control; /* ToDo? */
|
2014-12-17 23:22:06 +01:00
|
|
|
} __attribute__ ((packed));
|
2014-12-12 11:17:43 +01:00
|
|
|
|
2017-08-31 04:04:41 +02:00
|
|
|
#define MPDU_SEQUENCE_NUMBER(v) \
|
2014-12-19 19:17:46 +01:00
|
|
|
(((v).sequence_number_high << 4) + ((v).sequence_number_low))
|
|
|
|
|
2015-01-21 12:36:41 +01:00
|
|
|
/* 802.11, Section 8.4.1.4 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_field_capability {
|
2015-01-21 12:36:41 +01:00
|
|
|
#if defined(__LITTLE_ENDIAN_BITFIELD)
|
|
|
|
bool ess:1;
|
|
|
|
bool ibss:1;
|
|
|
|
bool cf_pollable:1;
|
|
|
|
bool cf_poll_req:1;
|
|
|
|
bool privacy:1;
|
|
|
|
bool preamble:1;
|
|
|
|
bool pbcc:1;
|
|
|
|
bool chanl_agility:1;
|
|
|
|
bool spectrum_mgmt:1;
|
|
|
|
bool qos:1;
|
|
|
|
bool short_time:1;
|
|
|
|
bool apsd:1;
|
|
|
|
bool radio_mesure:1;
|
|
|
|
bool dsss_ofdm:1;
|
|
|
|
bool delayed_ack:1;
|
|
|
|
bool immediate_ack:1;
|
|
|
|
#elif defined (__BIG_ENDIAN_BITFIELD)
|
|
|
|
bool chanl_agility:1;
|
|
|
|
bool pbcc:1;
|
|
|
|
bool preamble:1;
|
|
|
|
bool privacy:1;
|
|
|
|
bool cf_poll_req:1;
|
|
|
|
bool cf_pollable:1;
|
|
|
|
bool ibss:1;
|
|
|
|
bool ess:1;
|
|
|
|
bool immediate_ack:1;
|
|
|
|
bool delayed_ack:1;
|
|
|
|
bool dsss_ofdm:1;
|
|
|
|
bool radio_mesure:1;
|
|
|
|
bool apsd:1;
|
|
|
|
bool short_time:1;
|
|
|
|
bool qos:1;
|
|
|
|
bool spectrum_mgmt:1;
|
|
|
|
#else
|
|
|
|
#error "Please fix <asm/byteorder.h>"
|
|
|
|
#endif
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
|
|
|
/* 802.11, Section 8.3.3.5 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_association_request {
|
|
|
|
struct mmpdu_field_capability capability;
|
2015-01-21 12:36:41 +01:00
|
|
|
__le16 listen_interval;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:41 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:42 +01:00
|
|
|
/* 802.11, Section 8.3.3.6 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_association_response {
|
|
|
|
struct mmpdu_field_capability capability;
|
2015-01-21 12:36:42 +01:00
|
|
|
__le16 status_code;
|
|
|
|
__le16 aid;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:42 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:43 +01:00
|
|
|
/* 802.11, Section 8.3.3.7 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_reassociation_request {
|
|
|
|
struct mmpdu_field_capability capability;
|
2015-01-21 12:36:43 +01:00
|
|
|
__le16 listen_interval;
|
|
|
|
unsigned char current_ap_address[6];
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:43 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:44 +01:00
|
|
|
/* 802.11, Section 8.3.3.8 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_reassociation_response {
|
|
|
|
struct mmpdu_field_capability capability;
|
2015-01-21 12:36:44 +01:00
|
|
|
__le16 status_code;
|
|
|
|
__le16 aid;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:44 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:40 +01:00
|
|
|
/* 802.11, Section 8.3.3.4 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_disassociation {
|
2015-01-21 12:36:40 +01:00
|
|
|
__le16 reason_code;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:40 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:45 +01:00
|
|
|
/* 802.11, Section 8.3.3.9 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_probe_request {
|
2015-01-21 12:36:45 +01:00
|
|
|
uint8_t ies[0];
|
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:46 +01:00
|
|
|
/* 802.11, Section 8.3.3.10 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_probe_response {
|
2022-09-15 23:18:52 +02:00
|
|
|
__le64 timestamp;
|
2015-01-21 12:36:46 +01:00
|
|
|
__le16 beacon_interval;
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_field_capability capability;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:46 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:47 +01:00
|
|
|
/* 802.11, Section 8.3.3.15 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_timing_advertisement {
|
2022-09-15 23:18:52 +02:00
|
|
|
__le64 timestamp;
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_field_capability capability;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:47 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2015-01-21 12:36:48 +01:00
|
|
|
/* 802.11, Section 8.3.3.2 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_beacon {
|
2022-09-15 23:18:52 +02:00
|
|
|
__le64 timestamp;
|
2015-01-21 12:36:48 +01:00
|
|
|
__le16 beacon_interval;
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_field_capability capability;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2015-01-21 12:36:48 +01:00
|
|
|
} __attribute__ ((packed));
|
|
|
|
|
2014-12-16 21:21:18 +01:00
|
|
|
/* 802.11, Section 8.3.3.11 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_authentication {
|
2014-12-18 00:44:44 +01:00
|
|
|
__le16 algorithm;
|
|
|
|
__le16 transaction_sequence;
|
|
|
|
__le16 status;
|
2017-09-22 05:06:31 +02:00
|
|
|
uint8_t ies[];
|
2014-12-18 00:44:44 +01:00
|
|
|
} __attribute__ ((packed));
|
2014-12-12 11:17:43 +01:00
|
|
|
|
2014-12-16 21:21:18 +01:00
|
|
|
/* 802.11, Section 8.3.3.12 */
|
2017-08-31 04:04:41 +02:00
|
|
|
struct mmpdu_deauthentication {
|
2014-12-18 00:44:44 +01:00
|
|
|
__le16 reason_code;
|
2023-04-14 04:36:14 +02:00
|
|
|
uint8_t ies[];
|
2014-12-18 00:44:44 +01:00
|
|
|
} __attribute__ ((packed));
|
2014-12-12 11:17:43 +01:00
|
|
|
|
2017-08-31 04:04:41 +02:00
|
|
|
const struct mmpdu_header *mpdu_validate(const uint8_t *frame, int len);
|
|
|
|
const void *mmpdu_body(const struct mmpdu_header *mpdu);
|
2019-10-21 23:01:57 +02:00
|
|
|
size_t mmpdu_header_len(const struct mmpdu_header *mmpdu);
|
2021-08-04 17:41:19 +02:00
|
|
|
|
|
|
|
int mpdu_sort_ies(enum mpdu_management_subtype type,
|
|
|
|
struct iovec *iov, size_t n_iovs);
|