* [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs
@ 2006-12-14 4:02 Zhu Yi
2006-12-14 10:31 ` Jiri Benc
0 siblings, 1 reply; 3+ messages in thread
From: Zhu Yi @ 2006-12-14 4:02 UTC (permalink / raw)
To: netdev
Replace hard coded WIFI OUIs and parse TSPEC information element.
Signed-off-by: Zhu Yi <yi.zhu@intel.com>
---
net/d80211/ieee80211_sta.c | 36 ++++++++++++++++++++++++++++++++----
net/d80211/wifi.h | 28 ++++++++++++++++++++++++++++
2 files changed, 60 insertions(+), 4 deletions(-)
create mode 100644 net/d80211/wifi.h
d30f04a9e760702363bdad8aef47477762f6d06f
diff --git a/net/d80211/ieee80211_sta.c b/net/d80211/ieee80211_sta.c
index 4985afe..cf11e88 100644
--- a/net/d80211/ieee80211_sta.c
+++ b/net/d80211/ieee80211_sta.c
@@ -27,6 +27,7 @@
#include <net/d80211.h>
#include <net/d80211_mgmt.h>
+#include "wifi.h"
#include "ieee80211_i.h"
#include "ieee80211_rate.h"
#include "hostapd_ioctl.h"
@@ -97,6 +98,8 @@ struct ieee802_11_elems {
u8 wmm_info_len;
u8 *wmm_param;
u8 wmm_param_len;
+ u8 *tspec;
+ u8 tspec_len;
};
typedef enum { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 } ParseRes;
@@ -165,17 +168,34 @@ static ParseRes ieee802_11_parse_elems(u
if (elen >= 4 && pos[0] == 0x00 && pos[1] == 0x50 &&
pos[2] == 0xf2) {
/* Microsoft OUI (00:50:F2) */
- if (pos[3] == 1) {
+ if (pos[3] == WIFI_OUI_TYPE_WPA) {
/* OUI Type 1 - WPA IE */
elems->wpa = pos;
elems->wpa_len = elen;
- } else if (elen >= 5 && pos[3] == 2) {
- if (pos[4] == 0) {
+ } else if (elen >= 5 &&
+ pos[3] == WIFI_OUI_TYPE_WMM) {
+ switch (pos[4]) {
+ case WIFI_OUI_STYPE_WMM_INFO:
elems->wmm_info = pos;
elems->wmm_info_len = elen;
- } else if (pos[4] == 1) {
+ break;
+ case WIFI_OUI_STYPE_WMM_PARAM:
elems->wmm_param = pos;
elems->wmm_param_len = elen;
+ break;
+ case WIFI_OUI_STYPE_WMM_TSPEC:
+ if (elen != 61) {
+ printk(KERN_ERR "Wrong "
+ "TSPEC size.\n");
+ break;
+ }
+ elems->tspec = pos + 6;
+ elems->tspec_len = elen - 6;
+ break;
+ default:
+ //printk(KERN_ERR "Unsupported "
+ // "WiFi OUI %d\n", pos[4]);
+ break;
}
}
}
@@ -192,6 +212,14 @@ static ParseRes ieee802_11_parse_elems(u
elems->ext_supp_rates = pos;
elems->ext_supp_rates_len = elen;
break;
+ case WLAN_EID_TSPEC:
+ if (elen != 55) {
+ printk(KERN_ERR "Wrong TSPEC size.\n");
+ break;
+ }
+ elems->tspec = pos;
+ elems->tspec_len = elen;
+ break;
default:
#if 0
printk(KERN_DEBUG "IEEE 802.11 element parse ignored "
diff --git a/net/d80211/wifi.h b/net/d80211/wifi.h
new file mode 100644
index 0000000..8ed1b63
--- /dev/null
+++ b/net/d80211/wifi.h
@@ -0,0 +1,28 @@
+/*
+ * This file defines Wi-Fi(r) OUIs for 80211.o
+ * Copyright 2006, Zhu Yi <yi.zhu@intel.com> Intel Corp.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef D802_11_WIFI_H
+#define D802_11_WIFI_H
+
+/* WI-FI Alliance OUI Type and Subtype */
+enum wifi_oui_type {
+ WIFI_OUI_TYPE_WPA = 1,
+ WIFI_OUI_TYPE_WMM = 2,
+ WIFI_OUI_TYPE_WSC = 4,
+ WIFI_OUI_TYPE_PSD = 6,
+};
+
+enum wifi_oui_stype_wmm {
+ WIFI_OUI_STYPE_WMM_INFO = 0,
+ WIFI_OUI_STYPE_WMM_PARAM = 1,
+ WIFI_OUI_STYPE_WMM_TSPEC = 2,
+};
+
+
+#endif /* D802_11_WIFI_H */
--
1.2.6
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs
2006-12-14 4:02 [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs Zhu Yi
@ 2006-12-14 10:31 ` Jiri Benc
2006-12-15 3:22 ` Zhu Yi
0 siblings, 1 reply; 3+ messages in thread
From: Jiri Benc @ 2006-12-14 10:31 UTC (permalink / raw)
To: yi.zhu; +Cc: netdev, John W. Linville
On Thu, 14 Dec 2006 12:02:16 +0800, Zhu Yi wrote:
> --- /dev/null
> +++ b/net/d80211/wifi.h
> @@ -0,0 +1,28 @@
> +/*
> + * This file defines Wi-Fi(r) OUIs for 80211.o
> + * Copyright 2006, Zhu Yi <yi.zhu@intel.com> Intel Corp.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 as
> + * published by the Free Software Foundation.
> + */
> +
> +#ifndef D802_11_WIFI_H
> +#define D802_11_WIFI_H
> +
> +/* WI-FI Alliance OUI Type and Subtype */
> +enum wifi_oui_type {
> + WIFI_OUI_TYPE_WPA = 1,
> + WIFI_OUI_TYPE_WMM = 2,
> + WIFI_OUI_TYPE_WSC = 4,
> + WIFI_OUI_TYPE_PSD = 6,
> +};
> +
> +enum wifi_oui_stype_wmm {
> + WIFI_OUI_STYPE_WMM_INFO = 0,
> + WIFI_OUI_STYPE_WMM_PARAM = 1,
> + WIFI_OUI_STYPE_WMM_TSPEC = 2,
> +};
> +
> +
> +#endif /* D802_11_WIFI_H */
AFAIK "wifi" is a trademark and we want to avoid using it. "wlan" seems
to be a better alternative for the prefixes. Also, I don't see a reason
for a separate header file here.
Thanks,
Jiri
--
Jiri Benc
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs
2006-12-14 10:31 ` Jiri Benc
@ 2006-12-15 3:22 ` Zhu Yi
0 siblings, 0 replies; 3+ messages in thread
From: Zhu Yi @ 2006-12-15 3:22 UTC (permalink / raw)
To: Jiri Benc; +Cc: netdev, John W. Linville
On Thu, 2006-12-14 at 11:31 +0100, Jiri Benc wrote:
> AFAIK "wifi" is a trademark and we want to avoid using it. "wlan" seems
> to be a better alternative for the prefixes. Also, I don't see a reason
> for a separate header file here.
WI-FI(r) is a trademark, but wifi and WIFI_XXX are not. I'm OK with
putting these to existed headers.
Thanks,
-yi
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-12-15 3:25 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-12-14 4:02 [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs Zhu Yi
2006-12-14 10:31 ` Jiri Benc
2006-12-15 3:22 ` Zhu Yi
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).