diff mbox series

[2/2] iw: scan: parse OWE Transition Mode element

Message ID 20181010204747.1555-2-hauke@hauke-m.de (mailing list archive)
State Accepted
Delegated to: Johannes Berg
Headers show
Series None | expand

Commit Message

Hauke Mehrtens Oct. 10, 2018, 8:47 p.m. UTC
This adds code to parse the Opportunistic Wireless Encryption Transition
Mode element.

Without this patch the output looks like this:
WFA 0x1c, data: 00 37 b7 36 dc 0c 08 4f 70 65 6e 57 72 74 34
With this patch it looks like this:
        OWE Transition Mode:
                BSSID: 00:37:b7:36:dc:0c
                SSID: OpenWrt4

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
---
 scan.c | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
diff mbox series

Patch

diff --git a/scan.c b/scan.c
index 7695216..a798c70 100644
--- a/scan.c
+++ b/scan.c
@@ -1950,10 +1950,39 @@  static inline void print_hs20_ind(const uint8_t type, uint8_t len,
 		printf("\t\tUnexpected length: %i\n", len);
 }
 
+static void print_wifi_owe_tarns(const uint8_t type, uint8_t len,
+				 const uint8_t *data,
+				 const struct print_ies_data *ie_buffer)
+{
+	char mac_addr[20];
+	int ssid_len;
+
+	printf("\n");
+	if (len < 7)
+		return;
+
+	mac_addr_n2a(mac_addr, data);
+	printf("\t\tBSSID: %s\n", mac_addr);
+
+	ssid_len = data[6];
+	if (ssid_len > len - 7)
+		return;
+	printf("\t\tSSID: ");
+	print_ssid_escaped(ssid_len, data + 7);
+	printf("\n");
+
+	/* optional elements */
+	if (len >= ssid_len + 9) {
+		printf("\t\tBand Info: %u\n", data[ssid_len + 7]);
+		printf("\t\tChannel Info: %u\n", data[ssid_len + 8]);
+	}
+}
+
 static const struct ie_print wfa_printers[] = {
 	[9] = { "P2P", print_p2p, 2, 255, BIT(PRINT_SCAN), },
 	[16] = { "HotSpot 2.0 Indication", print_hs20_ind, 1, 255, BIT(PRINT_SCAN), },
 	[18] = { "HotSpot 2.0 OSEN", print_wifi_osen, 1, 255, BIT(PRINT_SCAN), },
+	[28] = { "OWE Transition Mode", print_wifi_owe_tarns, 7, 255, BIT(PRINT_SCAN), },
 };
 
 static void print_vendor(unsigned char len, unsigned char *data,