From: Zhu Yi <yi.zhu@intel.com>
To: netdev@vger.kernel.org
Subject: [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs
Date: Thu, 14 Dec 2006 12:02:16 +0800 [thread overview]
Message-ID: <20061214040216.GA10652@mail.intel.com> (raw)
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
next reply other threads:[~2006-12-14 4:14 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-14 4:02 Zhu Yi [this message]
2006-12-14 10:31 ` [PATCH 2/6] d80211: create "wifi.h" to define WIFI OUIs Jiri Benc
2006-12-15 3:22 ` Zhu Yi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20061214040216.GA10652@mail.intel.com \
--to=yi.zhu@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.