Created
May 20, 2023 21:56
-
-
Save Anthony96922/6561b4839eac46c2886596b357c00772 to your computer and use it in GitHub Desktop.
Report extra VHT capabilites not previously shown
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/scan.c b/scan.c | |
index 7479220..3682855 100644 | |
--- a/scan.c | |
+++ b/scan.c | |
@@ -1510,6 +1510,8 @@ static void print_vht_capa(const uint8_t type, uint8_t len, const uint8_t *data, | |
static void print_vht_oper(const uint8_t type, uint8_t len, const uint8_t *data, | |
const struct print_ies_data *ie_buffer) | |
{ | |
+ __u16 tmp; | |
+ int i; | |
const char *chandwidths[] = { | |
[0] = "20 or 40 MHz", | |
[1] = "80 MHz", | |
@@ -1523,6 +1525,16 @@ static void print_vht_oper(const uint8_t type, uint8_t len, const uint8_t *data, | |
printf("\t\t * center freq segment 1: %d\n", data[1]); | |
printf("\t\t * center freq segment 2: %d\n", data[2]); | |
printf("\t\t * VHT basic MCS set: 0x%.2x%.2x\n", data[4], data[3]); | |
+ tmp = data[3] | (data[4] << 8); | |
+ for (i = 1; i <= 8; i++) { | |
+ printf("\t\t\t%d streams: ", i); | |
+ switch ((tmp >> ((i-1)*2) ) & 3) { | |
+ case 0: printf("MCS 0-7\n"); break; | |
+ case 1: printf("MCS 0-8\n"); break; | |
+ case 2: printf("MCS 0-9\n"); break; | |
+ case 3: printf("not supported\n"); break; | |
+ } | |
+ } | |
} | |
static void print_supp_op_classes(const uint8_t type, uint8_t len, | |
diff --git a/util.c b/util.c | |
index dc09193..e8cadc6 100644 | |
--- a/util.c | |
+++ b/util.c | |
@@ -841,20 +841,13 @@ static void print_mcs_index(const __u8 *mcs) | |
} | |
/* | |
- * There are only 4 possible values, we just use a case instead of computing it, | |
- * but technically this can also be computed through the formula: | |
+ * Compute the max AMPDU length using the formula: | |
* | |
* Max AMPDU length = (2 ^ (13 + exponent)) - 1 bytes | |
*/ | |
static __u32 compute_ampdu_length(__u8 exponent) | |
{ | |
- switch (exponent) { | |
- case 0: return 8191; /* (2 ^(13 + 0)) -1 */ | |
- case 1: return 16383; /* (2 ^(13 + 1)) -1 */ | |
- case 2: return 32767; /* (2 ^(13 + 2)) -1 */ | |
- case 3: return 65535; /* (2 ^(13 + 3)) -1 */ | |
- default: return 0; | |
- } | |
+ return (1 << (13 + exponent)) - 1; | |
} | |
static const char *print_ampdu_space(__u8 space) | |
@@ -1188,16 +1181,39 @@ void print_vht_info(__u32 capa, const __u8 *mcs) | |
PRINT_VHT_CAPA(6, "short GI (160/80+80 MHz)"); | |
PRINT_VHT_CAPA(7, "TX STBC"); | |
/* RX STBC */ | |
+ printf("\t\t\tRX STBC: "); | |
+ switch ((capa & 0x700) >> 8) { | |
+ case 0: printf("not supported\n"); break; | |
+ case 1: printf("up to 1 stream\n"); break; | |
+ case 2: printf("up to 2 streams\n"); break; | |
+ case 3: printf("up to 3 streams\n"); break; | |
+ case 4: printf("up to 4 streams\n"); break; | |
+ default: printf("(reserved)\n"); | |
+ } | |
PRINT_VHT_CAPA(11, "SU Beamformer"); | |
PRINT_VHT_CAPA(12, "SU Beamformee"); | |
/* compressed steering */ | |
+ printf("\t\t\tCompressed Steering Number of Beamformer Antennas: %d\n", | |
+ ((capa & 0xe000) >> 13) + 1); | |
/* # of sounding dimensions */ | |
+ printf("\t\t\tNumber of Sounding Dimensions: %d\n", | |
+ ((capa & 0x70000) >> 16) + 1); | |
PRINT_VHT_CAPA(19, "MU Beamformer"); | |
PRINT_VHT_CAPA(20, "MU Beamformee"); | |
PRINT_VHT_CAPA(21, "VHT TXOP PS"); | |
PRINT_VHT_CAPA(22, "+HTC-VHT"); | |
/* max A-MPDU */ | |
+ printf("\t\t\tMax A-MPDU Length: %d (exponent: %d)\n", | |
+ compute_ampdu_length((capa & 0x3800000) >> 23), | |
+ (capa & 0x3800000) >> 23); | |
/* VHT link adaptation */ | |
+ printf("\t\t\tVHT Link Adaptation: "); | |
+ switch ((capa & 0xc000000) >> 26) { | |
+ case 1: printf("(reserved)\n"); break; | |
+ case 2: printf("Unsolicited\n"); break; | |
+ case 3: printf("Both Solicited and Unsolicited\n"); break; | |
+ default: printf("No Feedback\n"); break; | |
+ } | |
PRINT_VHT_CAPA(28, "RX antenna pattern consistency"); | |
PRINT_VHT_CAPA(29, "TX antenna pattern consistency"); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment