From d4dfd8065d0b36b3ff91ff94d7e1ebea20a6bb66 Mon Sep 17 00:00:00 2001 From: Florian Schilhabel Date: Thu, 15 Jul 2010 19:04:00 +0200 Subject: [PATCH] staging: rtl8192su: merge changes in ieee80211_authentication_req() Signed-off-by: Florian Schilhabel Signed-off-by: Greg Kroah-Hartman --- .../staging/rtl8192su/ieee80211/ieee80211.h | 4 + .../rtl8192su/ieee80211/ieee80211_softmac.c | 73 ++++++++++++++----- 2 files changed, 59 insertions(+), 18 deletions(-) diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211.h b/drivers/staging/rtl8192su/ieee80211/ieee80211.h index 8a20323cbce6..2c860db396c9 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211.h +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211.h @@ -168,6 +168,10 @@ typedef struct ieee_param { /* QOS control */ #define IEEE80211_QCTL_TID 0x000F +#define OUI_SUBTYPE_WMM_INFO 0 +#define OUI_SUBTYPE_WMM_PARAM 1 +#define OUI_SUBTYPE_QOS_CAPABI 5 + /* debug macros */ #define CONFIG_IEEE80211_DEBUG #ifdef CONFIG_IEEE80211_DEBUG diff --git a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c index 7d4567d6808e..2e2f6a0c8f2d 100644 --- a/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192su/ieee80211/ieee80211_softmac.c @@ -684,7 +684,6 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be memcpy(auth->header.addr2, ieee->dev->dev_addr, ETH_ALEN); memcpy(auth->header.addr3, beacon->bssid, ETH_ALEN); - //auth->algorithm = ieee->open_wep ? WLAN_AUTH_OPEN : WLAN_AUTH_SHARED_KEY; if(ieee->auth_mode == 0) auth->algorithm = WLAN_AUTH_OPEN; else if(ieee->auth_mode == 1) @@ -701,6 +700,26 @@ inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *be } +void constructWMMIE(u8* wmmie, u8* wmm_len,u8 oui_subtype) +{ + u8 szQoSOUI[] ={221, 0, 0x00, 0x50, 0xf2, 0x02, 0, 1}; + + if (oui_subtype == OUI_SUBTYPE_QOS_CAPABI) + { + szQoSOUI[0] = 46; + szQoSOUI[1] = *wmm_len; + memcpy(wmmie,szQoSOUI,3); + *wmm_len = 3; + } + else + { + szQoSOUI[1] = *wmm_len + 6; + szQoSOUI[6] = oui_subtype; + memcpy(wmmie, szQoSOUI, 8); + *(wmmie+8) = 0; + *wmm_len = 9; + } +} static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *dest) { @@ -719,14 +738,18 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d int wpa_ie_len = ieee->wpa_ie_len; u8 erpinfo_content = 0; - u8* tmp_ht_cap_buf; + u8* tmp_ht_cap_buf=NULL; u8 tmp_ht_cap_len=0; - u8* tmp_ht_info_buf; + u8* tmp_ht_info_buf=NULL; u8 tmp_ht_info_len=0; PRT_HIGH_THROUGHPUT pHTInfo = ieee->pHTInfo; u8* tmp_generic_ie_buf=NULL; u8 tmp_generic_ie_len=0; + + u8 wmmie[9] = {0}; + u8 wmm_len = 0; + if(rate_ex_len > 0) rate_ex_len+=2; if(ieee->current_network.capability & WLAN_CAPABILITY_IBSS) @@ -734,7 +757,7 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d else atim_len = 0; -#if 1 +#if 0 if(ieee80211_is_54g(ieee->current_network)) erp_len = 3; else @@ -759,21 +782,35 @@ static struct sk_buff* ieee80211_probe_resp(struct ieee80211_device *ieee, u8 *d ((0 == strcmp(crypt->ops->name, "WEP") || wpa_ie_len)); //HT ralated element #if 1 - tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap); - tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); - tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo); - tmp_ht_info_len = sizeof(ieee->pHTInfo->SelfHTInfo); - HTConstructCapabilityElement(ieee, tmp_ht_cap_buf, &tmp_ht_cap_len,encrypt); - HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt); - - - if(pHTInfo->bRegRT2RTAggregation) - { - tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; - tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer); - HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len); - } + if(ieee->pHTInfo->bCurrentHTSupport){ + tmp_ht_cap_buf =(u8*) &(ieee->pHTInfo->SelfHTCap); + tmp_ht_cap_len = sizeof(ieee->pHTInfo->SelfHTCap); + tmp_ht_info_buf =(u8*) &(ieee->pHTInfo->SelfHTInfo); + tmp_ht_info_len = sizeof(ieee->pHTInfo->SelfHTInfo); + + HTConstructCapabilityElement(ieee, tmp_ht_cap_buf, &tmp_ht_cap_len,encrypt); + + HTConstructInfoElement(ieee,tmp_ht_info_buf,&tmp_ht_info_len, encrypt); + + + if(pHTInfo->bRegRT2RTAggregation) + { + tmp_generic_ie_buf = ieee->pHTInfo->szRT2RTAggBuffer; + tmp_generic_ie_len = sizeof(ieee->pHTInfo->szRT2RTAggBuffer); + HTConstructRT2RTAggElement(ieee, tmp_generic_ie_buf, &tmp_generic_ie_len); + } + } #endif + + if(ieee->qos_support){ + + if(ieee->iw_mode == IW_MODE_ADHOC) + { + wmm_len = 1; + constructWMMIE(wmmie,&wmm_len,OUI_SUBTYPE_WMM_INFO); + } + } + beacon_size = sizeof(struct ieee80211_probe_response)+2+ ssid_len +3 //channel -- 2.20.1