Subject: fix WPS connection using CFG80211
         1. Set max ie length for nl80211
         2. Set CONNECT_WPS_FLAG to firmware to inform this is a WPS connection

Signed-off-by: Samuel Chang <[email protected]>

diff -ruN kernel-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/cfg80211.c 
kernel-2.6.37.6-11.5_WPS_connection/drivers/staging/ar6003/os/linux/cfg80211.c
--- kernel-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/cfg80211.c     
2011-05-27 06:17:00.000000000 +0800
+++ 
kernel-2.6.37.6-11.5_WPS_connection/drivers/staging/ar6003/os/linux/cfg80211.c  
    2011-06-07 04:05:29.540534682 +0800
@@ -245,6 +245,8 @@
     AR_SOFTC_T     *ar     = arPriv->arSoftc;
     AR_SOFTC_STA_T *arSta  = &arPriv->arSta;
     A_STATUS status;
+    const unsigned char wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 };
+    unsigned char *ie = sme->ie;
 
     AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
 
@@ -391,6 +393,16 @@
 
     arPriv->arNetworkType = arPriv->arNextMode;
 
+    if (ie[0] == WLAN_EID_VENDOR_SPECIFIC &&
+        memcmp(ie + 2, wps_oui, sizeof(wps_oui)) == 0) {
+       /* WPS IE detected, notify target */
+       A_PRINTF("WPS IE detected -- setting WPS flag\n");
+       arPriv->arSta.arConnectCtrlFlags |= CONNECT_WPS_FLAG;
+       arPriv->arAuthMode = NONE_AUTH;
+    } else {
+       arPriv->arSta.arConnectCtrlFlags &= ~CONNECT_WPS_FLAG;
+    }
+
     AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: Connect called with authmode %d 
dot11 auth %d"\
                     " PW crypto %d PW crypto Len %d GRP crypto %d"\
                     " GRP crypto Len %d channel hint %u\n",
@@ -1508,6 +1520,7 @@
                                    BIT(NL80211_IFTYPE_ADHOC);
     /* max num of ssids that can be probed during scanning */
     wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
+    wdev->wiphy->max_scan_ie_len = IEEE80211_APPIE_FRAME_MAX_LEN;
     wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar6k_band_2ghz;
     wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &ar6k_band_5ghz;
     wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
Subject: fix WPS connection using CFG80211
         1. Set max ie length for nl80211
         2. Set CONNECT_WPS_FLAG to firmware to inform this is a WPS connection

Signed-off-by: Samuel Chang <[email protected]>

diff -ruN kernel-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/cfg80211.c kernel-2.6.37.6-11.5_WPS_connection/drivers/staging/ar6003/os/linux/cfg80211.c
--- kernel-2.6.37.6-11.5/drivers/staging/ar6003/os/linux/cfg80211.c	2011-05-27 06:17:00.000000000 +0800
+++ kernel-2.6.37.6-11.5_WPS_connection/drivers/staging/ar6003/os/linux/cfg80211.c	2011-06-07 04:05:29.540534682 +0800
@@ -245,6 +245,8 @@
     AR_SOFTC_T     *ar     = arPriv->arSoftc;
     AR_SOFTC_STA_T *arSta  = &arPriv->arSta;
     A_STATUS status;
+    const unsigned char wps_oui[] = { 0x00, 0x50, 0xf2, 0x04 };
+    unsigned char *ie = sme->ie;
 
     AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: \n", __func__));
 
@@ -391,6 +393,16 @@
 
     arPriv->arNetworkType = arPriv->arNextMode;
 
+    if (ie[0] == WLAN_EID_VENDOR_SPECIFIC &&
+        memcmp(ie + 2, wps_oui, sizeof(wps_oui)) == 0) {
+	/* WPS IE detected, notify target */
+	A_PRINTF("WPS IE detected -- setting WPS flag\n");
+	arPriv->arSta.arConnectCtrlFlags |= CONNECT_WPS_FLAG;
+	arPriv->arAuthMode = NONE_AUTH;
+    } else {
+	arPriv->arSta.arConnectCtrlFlags &= ~CONNECT_WPS_FLAG;
+    }
+
     AR_DEBUG_PRINTF(ATH_DEBUG_INFO, ("%s: Connect called with authmode %d dot11 auth %d"\
                     " PW crypto %d PW crypto Len %d GRP crypto %d"\
                     " GRP crypto Len %d channel hint %u\n",
@@ -1508,6 +1520,7 @@
                                    BIT(NL80211_IFTYPE_ADHOC);
     /* max num of ssids that can be probed during scanning */
     wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
+    wdev->wiphy->max_scan_ie_len = IEEE80211_APPIE_FRAME_MAX_LEN;
     wdev->wiphy->bands[IEEE80211_BAND_2GHZ] = &ar6k_band_2ghz;
     wdev->wiphy->bands[IEEE80211_BAND_5GHZ] = &ar6k_band_5ghz;
     wdev->wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
_______________________________________________
MeeGo-kernel mailing list
[email protected]
http://lists.meego.com/listinfo/meego-kernel

Reply via email to