atheros: Fix auth_alg configuration for static WEP

When IEEE 802.1X is not enabled, driver_atheros.c needs to know how
to set authentication algorithms for static WEP.
This commit is contained in:
Ken Zhu 2011-05-20 18:27:53 +03:00 committed by Jouni Malinen
parent 6d28fb9627
commit 41fd1d9e9a
4 changed files with 44 additions and 0 deletions

View 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); 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 */ #endif /* AP_DRV_OPS */

View file

@ -306,6 +306,12 @@ static int hostapd_setup_encryption(char *iface, struct hostapd_data *hapd)
return 0; 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++) { for (i = 0; i < 4; i++) {
if (hapd->conf->ssid.wep.key[i] && if (hapd->conf->ssid.wep.key[i] &&
hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i, hostapd_drv_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,

View file

@ -2241,6 +2241,18 @@ struct wpa_driver_ops {
* @signal_info: Connection info structure * @signal_info: Connection info structure
*/ */
int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info); 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);
}; };

View file

@ -1357,6 +1357,23 @@ atheros_commit(void *priv)
return linux_set_iface_flags(drv->ioctl_sock, drv->iface, 1); 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 = { const struct wpa_driver_ops wpa_driver_atheros_ops = {
.name = "atheros", .name = "atheros",
.hapd_init = atheros_init, .hapd_init = atheros_init,
@ -1378,4 +1395,5 @@ const struct wpa_driver_ops wpa_driver_atheros_ops = {
.sta_clear_stats = atheros_sta_clear_stats, .sta_clear_stats = atheros_sta_clear_stats,
.commit = atheros_commit, .commit = atheros_commit,
.set_ap_wps_ie = atheros_set_ap_wps_ie, .set_ap_wps_ie = atheros_set_ap_wps_ie,
.set_authmode = atheros_set_authmode,
}; };