]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
atheros: Fix auth_alg configuration for static WEP
authorKen Zhu <Ken.Zhu@Atheros.com>
Fri, 20 May 2011 15:27:53 +0000 (18:27 +0300)
committerJouni Malinen <j@w1.fi>
Fri, 20 May 2011 15:27:53 +0000 (18:27 +0300)
When IEEE 802.1X is not enabled, driver_atheros.c needs to know how
to set authentication algorithms for static WEP.

src/ap/ap_drv_ops.h
src/ap/hostapd.c
src/drivers/driver.h
src/drivers/driver_atheros.c

index 36bb826db13e65cdcac87a6807a8ff174071808b..f6076afb7eb8f9a3f872bcd0e0dcf47c335ab936 100644 (file)
@@ -194,4 +194,12 @@ static inline int hostapd_drv_set_radius_acl_expire(struct hostapd_data *hapd,
        return hapd->driver->set_radius_acl_expire(hapd->drv_priv, mac);
 }
 
+static inline int hostapd_drv_set_authmode(struct hostapd_data *hapd,
+                                          int auth_algs)
+{
+       if (hapd->driver == NULL || hapd->driver->set_authmode == NULL)
+               return 0;
+       return hapd->driver->set_authmode(hapd->drv_priv, auth_algs);
+}
+
 #endif /* AP_DRV_OPS */
index 32db66872227fc5aba37a9da755ec469d9e508a2..d8af5713edd3af0d38444a8fcd1e1f390eedffd9 100644 (file)
@@ -306,6 +306,12 @@ static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
                return 0;
        }
 
+       /*
+        * When IEEE 802.1X is not enabled, the driver may need to know how to
+        * set authentication algorithms for static WEP.
+        */
+       hostapd_drv_set_authmode(hapd, hapd->conf->auth_algs);
+
        for (i = 0; i < 4; i++) {
                if (hapd->conf->ssid.wep.key[i] &&
                    hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
index 8efd697ad778a66eb888505c2fabb4da76e3b42c..513580a197109216a3dadb045742524645436e90 100644 (file)
@@ -2241,6 +2241,18 @@ struct wpa_driver_ops {
         * @signal_info: Connection info structure
          */
        int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
+
+       /**
+        * set_authmode - Set authentication algorithm(s) for static WEP
+        * @priv: Private driver interface data
+        * @authmode: 1=Open System, 2=Shared Key, 3=both
+        * Returns: 0 on success, -1 on failure
+        *
+        * This function can be used to set authentication algorithms for AP
+        * mode when static WEP is used. If the driver uses user space MLME/SME
+        * implementation, there is no need to implement this function.
+        */
+       int (*set_authmode)(void *priv, int authmode);
 };
 
 
index 6ac1cea6862247c1ca0124b4f8a1155f9302817d..96ef8bb6359646f5850a4b56ea769f7e30a62620 100644 (file)
@@ -1357,6 +1357,23 @@ atheros_commit(void *priv)
        return linux_set_iface_flags(drv->ioctl_sock, drv->iface, 1);
 }
 
+static int atheros_set_authmode(void *priv, int auth_algs)
+{
+       int authmode;
+
+       if ((auth_algs & WPA_AUTH_ALG_OPEN) &&
+           (auth_algs & WPA_AUTH_ALG_SHARED))
+               authmode = IEEE80211_AUTH_AUTO;
+       else if (auth_algs & WPA_AUTH_ALG_OPEN)
+               authmode = IEEE80211_AUTH_OPEN;
+       else if (auth_algs & WPA_AUTH_ALG_SHARED)
+               authmode = IEEE80211_AUTH_SHARED;
+       else
+               return -1;
+
+       return set80211param(priv, IEEE80211_PARAM_AUTHMODE, authmode);
+}
+
 const struct wpa_driver_ops wpa_driver_atheros_ops = {
        .name                   = "atheros",
        .hapd_init              = atheros_init,
@@ -1378,4 +1395,5 @@ const struct wpa_driver_ops wpa_driver_atheros_ops = {
        .sta_clear_stats        = atheros_sta_clear_stats,
        .commit                 = atheros_commit,
        .set_ap_wps_ie          = atheros_set_ap_wps_ie,
+       .set_authmode           = atheros_set_authmode,
 };