From: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> Signed-off-by: Jes Sorensen <Jes.Sorensen@xxxxxxxxxx> --- drivers/staging/rtl8723au/core/rtw_ieee80211.c | 15 +++++----- drivers/staging/rtl8723au/core/rtw_mlme_ext.c | 40 +++++++++++++++----------- drivers/staging/rtl8723au/include/ieee80211.h | 4 +-- 3 files changed, 34 insertions(+), 25 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_ieee80211.c b/drivers/staging/rtl8723au/core/rtw_ieee80211.c index f05d6e0..7ca2e11 100644 --- a/drivers/staging/rtl8723au/core/rtw_ieee80211.c +++ b/drivers/staging/rtl8723au/core/rtw_ieee80211.c @@ -752,11 +752,11 @@ u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, uint *wps_ielen) * * Returns: the address of the specific WPS attribute found, or NULL */ -u8 *rtw_get_wps_attr23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, - u8 *buf_attr, u32 *len_attr) +const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen, + u16 target_attr_id, u8 *buf_attr, u32 *len_attr) { - u8 *attr_ptr = NULL; - u8 * target_attr_ptr = NULL; + const u8 *attr_ptr = NULL; + const u8 *target_attr_ptr = NULL; u8 wps_oui[4] = {0x00, 0x50, 0xF2, 0x04}; if (len_attr) @@ -808,10 +808,11 @@ u8 *rtw_get_wps_attr23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, * * Returns: the address of the specific WPS attribute content found, or NULL */ -u8 *rtw_get_wps_attr_content23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id, - u8 *buf_content, uint *len_content) +const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, uint wps_ielen, + u16 target_attr_id, u8 *buf_content, + uint *len_content) { - u8 *attr_ptr; + const u8 *attr_ptr; u32 attr_len; if (len_content) diff --git a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c index 9b401fb..1c22d1b 100644 --- a/drivers/staging/rtl8723au/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8723au/core/rtw_mlme_ext.c @@ -2497,8 +2497,7 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms) struct mlme_ext_info *pmlmeinfo = &pmlmeext->mlmext_info; struct wlan_bssid_ex *cur_network = &pmlmeinfo->network; u8 bc_addr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - u8 *wps_ie; - u32 wps_ielen; + const u8 *wps_ie; u8 sr = 0; int len_diff; @@ -2535,6 +2534,8 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms) pattrib->pktlen = sizeof(struct ieee80211_hdr_3addr); if ((pmlmeinfo->state&0x03) == WIFI_FW_AP_STATE) { + u8 *iebuf; + int buflen; /* DBG_8723A("ie len =%d\n", cur_network->IELength); */ memcpy(pframe, cur_network->IEs, cur_network->IELength); len_diff = update_hidden_ssid(pframe + _BEACON_IE_OFFSET_, @@ -2544,13 +2545,17 @@ void issue_beacon23a(struct rtw_adapter *padapter, int timeout_ms) pframe += (cur_network->IELength+len_diff); pattrib->pktlen += (cur_network->IELength+len_diff); - wps_ie = rtw_get_wps_ie23a(pmgntframe->buf_addr + TXDESC_OFFSET+ - sizeof (struct ieee80211_hdr_3addr) + - _BEACON_IE_OFFSET_, pattrib->pktlen - - sizeof (struct ieee80211_hdr_3addr) - - _BEACON_IE_OFFSET_, &wps_ielen); - if (wps_ie && wps_ielen > 0) { - rtw_get_wps_attr_content23a(wps_ie, wps_ielen, + iebuf = pmgntframe->buf_addr + TXDESC_OFFSET + + sizeof (struct ieee80211_hdr_3addr) + + _BEACON_IE_OFFSET_; + buflen = pattrib->pktlen - sizeof (struct ieee80211_hdr_3addr) - + _BEACON_IE_OFFSET_; + wps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, + WLAN_OUI_TYPE_MICROSOFT_WPS, + iebuf, buflen); + + if (wps_ie && wps_ie[1] > 0) { + rtw_get_wps_attr_content23a(wps_ie, wps_ie[1], WPS_ATTR_SELECTED_REGISTRAR, (u8*)&sr, NULL); } @@ -2656,7 +2661,7 @@ static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da, unsigned char *mac, *bssid; struct xmit_priv *pxmitpriv = &padapter->xmitpriv; #ifdef CONFIG_8723AU_AP_MODE - u8 *pwps_ie; + const u8 *pwps_ie; uint wps_ielen; u8 *ssid_ie; int ssid_ielen; @@ -2710,16 +2715,19 @@ static void issue_probersp(struct rtw_adapter *padapter, unsigned char *da, #ifdef CONFIG_8723AU_AP_MODE if ((pmlmeinfo->state & 0x03) == WIFI_FW_AP_STATE) { - pwps_ie = rtw_get_wps_ie23a(cur_network->IEs + - _FIXED_IE_LENGTH_, - cur_network->IELength - - _FIXED_IE_LENGTH_, &wps_ielen); + pwps_ie = cfg80211_find_vendor_ie(WLAN_OUI_MICROSOFT, + WLAN_OUI_TYPE_MICROSOFT_WPS, + cur_network->IEs + + _FIXED_IE_LENGTH_, + cur_network->IELength - + _FIXED_IE_LENGTH_); /* inerset & update wps_probe_resp_ie */ - if (pmlmepriv->wps_probe_resp_ie && pwps_ie && wps_ielen > 0) { + if (pmlmepriv->wps_probe_resp_ie && pwps_ie && pwps_ie[1] > 0) { uint wps_offset, remainder_ielen; - u8 *premainder_ie; + const u8 *premainder_ie; + wps_ielen = pwps_ie[1]; wps_offset = (uint)(pwps_ie - cur_network->IEs); premainder_ie = pwps_ie + wps_ielen; diff --git a/drivers/staging/rtl8723au/include/ieee80211.h b/drivers/staging/rtl8723au/include/ieee80211.h index 6dedc10..426decb 100644 --- a/drivers/staging/rtl8723au/include/ieee80211.h +++ b/drivers/staging/rtl8723au/include/ieee80211.h @@ -433,8 +433,8 @@ int rtw_parse_wpa2_ie23a(const u8* wpa_ie, int wpa_ie_len, int *group_cipher, in int rtw_get_sec_ie23a(u8 *in_ie,uint in_len,u8 *rsn_ie,u16 *rsn_len,u8 *wpa_ie,u16 *wpa_len); u8 *rtw_get_wps_ie23a(u8 *in_ie, uint in_len, uint *wps_ielen); -u8 *rtw_get_wps_attr23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_attr, u32 *len_attr); -u8 *rtw_get_wps_attr_content23a(u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_content, uint *len_content); +const u8 *rtw_get_wps_attr23a(const u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_attr, u32 *len_attr); +const u8 *rtw_get_wps_attr_content23a(const u8 *wps_ie, uint wps_ielen, u16 target_attr_id ,u8 *buf_content, uint *len_content); uint rtw_get_rateset_len23a(u8 *rateset); -- 1.9.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel