linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iw:  Print Interworking IE details in scan results.
@ 2013-08-27 16:07 greearb
  2013-08-28  8:23 ` Johannes Berg
  0 siblings, 1 reply; 3+ messages in thread
From: greearb @ 2013-08-27 16:07 UTC (permalink / raw)
  To: linux-wireless; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

Output looks like:

	802.11u Interworking:
		Network Options: 0xf1
			Network Type: 1 (Private with Guest)
			Internet
			ASRA
			ESR
			UESA
		Venu Group: 2 (Business)
		Venu Type: 1
		HESSID: 00:00:00:00:00:01

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 af21cbc... 1894769... M	scan.c
 scan.c |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/scan.c b/scan.c
index af21cbc..1894769 100644
--- a/scan.c
+++ b/scan.c
@@ -614,6 +614,69 @@ static void print_ht_capa(const uint8_t type, uint8_t len, const uint8_t *data)
 	print_ht_mcs(data + 3);
 }
 
+static const char* ntype_11u(uint8_t t) {
+	switch (t) {
+	case 0: return "Private";
+	case 1: return "Private with Guest";
+	case 2: return "Chargeable Public";
+	case 3: return "Free Public";
+	case 4: return "Personal Device";
+	case 5: return "Emergency Services Only";
+	case 14: return "Test or Experimental";
+	case 15: return "Wildcard";
+	default: return "Reserved";
+	}
+}
+
+static const char* vgroup_11u(uint8_t t) {
+	switch (t) {
+	case 0: return "Unspecified";
+	case 1: return "Assembly";
+	case 2: return "Business";
+	case 3: return "Educational";
+	case 4: return "Factory and Industrial";
+	case 5: return "Institutional";
+	case 6: return "Mercantile";
+	case 7: return "Residential";
+	case 8: return "Storage";
+	case 9: return "Utility and Miscellaneous";
+	case 10: return "Vehicular";
+	case 11: return "Outdoor";
+	default: return "Reserved";
+	}
+}
+
+static void print_interworking(const uint8_t type, uint8_t len, const uint8_t *data)
+{
+	/* See Section 7.3.2.92 in the 802.11u spec. */
+	printf("\n");
+	if (len >= 1) {
+		uint8_t ano = data[0];
+		printf("\t\tNetwork Options: 0x%hx\n", (unsigned short)(ano));
+		printf("\t\t\tNetwork Type: %i (%s)\n",
+		       (int)(ano & 0xf), ntype_11u(ano & 0xf));
+		if (ano & (1<<4))
+			printf("\t\t\tInternet\n");
+		if (ano & (1<<5))
+			printf("\t\t\tASRA\n");
+		if (ano & (1<<6))
+			printf("\t\t\tESR\n");
+		if (ano & (1<<7))
+			printf("\t\t\tUESA\n");
+	}
+	if ((len == 3) || (len == 9)) {
+		printf("\t\tVenue Group: %i (%s)\n",
+		       (int)(data[1]), vgroup_11u(data[1]));
+		printf("\t\tVenue Type: %i\n", (int)(data[2]));
+	}
+	if (len == 9)
+		printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+		       data[3], data[4], data[5], data[6], data[7], data[8]);
+	else if (len == 7)
+		printf("\t\tHESSID: %02hx:%02hx:%02hx:%02hx:%02hx:%02hx\n",
+		       data[1], data[2], data[3], data[4], data[5], data[6]);
+}
+
 static const char *ht_secondary_offset[4] = {
 	"no secondary",
 	"above",
@@ -891,6 +954,7 @@ static const struct ie_print ieprinters[] = {
 	[113] = { "MESH Configuration", print_mesh_conf, 7, 7, BIT(PRINT_SCAN), },
 	[114] = { "MESH ID", print_ssid, 0, 32, BIT(PRINT_SCAN) | BIT(PRINT_LINK), },
 	[127] = { "Extended capabilities", print_capabilities, 0, 255, BIT(PRINT_SCAN), },
+	[107] = { "802.11u Interworking", print_interworking, 0, 255, BIT(PRINT_SCAN), },
 };
 
 static void print_wifi_wpa(const uint8_t type, uint8_t len, const uint8_t *data)
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] iw:  Print Interworking IE details in scan results.
  2013-08-27 16:07 [PATCH] iw: Print Interworking IE details in scan results greearb
@ 2013-08-28  8:23 ` Johannes Berg
  2013-08-28 14:30   ` Ben Greear
  0 siblings, 1 reply; 3+ messages in thread
From: Johannes Berg @ 2013-08-28  8:23 UTC (permalink / raw)
  To: greearb; +Cc: linux-wireless

On Tue, 2013-08-27 at 09:07 -0700, greearb@candelatech.com wrote:

> 	802.11u Interworking:
> 		Network Options: 0xf1
> 			Network Type: 1 (Private with Guest)
> 			Internet
> 			ASRA
> 			ESR
> 			UESA
> 		Venu Group: 2 (Business)
> 		Venu Type: 1

That should be "Venue", no?


> Signed-off-by: Ben Greear <greearb@candelatech.com>

No need really, btw, this doesn't mean anything in the iw repository - I
haven't bothered to add something (yet).

> +++ b/scan.c
> @@ -614,6 +614,69 @@ static void print_ht_capa(const uint8_t type, uint8_t len, const uint8_t *data)
>  	print_ht_mcs(data + 3);
>  }
>  
> +static const char* ntype_11u(uint8_t t) {

I'd prefer kernel style with the opening brace on the next line :)

johannes


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] iw:  Print Interworking IE details in scan results.
  2013-08-28  8:23 ` Johannes Berg
@ 2013-08-28 14:30   ` Ben Greear
  0 siblings, 0 replies; 3+ messages in thread
From: Ben Greear @ 2013-08-28 14:30 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

On 08/28/2013 01:23 AM, Johannes Berg wrote:
> On Tue, 2013-08-27 at 09:07 -0700, greearb@candelatech.com wrote:
>
>> 	802.11u Interworking:
>> 		Network Options: 0xf1
>> 			Network Type: 1 (Private with Guest)
>> 			Internet
>> 			ASRA
>> 			ESR
>> 			UESA
>> 		Venu Group: 2 (Business)
>> 		Venu Type: 1
>
> That should be "Venue", no?

Yes, I kept typo-ing that..I think I fixed up the code in the patch, but
will double-check.

>
>
>> Signed-off-by: Ben Greear <greearb@candelatech.com>
>
> No need really, btw, this doesn't mean anything in the iw repository - I
> haven't bothered to add something (yet).
>
>> +++ b/scan.c
>> @@ -614,6 +614,69 @@ static void print_ht_capa(const uint8_t type, uint8_t len, const uint8_t *data)
>>   	print_ht_mcs(data + 3);
>>   }
>>
>> +static const char* ntype_11u(uint8_t t) {
>
> I'd prefer kernel style with the opening brace on the next line :)

I'll fix that and re-submit the series.

Thanks,
Ben

>
> johannes
>


-- 
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc  http://www.candelatech.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-08-28 14:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-27 16:07 [PATCH] iw: Print Interworking IE details in scan results greearb
2013-08-28  8:23 ` Johannes Berg
2013-08-28 14:30   ` Ben Greear

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).