staging: rtl8723au: rtw_mlme_ext.c: Convert rtw_get_wps_ie23a() to cfg80211_find_vend...
authorJes Sorensen <Jes.Sorensen@redhat.com>
Mon, 9 Jun 2014 13:15:54 +0000 (15:15 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 17 Jun 2014 22:30:33 +0000 (15:30 -0700)
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723au/core/rtw_ieee80211.c
drivers/staging/rtl8723au/core/rtw_mlme_ext.c
drivers/staging/rtl8723au/include/ieee80211.h

index 52eb5ff..a1a27e2 100644 (file)
@@ -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)
index c1e8299..20e9b62 100644 (file)
@@ -2460,8 +2460,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;
 
@@ -2498,6 +2497,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_,
@@ -2507,13 +2508,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);
                }
@@ -2619,7 +2624,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;
@@ -2673,16 +2678,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;
index 68ee71b..e023e05 100644 (file)
@@ -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);