* [PATCH] iw: Print OSEN element for HotSpot 2.0 IE.
@ 2015-03-17 22:02 greearb
2015-03-30 9:08 ` Johannes Berg
0 siblings, 1 reply; 2+ messages in thread
From: greearb @ 2015-03-17 22:02 UTC (permalink / raw)
To: linux-wireless; +Cc: johannes, Ben Greear
From: Ben Greear <greearb@candelatech.com>
Re-uses most of the print-rsn logic since only the header
differs.
Example output:
...
HotSpot 2.0 OSEN:
* Group cipher: NO-GROUP
* Pairwise ciphers: CCMP
* Authentication suites: OSEN
* Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
Signed-off-by: Ben Greear <greearb@candelatech.com>
---
scan.c | 51 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/scan.c b/scan.c
index 538b30e..f01921a 100644
--- a/scan.c
+++ b/scan.c
@@ -410,6 +410,9 @@ static void print_cipher(const uint8_t *data)
case 6:
printf("AES-128-CMAC");
break;
+ case 7:
+ printf("NO-GROUP");
+ break;
case 8:
printf("GCMP");
break;
@@ -466,24 +469,37 @@ static void print_auth(const uint8_t *data)
data[0], data[1] ,data[2], data[3]);
break;
}
+ } else if (memcmp(data, wfa_oui, 3) == 0) {
+ switch (data[3]) {
+ case 1:
+ printf("OSEN");
+ break;
+ default:
+ printf("%.02x-%.02x-%.02x:%d",
+ data[0], data[1] ,data[2], data[3]);
+ break;
+ }
} else
printf("%.02x-%.02x-%.02x:%d",
data[0], data[1] ,data[2], data[3]);
}
-static void print_rsn_ie(const char *defcipher, const char *defauth,
- uint8_t len, const uint8_t *data)
+static void _print_rsn_ie(const char *defcipher, const char *defauth,
+ uint8_t len, const uint8_t *data, int is_osen)
{
bool first = true;
- __u16 version, count, capa;
+ __u16 count, capa;
int i;
- version = data[0] + (data[1] << 8);
- tab_on_first(&first);
- printf("\t * Version: %d\n", version);
+ if (!is_osen) {
+ __u16 version;
+ version = data[0] + (data[1] << 8);
+ tab_on_first(&first);
+ printf("\t * Version: %d\n", version);
- data += 2;
- len -= 2;
+ data += 2;
+ len -= 2;
+ }
if (len < 4) {
tab_on_first(&first);
@@ -627,6 +643,19 @@ static void print_rsn_ie(const char *defcipher, const char *defauth,
}
}
+static void print_rsn_ie(const char *defcipher, const char *defauth,
+ uint8_t len, const uint8_t *data)
+{
+ _print_rsn_ie(defcipher, defauth, len, data, 0);
+}
+
+static void print_osen_ie(const char *defcipher, const char *defauth,
+ uint8_t len, const uint8_t *data)
+{
+ printf("\n\t");
+ _print_rsn_ie(defcipher, defauth, len, data, 1);
+}
+
static void print_rsn(const uint8_t type, uint8_t len, const uint8_t *data)
{
print_rsn_ie("CCMP", "IEEE 802.1X", len, data);
@@ -1076,6 +1105,11 @@ static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)
print_rsn_ie("TKIP", "IEEE 802.1X", len, data);
}
+static void print_wifi_osen(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+ print_osen_ie("OSEN", "OSEN", len, data);
+}
+
static bool print_wifi_wmm_param(const uint8_t *data, uint8_t len)
{
int i;
@@ -1429,6 +1463,7 @@ static inline void print_hs20_ind(const uint8_t type, uint8_t len, const uint8_t
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), },
};
static void print_vendor(unsigned char len, unsigned char *data,
--
1.7.11.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iw: Print OSEN element for HotSpot 2.0 IE.
2015-03-17 22:02 [PATCH] iw: Print OSEN element for HotSpot 2.0 IE greearb
@ 2015-03-30 9:08 ` Johannes Berg
0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2015-03-30 9:08 UTC (permalink / raw)
To: greearb; +Cc: linux-wireless
On Tue, 2015-03-17 at 15:02 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
>
> Re-uses most of the print-rsn logic since only the header
> differs.
>
> Example output:
> ...
> HotSpot 2.0 OSEN:
> * Group cipher: NO-GROUP
> * Pairwise ciphers: CCMP
> * Authentication suites: OSEN
> * Capabilities: 16-PTKSA-RC 1-GTKSA-RC (0x000c)
Applied.
johannes
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-03-30 9:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-17 22:02 [PATCH] iw: Print OSEN element for HotSpot 2.0 IE greearb
2015-03-30 9:08 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).