3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 14:49:24 +01:00

monitor: indicate if the MPDU was invalid

If the frame was not parsed as an MPDU indicate this in iwmon. This
also adds handling to print probe requests.
This commit is contained in:
James Prestwood 2024-01-02 05:03:55 -08:00 committed by Denis Kenzior
parent cfb468e44d
commit a2fff11823

View File

@ -5127,6 +5127,16 @@ static void print_probe_response(unsigned int level,
(const uint8_t *) mmpdu + len - resp->ies); (const uint8_t *) mmpdu + len - resp->ies);
} }
static void print_probe_request(unsigned int level,
const struct mmpdu_header *mmpdu, size_t len)
{
const struct mmpdu_probe_request *req = mmpdu_body(mmpdu);
print_attr(level, "Subtype: Probe Request");
print_ie(level + 1, "Probe Request IEs", req->ies,
(const uint8_t *) mmpdu + len - req->ies);
}
static void print_beacon(unsigned int level, static void print_beacon(unsigned int level,
const struct mmpdu_header *mmpdu, size_t len) const struct mmpdu_header *mmpdu, size_t len)
{ {
@ -5164,7 +5174,10 @@ static void print_frame_type(unsigned int level, const char *label,
switch (subtype) { switch (subtype) {
case 0x00: case 0x00:
if (mpdu)
str = "Association request"; str = "Association request";
else
str = "Association request (invalid MPDU)";
break; break;
case 0x01: case 0x01:
if (mpdu) if (mpdu)
@ -5173,19 +5186,28 @@ static void print_frame_type(unsigned int level, const char *label,
str = "Association response"; str = "Association response";
break; break;
case 0x02: case 0x02:
if (mpdu)
str = "Reassociation request"; str = "Reassociation request";
else
str = "Reassociation request (invalid MPDU)";
break; break;
case 0x03: case 0x03:
if (mpdu)
str = "Reassociation response"; str = "Reassociation response";
else
str = "Reassociation response (invalid MPDU)";
break; break;
case 0x04: case 0x04:
str = "Probe request"; if (mpdu)
print_probe_request(level + 1, mpdu, size);
else
str = "Probe request (invalid MPDU)";
break; break;
case 0x05: case 0x05:
if (mpdu) if (mpdu)
print_probe_response(level + 1, mpdu, size); print_probe_response(level + 1, mpdu, size);
else else
str = "Probe response"; str = "Probe response (invalid MPDU)";
break; break;
case 0x06: case 0x06:
str = "Timing Advertisement"; str = "Timing Advertisement";
@ -5194,25 +5216,28 @@ static void print_frame_type(unsigned int level, const char *label,
if (mpdu) if (mpdu)
print_beacon(level + 1, mpdu, size); print_beacon(level + 1, mpdu, size);
else else
str = "Beacon"; str = "Beacon (invalid MPDU)";
break; break;
case 0x09: case 0x09:
str = "ATIM"; str = "ATIM";
break; break;
case 0x0a: case 0x0a:
if (mpdu)
str = "Disassociation"; str = "Disassociation";
else
str = "Disassociation (invalid MPDU)";
break; break;
case 0x0b: case 0x0b:
if (mpdu) if (mpdu)
print_authentication_mgmt_frame(level + 1, mpdu, size); print_authentication_mgmt_frame(level + 1, mpdu, size);
else else
str = "Authentication"; str = "Authentication (invalid MPDU)";
break; break;
case 0x0c: case 0x0c:
if (mpdu) if (mpdu)
print_deauthentication_mgmt_frame(level + 1, mpdu); print_deauthentication_mgmt_frame(level + 1, mpdu);
else else
str = "Deauthentication"; str = "Deauthentication (invalid MPDU)";
break; break;
case 0x0d: case 0x0d:
case 0x0e: case 0x0e: