aboutsummaryrefslogtreecommitdiffstats
path: root/src/drivers/driver_atheros.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/driver_atheros.c')
-rw-r--r--src/drivers/driver_atheros.c55
1 files changed, 25 insertions, 30 deletions
diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c
index ce9f983..f3387d8 100644
--- a/src/drivers/driver_atheros.c
+++ b/src/drivers/driver_atheros.c
@@ -58,8 +58,6 @@
#include "wireless_copy.h"
-#include "../hostapd/hostapd.h"
-#include "../hostapd/config.h"
#include "../hostapd/sta_flags.h"
#include "driver.h"
#include "eloop.h"
@@ -192,13 +190,12 @@ ether_sprintf(const u8 *addr)
* Configure WPA parameters.
*/
static int
-madwifi_configure_wpa(struct madwifi_driver_data *drv)
+madwifi_configure_wpa(struct madwifi_driver_data *drv,
+ struct wpa_bss_params *params)
{
- struct hostapd_data *hapd = drv->hapd;
- struct hostapd_bss_config *conf = hapd->conf;
int v;
- switch (conf->wpa_group) {
+ switch (params->wpa_group) {
case WPA_CIPHER_CCMP:
v = IEEE80211_CIPHER_AES_CCM;
break;
@@ -216,7 +213,7 @@ madwifi_configure_wpa(struct madwifi_driver_data *drv)
break;
default:
wpa_printf(MSG_ERROR, "Unknown group key cipher %u",
- conf->wpa_group);
+ params->wpa_group);
return -1;
}
wpa_printf(MSG_DEBUG, "%s: group key cipher=%d", __func__, v);
@@ -226,7 +223,7 @@ madwifi_configure_wpa(struct madwifi_driver_data *drv)
}
if (v == IEEE80211_CIPHER_WEP) {
/* key length is done only for specific ciphers */
- v = (conf->wpa_group == WPA_CIPHER_WEP104 ? 13 : 5);
+ v = (params->wpa_group == WPA_CIPHER_WEP104 ? 13 : 5);
if (set80211param(drv, IEEE80211_PARAM_MCASTKEYLEN, v)) {
printf("Unable to set group key length to %u\n", v);
return -1;
@@ -234,11 +231,11 @@ madwifi_configure_wpa(struct madwifi_driver_data *drv)
}
v = 0;
- if (conf->wpa_pairwise & WPA_CIPHER_CCMP)
+ if (params->wpa_pairwise & WPA_CIPHER_CCMP)
v |= 1<<IEEE80211_CIPHER_AES_CCM;
- if (conf->wpa_pairwise & WPA_CIPHER_TKIP)
+ if (params->wpa_pairwise & WPA_CIPHER_TKIP)
v |= 1<<IEEE80211_CIPHER_TKIP;
- if (conf->wpa_pairwise & WPA_CIPHER_NONE)
+ if (params->wpa_pairwise & WPA_CIPHER_NONE)
v |= 1<<IEEE80211_CIPHER_NONE;
wpa_printf(MSG_DEBUG, "%s: pairwise key ciphers=0x%x", __func__, v);
if (set80211param(drv, IEEE80211_PARAM_UCASTCIPHERS, v)) {
@@ -247,26 +244,27 @@ madwifi_configure_wpa(struct madwifi_driver_data *drv)
}
wpa_printf(MSG_DEBUG, "%s: key management algorithms=0x%x",
- __func__, conf->wpa_key_mgmt);
- if (set80211param(drv, IEEE80211_PARAM_KEYMGTALGS, conf->wpa_key_mgmt)) {
+ __func__, params->wpa_key_mgmt);
+ if (set80211param(drv, IEEE80211_PARAM_KEYMGTALGS,
+ params->wpa_key_mgmt)) {
printf("Unable to set key management algorithms to 0x%x\n",
- conf->wpa_key_mgmt);
+ params->wpa_key_mgmt);
return -1;
}
v = 0;
- if (conf->rsn_preauth)
+ if (params->rsn_preauth)
v |= BIT(0);
wpa_printf(MSG_DEBUG, "%s: rsn capabilities=0x%x",
- __func__, conf->rsn_preauth);
+ __func__, params->rsn_preauth);
if (set80211param(drv, IEEE80211_PARAM_RSNCAPS, v)) {
printf("Unable to set RSN capabilities to 0x%x\n", v);
return -1;
}
- wpa_printf(MSG_DEBUG, "%s: enable WPA=0x%x", __func__, conf->wpa);
- if (set80211param(drv, IEEE80211_PARAM_WPA, conf->wpa)) {
- printf("Unable to set WPA to %u\n", conf->wpa);
+ wpa_printf(MSG_DEBUG, "%s: enable WPA=0x%x", __func__, params->wpa);
+ if (set80211param(drv, IEEE80211_PARAM_WPA, params->wpa)) {
+ printf("Unable to set WPA to %u\n", params->wpa);
return -1;
}
return 0;
@@ -309,30 +307,27 @@ static int
madwifi_set_ieee8021x(void *priv, struct wpa_bss_params *params)
{
struct madwifi_driver_data *drv = priv;
- struct hostapd_data *hapd = drv->hapd;
- struct hostapd_bss_config *conf = hapd->conf;
- int enabled = params->enabled;
- wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, enabled);
+ wpa_printf(MSG_DEBUG, "%s: enabled=%d", __func__, params->enabled);
- if (!enabled) {
+ if (!params->enabled) {
/* XXX restore state */
return set80211param(priv, IEEE80211_PARAM_AUTHMODE,
IEEE80211_AUTH_AUTO);
}
- if (!conf->wpa && !conf->ieee802_1x) {
- hostapd_logger(hapd, NULL, HOSTAPD_MODULE_DRIVER,
+ if (!params->wpa && !params->ieee802_1x) {
+ hostapd_logger(drv->hapd, NULL, HOSTAPD_MODULE_DRIVER,
HOSTAPD_LEVEL_WARNING, "No 802.1X or WPA enabled!");
return -1;
}
- if (conf->wpa && madwifi_configure_wpa(drv) != 0) {
- hostapd_logger(hapd, NULL, HOSTAPD_MODULE_DRIVER,
+ if (params->wpa && madwifi_configure_wpa(drv, params) != 0) {
+ hostapd_logger(drv->hapd, NULL, HOSTAPD_MODULE_DRIVER,
HOSTAPD_LEVEL_WARNING, "Error configuring WPA state!");
return -1;
}
if (set80211param(priv, IEEE80211_PARAM_AUTHMODE,
- (conf->wpa ? IEEE80211_AUTH_WPA : IEEE80211_AUTH_8021X))) {
- hostapd_logger(hapd, NULL, HOSTAPD_MODULE_DRIVER,
+ (params->wpa ? IEEE80211_AUTH_WPA : IEEE80211_AUTH_8021X))) {
+ hostapd_logger(drv->hapd, NULL, HOSTAPD_MODULE_DRIVER,
HOSTAPD_LEVEL_WARNING, "Error enabling WPA/802.1X!");
return -1;
}