mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
mpdu: Validate disassociation mpdu subtype
These own a reason code which is currently the only interesting information to handle. Let's skip the vendor specific ones for now.
This commit is contained in:
parent
e106033fce
commit
d1c29daa24
@ -54,6 +54,13 @@ static bool validate_atim_mgmt_mpdu(const struct mpdu *mpdu,
|
|||||||
return *offset == len;
|
return *offset == len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool validate_disassociation_mgmt_mpdu(const struct mpdu *mpdu,
|
||||||
|
int len, int *offset)
|
||||||
|
{
|
||||||
|
*offset += 2;
|
||||||
|
return *offset <= len;
|
||||||
|
}
|
||||||
|
|
||||||
static bool validate_authentication_mgmt_mpdu(const struct mpdu *mpdu,
|
static bool validate_authentication_mgmt_mpdu(const struct mpdu *mpdu,
|
||||||
int len, int *offset)
|
int len, int *offset)
|
||||||
{
|
{
|
||||||
@ -103,6 +110,8 @@ static bool validate_mgmt_mpdu(const struct mpdu *mpdu, int len, int *offset)
|
|||||||
switch (mpdu->fc.subtype) {
|
switch (mpdu->fc.subtype) {
|
||||||
case MPDU_MANAGEMENT_SUBTYPE_ATIM:
|
case MPDU_MANAGEMENT_SUBTYPE_ATIM:
|
||||||
return validate_atim_mgmt_mpdu(mpdu, len, offset);
|
return validate_atim_mgmt_mpdu(mpdu, len, offset);
|
||||||
|
case MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION:
|
||||||
|
return validate_disassociation_mgmt_mpdu(mpdu, len, offset);
|
||||||
case MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION:
|
case MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION:
|
||||||
return validate_authentication_mgmt_mpdu(mpdu, len, offset);
|
return validate_authentication_mgmt_mpdu(mpdu, len, offset);
|
||||||
case MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION:
|
case MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION:
|
||||||
|
@ -33,6 +33,7 @@ enum mpdu_type {
|
|||||||
/* 802.11, Table 8-1 "Valid type and subtype combinations" */
|
/* 802.11, Table 8-1 "Valid type and subtype combinations" */
|
||||||
enum mpdu_management_subtype {
|
enum mpdu_management_subtype {
|
||||||
MPDU_MANAGEMENT_SUBTYPE_ATIM = 0x9,
|
MPDU_MANAGEMENT_SUBTYPE_ATIM = 0x9,
|
||||||
|
MPDU_MANAGEMENT_SUBTYPE_DISASSOCIATION = 0xA,
|
||||||
MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION = 0xB,
|
MPDU_MANAGEMENT_SUBTYPE_AUTHENTICATION = 0xB,
|
||||||
MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION = 0xC,
|
MPDU_MANAGEMENT_SUBTYPE_DEAUTHENTICATION = 0xC,
|
||||||
};
|
};
|
||||||
@ -96,6 +97,12 @@ struct mpdu_mgmt_header {
|
|||||||
#define MPDU_MGMT_SEQUENCE_NUMBER(v) \
|
#define MPDU_MGMT_SEQUENCE_NUMBER(v) \
|
||||||
(((v).sequence_number_high << 4) + ((v).sequence_number_low))
|
(((v).sequence_number_high << 4) + ((v).sequence_number_low))
|
||||||
|
|
||||||
|
/* 802.11, Section 8.3.3.4 */
|
||||||
|
struct mpdu_disassociation {
|
||||||
|
__le16 reason_code;
|
||||||
|
uint8_t ies[0];
|
||||||
|
} __attribute__ ((packed));
|
||||||
|
|
||||||
/* 802.11, Section 8.3.3.11 */
|
/* 802.11, Section 8.3.3.11 */
|
||||||
struct mpdu_authentication {
|
struct mpdu_authentication {
|
||||||
__le16 algorithm;
|
__le16 algorithm;
|
||||||
@ -122,6 +129,7 @@ struct mpdu {
|
|||||||
struct mpdu_fc fc;
|
struct mpdu_fc fc;
|
||||||
struct mpdu_mgmt_header mgmt_hdr;
|
struct mpdu_mgmt_header mgmt_hdr;
|
||||||
union {
|
union {
|
||||||
|
struct mpdu_disassociation disassoc;
|
||||||
struct mpdu_authentication auth;
|
struct mpdu_authentication auth;
|
||||||
struct mpdu_deauthentication deauth;
|
struct mpdu_deauthentication deauth;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user