struct wpa_auth_config wpa_auth_conf;
size_t j;
- newconf = hostapd_config_read(iface->config_fname);
+ if (iface->config_read_cb == NULL)
+ return -1;
+ newconf = iface->config_read_cb(iface->config_fname);
if (newconf == NULL)
return -1;
int i;
for (i = 0; i < NUM_WEP_KEYS; i++) {
- if (hostapd_set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
- i == 0 ? 1 : 0, NULL, 0, NULL, 0)) {
+ if (hapd->drv.set_key(ifname, hapd, WPA_ALG_NONE, NULL, i,
+ i == 0 ? 1 : 0, NULL, 0, NULL, 0)) {
wpa_printf(MSG_DEBUG, "Failed to clear default "
"encryption keys (ifname=%s keyidx=%d)",
ifname, i);
#ifdef CONFIG_IEEE80211W
if (hapd->conf->ieee80211w) {
for (i = NUM_WEP_KEYS; i < NUM_WEP_KEYS + 2; i++) {
- if (hostapd_set_key(ifname, hapd, WPA_ALG_NONE, NULL,
- i, i == 0 ? 1 : 0, NULL, 0,
- NULL, 0)) {
+ if (hapd->drv.set_key(ifname, hapd, WPA_ALG_NONE, NULL,
+ i, i == 0 ? 1 : 0, NULL, 0,
+ NULL, 0)) {
wpa_printf(MSG_DEBUG, "Failed to clear "
"default mgmt encryption keys "
"(ifname=%s keyidx=%d)", ifname, i);
idx = ssid->wep.idx;
if (ssid->wep.default_len &&
- hostapd_set_key(hapd->conf->iface,
- hapd, WPA_ALG_WEP, NULL, idx, idx == ssid->wep.idx,
- NULL, 0, ssid->wep.key[idx], ssid->wep.len[idx])) {
+ hapd->drv.set_key(hapd->conf->iface,
+ hapd, WPA_ALG_WEP, NULL, idx,
+ idx == ssid->wep.idx,
+ NULL, 0, ssid->wep.key[idx],
+ ssid->wep.len[idx])) {
wpa_printf(MSG_WARNING, "Could not set WEP encryption.");
errors++;
}
continue;
idx = key->idx;
- if (hostapd_set_key(ifname, hapd, WPA_ALG_WEP, NULL,
- idx, idx == key->idx, NULL, 0,
- key->key[idx], key->len[idx])) {
+ if (hapd->drv.set_key(ifname, hapd, WPA_ALG_WEP, NULL,
+ idx, idx == key->idx, NULL, 0,
+ key->key[idx], key->len[idx])) {
wpa_printf(MSG_WARNING, "Could not set "
"dynamic VLAN WEP encryption.");
errors++;
hostapd_broadcast_wep_set(hapd);
- if (hapd->conf->ssid.wep.default_len)
+ if (hapd->conf->ssid.wep.default_len) {
+ hostapd_set_privacy(hapd, 1);
return 0;
+ }
for (i = 0; i < 4; i++) {
if (hapd->conf->ssid.wep.key[i] &&
- hostapd_set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
- i == hapd->conf->ssid.wep.idx, NULL, 0,
- hapd->conf->ssid.wep.key[i],
- hapd->conf->ssid.wep.len[i])) {
+ hapd->drv.set_key(iface, hapd, WPA_ALG_WEP, NULL, i,
+ i == hapd->conf->ssid.wep.idx, NULL, 0,
+ hapd->conf->ssid.wep.key[i],
+ hapd->conf->ssid.wep.len[i])) {
wpa_printf(MSG_WARNING, "Could not set WEP "
"encryption.");
return -1;
u16 reason)
{
struct hostapd_data *hapd = ctx;
- struct sta_info *sta;
-
wpa_printf(MSG_DEBUG, "%s: WPA authenticator requests disconnect: "
"STA " MACSTR " reason %d",
__func__, MAC2STR(addr), reason);
-
- sta = ap_get_sta(hapd, addr);
- hostapd_sta_deauth(hapd, addr, reason);
- if (sta == NULL)
- return;
- sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_AUTHORIZED);
- eloop_cancel_timeout(ap_handle_timer, hapd, sta);
- eloop_register_timeout(0, 0, ap_handle_timer, hapd, sta);
- sta->timeout_next = STA_REMOVE;
+ ap_sta_disconnect(hapd, NULL, addr, reason);
}
return -1;
}
- return hostapd_set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0,
- key, key_len);
+ return hapd->drv.set_key(ifname, hapd, alg, addr, idx, 1, NULL, 0,
+ key, key_len);
}
int encrypt)
{
struct hostapd_data *hapd = ctx;
- return hostapd_send_eapol(hapd, addr, data, data_len, encrypt);
+ return hapd->drv.send_eapol(hapd, addr, data, data_len, encrypt);
}
void *ctx, int (*cb)(struct wpa_authenticator *sm, void *ctx),
void *cb_ctx)
{
+ struct hostapd_data *hapd = ctx;
struct wpa_auth_iface_iter_data data;
data.cb = cb;
data.cb_ctx = cb_ctx;
- return hostapd_for_each_interface(wpa_auth_iface_iter, &data);
+ return hostapd_for_each_interface(hapd->iface->interfaces,
+ wpa_auth_iface_iter, &data);
}
os_memcpy(m->bssid, hapd->own_addr, ETH_ALEN);
os_memcpy(&m->u, data, data_len);
- res = hostapd_send_mgmt_frame(hapd, (u8 *) m, mlen);
+ res = hapd->drv.send_mgmt_frame(hapd, (u8 *) m, mlen);
os_free(m);
return res;
}
hapd->interface_added = 1;
if (hostapd_if_add(hapd->iface->bss[0], WPA_IF_AP_BSS,
- hapd->conf->iface, hapd->own_addr)) {
+ hapd->conf->iface, hapd->own_addr, hapd)) {
wpa_printf(MSG_ERROR, "Failed to add BSS (BSSID="
MACSTR ")", MAC2STR(hapd->own_addr));
return -1;
if (hapd == NULL)
return NULL;
+ hostapd_set_driver_ops(&hapd->drv);
hapd->iconf = conf;
hapd->conf = bss;
hapd->iface = hapd_iface;