Search Linux Wireless

Re: [PATCH] add support for parsing WPA and RSN/WPA2 information elements

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, 2009-05-03 at 21:46 -0700, Marcel Holtmann wrote:
>  
> +static unsigned char vendor_oui[3] = { 0x00, 0x50, 0xf2 };
> +static unsigned char cipher_oui[3] = { 0x00, 0x0f, 0xac };

??
00-50-f2 is "WiFi OUI" (registered to Microsoft), 00-0f-ac is "802.11
OUI", registered to 802.11.

> +static void print_cipher(const unsigned char *oui, unsigned char *data)
> +{

Why are you passing in the OUI?

> +	if (memcmp(data, oui, 3) == 0) {
> +		switch (data[3]) {
> +		case 0x00:
> +			printf("Use group cipher suite");
> +			break;
> +		case 0x01:
> +			printf("WEP-40");
> +			break;
> +		case 0x02:
> +			printf("TKIP");
> +			break;
> +		case 0x04:
> +			printf("CCMP");
> +			break;
> +		case 0x05:
> +			printf("WEP-104");
> +			break;
> +		default:
> +			printf("Reserved (%.02x)", data[3]);
> +			break;
> +		}
> +	} else if (memcmp(data, vendor_oui, 3) == 0)
> +		printf("Vendor specific (%.02x)", data[3]);
> +	else
> +		printf("Other");

That's wrong, if it matches the "vendor_oui" which you should rename to
"oui_wifi" or something then it's not "Vendor specific", then it's from
WiFi, if it doesn't match then you could print out the OUI of the vendor
it belongs to.

> +static void print_auth(const unsigned char *oui, unsigned char *data)

same here

> +static void print_wpa(const char *ie, const unsigned char *oui,
> +		      unsigned char len, unsigned char *data)

again, no need to pass in the OUI.

> +	bool first = true;
> +	__u16 version, count, capa;
> +	int i;
> +
> +	printf("\t%s:", ie);
> +
> +	if (len < 2) {
> +		printf(" <too short> data:");
> +		for(i = 0; i < len; i++)
> +			printf(" %.02x", data[i]);
> +		printf("\n");
> +		return;
> +	}
> +
> +	version = data[0] + (data[1] << 8);
> +	tab_on_first(&first);
> +	printf("\t * Version: %d\n", version);
> +
> +	data += 2;
> +	len -= 2;
> +
> +	if (len < 4) {
> +		tab_on_first(&first);
> +		printf("\t * Group cipher: TKIP\n");
> +		printf("\t * Pairwise ciphers: TKIP\n");
> +		return;
> +	}

Huh? I don't quite understand this? Is that some backward compat code?
Or is this some WPA1 thing I don't know about?

> +static void print_rsn(unsigned char type, unsigned char len, unsigned char *data)
> +{
> +	print_wpa("WPA2", cipher_oui, len, data);
> +}

That's "oui_80211" I guess, not "cipher_oui". Ok I see now why you want
to pass in the OUI... However, it would be better to just duplicate the
code, I think for example 11w won't be announced in WPA1 IEs so we
shouldn't parse it there when we add support for parsing it to RSN IEs.

johannes

Attachment: signature.asc
Description: This is a digitally signed message part


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux