d80211: create "wifi.h" to define WIFI OUIs
Subsystems (2)
PATCH 2/6 d80211: create "wifi.h" to define WIFI OUIs
Replace hard coded WIFI OUIs and parse TSPEC information element.
Signed-off-by Zhu Yi <[email protected]>
---
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
net/d80211/ieee80211_sta.c +32 -4
@@ -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(uif (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 "
net/d80211/wifi.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* This file defines Wi-Fi(r) OUIs for 80211.o +* Copyright 2006, Zhu Yi <[email protected]> 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 */
Signature · 1 line
1.2.6
Quoted 21 lines · Zhu Yi
net/d80211/wifi.h new file +18
-0@@ -0,0 +1,28 @@ +/* +* This file defines Wi-Fi(r) OUIs for 80211.o +* Copyright 2006, Zhu Yi <[email protected]> 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,
net/d80211/wifi.h line 28
Quoted 10 lines
net/d80211/wifi.h new file +10
-0+}; + +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
Signature · 2 lines
Jiri Benc SUSE Labs
Quoted 3 lines · Jiri Benc
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