ath6kl: add support for WPS
authorAarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Tue, 25 Oct 2011 18:25:52 +0000 (11:25 -0700)
committerKalle Valo <kvalo@qca.qualcomm.com>
Fri, 11 Nov 2011 10:58:54 +0000 (12:58 +0200)
Add control flag CONNECT_WPS_FLAG if a WPS IE is present in the
Association Request IEs. This flag is needed when the station must
connect to a WPS-enabled AP.

Signed-off-by: Aarthi Thiruvengadam <athiruve@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/wmi.h

index 3380dd9ce7d67084f03a4ff71bd8ba0a76f2cecf..a563fdf891da169e110c39514b14621ffd99d799 100644 (file)
@@ -259,6 +259,14 @@ static bool ath6kl_is_rsn_ie(const u8 *pos)
        return pos[0] == WLAN_EID_RSN;
 }
 
+static bool ath6kl_is_wps_ie(const u8 *pos)
+{
+       return (pos[0] == WLAN_EID_VENDOR_SPECIFIC &&
+               pos[1] >= 4 &&
+               pos[2] == 0x00 && pos[3] == 0x50 && pos[4] == 0xf2 &&
+               pos[5] == 0x04);
+}
+
 static int ath6kl_set_assoc_req_ies(struct ath6kl_vif *vif, const u8 *ies,
                                    size_t ies_len)
 {
@@ -268,6 +276,12 @@ static int ath6kl_set_assoc_req_ies(struct ath6kl_vif *vif, const u8 *ies,
        size_t len = 0;
        int ret;
 
+       /*
+        * Clear previously set flag
+        */
+
+       ar->connect_ctrl_flags &= ~CONNECT_WPS_FLAG;
+
        /*
         * Filter out RSN/WPA IE(s)
         */
@@ -285,6 +299,10 @@ static int ath6kl_set_assoc_req_ies(struct ath6kl_vif *vif, const u8 *ies,
                                memcpy(buf + len, pos, 2 + pos[1]);
                                len += 2 + pos[1];
                        }
+
+                       if (ath6kl_is_wps_ie(pos))
+                               ar->connect_ctrl_flags |= CONNECT_WPS_FLAG;
+
                        pos += 2 + pos[1];
                }
        }
index 495d2e52ed852c1a6acb4dd020359df27e1b15ac..9055c75c8e939204ad0a034ecd5546bd605da289 100644 (file)
@@ -626,6 +626,7 @@ enum wmi_connect_ctrl_flags_bits {
        CONNECT_CSA_FOLLOW_BSS = 0x0020,
        CONNECT_DO_WPA_OFFLOAD = 0x0040,
        CONNECT_DO_NOT_DEAUTH = 0x0080,
+       CONNECT_WPS_FLAG = 0x0100,
 };
 
 struct wmi_connect_cmd {