Skip to contentSkip to conversation

mpdu: fix timestamp size in mpdu frames

PATCH In review James Prestwood 2 participants 3 messages Sep 15, 2022

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mpdu: fix timestamp size in mpdu frames

Beacons, probe responses and timing advertisements were only using 1 byte for the timestamps which should be 8 bytes.

---
 src/mpdu.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

v2:
* Use __le64 rather than uint64_t

src/mpdu.h +3 -3
index 36fe2470..9a825f2a 100644
@@ -374,7 +374,7 @@ struct mmpdu_probe_request {
 
 /* 802.11, Section 8.3.3.10 */
 struct mmpdu_probe_response {
-	uint8_t timestamp;
+	__le64 timestamp;
 	__le16 beacon_interval;
 	struct mmpdu_field_capability capability;
 	uint8_t ies[0];
@@ -382,14 +382,14 @@ struct mmpdu_probe_response {
 
 /* 802.11, Section 8.3.3.15 */
 struct mmpdu_timing_advertisement {
-	uint8_t timestamp;
+	__le64 timestamp;
 	struct mmpdu_field_capability capability;
 	uint8_t ies[0];
 } __attribute__ ((packed));
 
 /* 802.11, Section 8.3.3.2 */
 struct mmpdu_beacon {
-	uint8_t timestamp;
+	__le64 timestamp;
 	__le16 beacon_interval;
 	struct mmpdu_field_capability capability;
 	uint8_t ies[0];
Signature · 1 line
2.34.3
#1 lore raw

PATCH v2 2/2 monitor: parse probe response frames

---
 monitor/nlmon.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
monitor/nlmon.c +14 -1
index 15f4c828..5ae014e4 100644
@@ -5018,6 +5018,16 @@ static void print_action_mgmt_frame(unsigned int level,
 	print_mmpdu_header(level + 1, mmpdu);
 }
 
+static void print_probe_response(unsigned int level,
+				const struct mmpdu_header *mmpdu, size_t len)
+{
+	const struct mmpdu_probe_response *resp = mmpdu_body(mmpdu);
+
+	print_attr(level, "Subtype: Probe Response");
+	print_ie(level + 1, "Probe Response IEs", resp->ies,
+			(const uint8_t *) mmpdu + len - resp->ies);
+}
+
 static void print_frame_type(unsigned int level, const char *label,
 					const void *data, uint16_t size)
 {
@@ -5063,7 +5073,10 @@ static void print_frame_type(unsigned int level, const char *label,
 		str = "Probe request";
 		break;
 	case 0x05:
-		str = "Probe response";
+		if (mpdu)
+			print_probe_response(level + 1, mpdu, size);
+		else
+			str = "Probe response";
 		break;
 	case 0x06:
 		str = "Timing Advertisement";
Signature · 1 line
2.34.3
#2 lore raw
In reply to James Prestwood

Hi James,

Quoted 9 lines · James Prestwood

Beacons, probe responses and timing advertisements were only using 1 byte for the timestamps which should be 8 bytes.

---
  src/mpdu.h | 6 +++---
  1 file changed, 3 insertions(+), 3 deletions(-)

v2:
* Use __le64 rather than uint64_t

Both applied, thanks.

Regards,
-Denis