}
+static int hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr,
+ int aid, int val)
+{
+ if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
+ return 0;
+ return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val);
+}
+
+
+static int hostapd_set_sta_vlan(const char *ifname, struct hostapd_data *hapd,
+ const u8 *addr, int vlan_id)
+{
+ if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
+ return 0;
+ return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname,
+ vlan_id);
+}
+
+
+static int hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
+{
+ if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
+ return 0;
+ return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
+}
+
+
+static int hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr,
+ int reason)
+{
+ if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
+ return 0;
+ return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
+ reason);
+}
+
+
+static int hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr,
+ int reason)
+{
+ if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
+ return 0;
+ return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
+ reason);
+}
+
+
+static int hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
+{
+ if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
+ return 0;
+ return hapd->driver->sta_remove(hapd->drv_priv, addr);
+}
+
+
void hostapd_set_driver_ops(struct hostapd_driver_ops *ops)
{
ops->set_ap_wps_ie = hostapd_set_ap_wps_ie;
ops->set_beacon = hostapd_set_beacon;
ops->vlan_if_add = hostapd_vlan_if_add;
ops->vlan_if_remove = hostapd_vlan_if_remove;
+ ops->set_wds_sta = hostapd_set_wds_sta;
+ ops->set_sta_vlan = hostapd_set_sta_vlan;
+ ops->get_inact_sec = hostapd_get_inact_sec;
+ ops->sta_deauth = hostapd_sta_deauth;
+ ops->sta_disassoc = hostapd_sta_disassoc;
+ ops->sta_remove = hostapd_sta_remove;
}
}
static inline int
-hostapd_sta_deauth(struct hostapd_data *hapd, const u8 *addr, int reason)
-{
- if (hapd->driver == NULL || hapd->driver->sta_deauth == NULL)
- return 0;
- return hapd->driver->sta_deauth(hapd->drv_priv, hapd->own_addr, addr,
- reason);
-}
-
-static inline int
-hostapd_sta_disassoc(struct hostapd_data *hapd, const u8 *addr, int reason)
-{
- if (hapd->driver == NULL || hapd->driver->sta_disassoc == NULL)
- return 0;
- return hapd->driver->sta_disassoc(hapd->drv_priv, hapd->own_addr, addr,
- reason);
-}
-
-static inline int
-hostapd_sta_remove(struct hostapd_data *hapd, const u8 *addr)
-{
- if (hapd->driver == NULL || hapd->driver->sta_remove == NULL)
- return 0;
- return hapd->driver->sta_remove(hapd->drv_priv, addr);
-}
-
-static inline int
hostapd_get_ssid(struct hostapd_data *hapd, u8 *buf, size_t len)
{
if (hapd->driver == NULL || hapd->driver->hapd_get_ssid == NULL)
}
static inline int
-hostapd_get_inact_sec(struct hostapd_data *hapd, const u8 *addr)
-{
- if (hapd->driver == NULL || hapd->driver->get_inact_sec == NULL)
- return 0;
- return hapd->driver->get_inact_sec(hapd->drv_priv, addr);
-}
-
-static inline int
hostapd_set_freq(struct hostapd_data *hapd, int mode, int freq, int channel,
int ht_enabled, int sec_channel_offset)
{
}
static inline int
-hostapd_set_sta_vlan(const char *ifname, struct hostapd_data *hapd,
- const u8 *addr, int vlan_id)
-{
- if (hapd->driver == NULL || hapd->driver->set_sta_vlan == NULL)
- return 0;
- return hapd->driver->set_sta_vlan(hapd->drv_priv, addr, ifname, vlan_id);
-}
-
-static inline int
-hostapd_set_wds_sta(struct hostapd_data *hapd, const u8 *addr, int aid,
- int val)
-{
- if (hapd->driver == NULL || hapd->driver->set_wds_sta == NULL)
- return 0;
- return hapd->driver->set_wds_sta(hapd->drv_priv, addr, aid, val);
-}
-
-static inline int
hostapd_driver_commit(struct hostapd_data *hapd)
{
if (hapd->driver == NULL || hapd->driver->commit == NULL)
#endif /* CONFIG_IEEE80211W */
else
resp = WLAN_REASON_INVALID_IE;
- hostapd_sta_disassoc(hapd, sta->addr, resp);
+ hapd->drv.sta_disassoc(hapd, sta->addr, resp);
ap_free_sta(hapd, sta);
return -1;
}
if (hapd->driver && os_strcmp(hapd->driver->name, "hostap") != 0) {
u8 addr[ETH_ALEN];
os_memset(addr, 0xff, ETH_ALEN);
- hostapd_sta_deauth(hapd, addr,
- WLAN_REASON_PREV_AUTH_NOT_VALID);
+ hapd->drv.sta_deauth(hapd, addr,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
}
return ret;
int reassoc)
{
if (hapd->tkip_countermeasures) {
- hostapd_sta_deauth(hapd, sta->addr,
- WLAN_REASON_MICHAEL_MIC_FAILURE);
+ hapd->drv.sta_deauth(hapd, sta->addr,
+ WLAN_REASON_MICHAEL_MIC_FAILURE);
return;
}
int beacon_int);
int (*vlan_if_add)(struct hostapd_data *hapd, const char *ifname);
int (*vlan_if_remove)(struct hostapd_data *hapd, const char *ifname);
+ int (*set_wds_sta)(struct hostapd_data *hapd, const u8 *addr, int aid,
+ int val);
+ int (*set_sta_vlan)(const char *ifname, struct hostapd_data *hapd,
+ const u8 *addr, int vlan_id);
+ int (*get_inact_sec)(struct hostapd_data *hapd, const u8 *addr);
+ int (*sta_deauth)(struct hostapd_data *hapd, const u8 *addr,
+ int reason);
+ int (*sta_disassoc)(struct hostapd_data *hapd, const u8 *addr,
+ int reason);
+ int (*sta_remove)(struct hostapd_data *hapd, const u8 *addr);
};
/**
* authenticated. */
accounting_sta_stop(hapd, sta);
ieee802_1x_free_station(sta);
- hostapd_sta_remove(hapd, sta->addr);
+ hapd->drv.sta_remove(hapd, sta->addr);
if (sta->timeout_next == STA_NULLFUNC ||
sta->timeout_next == STA_DISASSOC) {
* cleared and configuration gets updated in case of reassociation back
* to the same AP.
*/
- hostapd_sta_remove(hapd, sta->addr);
+ hapd->drv.sta_remove(hapd, sta->addr);
#ifdef CONFIG_IEEE80211N
if (sta->flags & WLAN_STA_HT)
"STA " MACSTR " (aid %u)",
MAC2STR(sta->addr), sta->aid);
sta->flags |= WLAN_STA_WDS;
- hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 1);
+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 1);
}
return;
}
wpa_printf(MSG_DEBUG, "Data/PS-poll frame from not associated STA "
MACSTR, MAC2STR(src));
if (sta && (sta->flags & WLAN_STA_AUTH))
- hostapd_sta_disassoc(
+ hapd->drv.sta_disassoc(
hapd, src,
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
else
- hostapd_sta_deauth(
+ hapd->drv.sta_deauth(
hapd, src,
WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA);
}
/*
* hostapd / Station table
- * Copyright (c) 2002-2008, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2002-2009, Jouni Malinen <j@w1.fi>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
#include "includes.h"
#include "common.h"
+#include "radius/radius.h"
+#include "radius/radius_client.h"
+#include "drivers/driver.h"
#include "hostapd.h"
#include "sta_info.h"
#include "eloop.h"
#include "accounting.h"
#include "ieee802_1x.h"
#include "ieee802_11.h"
-#include "radius/radius.h"
#include "wpa.h"
#include "preauth.h"
-#include "radius/radius_client.h"
-#include "driver_i.h"
+#include "config.h"
#include "beacon.h"
#include "hw_features.h"
#include "mlme.h"
accounting_sta_stop(hapd, sta);
- hostapd_set_wds_sta(hapd, sta->addr, sta->aid, 0);
+ hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
!(sta->flags & WLAN_STA_PREAUTH))
- hostapd_sta_remove(hapd, sta->addr);
+ hapd->drv.sta_remove(hapd, sta->addr);
ap_sta_hash_del(hapd, sta);
ap_sta_list_del(hapd, sta);
int inactive_sec;
wpa_printf(MSG_DEBUG, "Checking STA " MACSTR " inactivity:",
MAC2STR(sta->addr));
- inactive_sec = hostapd_get_inact_sec(hapd, sta->addr);
+ inactive_sec = hapd->drv.get_inact_sec(hapd, sta->addr);
if (inactive_sec == -1) {
wpa_printf(MSG_DEBUG, "Could not get station info "
"from kernel driver for " MACSTR ".",
MAC2STR(sta->addr));
if (deauth) {
- hostapd_sta_deauth(hapd, sta->addr,
- WLAN_REASON_PREV_AUTH_NOT_VALID);
+ hapd->drv.sta_deauth(hapd, sta->addr,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
} else {
- hostapd_sta_disassoc(
+ hapd->drv.sta_disassoc(
hapd, sta->addr,
WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY);
}
RADIUS_ACCT_TERMINATE_CAUSE_SESSION_TIMEOUT;
os_memcpy(addr, sta->addr, ETH_ALEN);
ap_free_sta(hapd, sta);
- hostapd_sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
+ hapd->drv.sta_deauth(hapd, addr, WLAN_REASON_PREV_AUTH_NOT_VALID);
}
wpa_printf(MSG_DEBUG, "Removing STA " MACSTR " from kernel driver",
MAC2STR(sta->addr));
- if (hostapd_sta_remove(hapd, sta->addr) &&
+ if (hapd->drv.sta_remove(hapd, sta->addr) &&
sta->flags & WLAN_STA_ASSOC) {
wpa_printf(MSG_DEBUG, "Could not remove station " MACSTR
" from kernel driver.", MAC2STR(sta->addr));
if (wpa_auth_sta_set_vlan(sta->wpa_sm, sta->vlan_id) < 0)
wpa_printf(MSG_INFO, "Failed to update VLAN-ID for WPA");
- return hostapd_set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
+ return hapd->drv.set_sta_vlan(iface, hapd, sta->addr, sta->vlan_id);
#else /* CONFIG_NO_VLAN */
return 0;
#endif /* CONFIG_NO_VLAN */
sta = ap_get_sta(hapd, addr);
if (addr)
- hostapd_sta_deauth(hapd, addr, reason);
+ hapd->drv.sta_deauth(hapd, addr, reason);
if (sta == NULL)
return;
eloop_register_timeout(60, 0, ieee80211_tkip_countermeasures_stop,
hapd, NULL);
for (sta = hapd->sta_list; sta != NULL; sta = sta->next) {
- hostapd_sta_deauth(hapd, sta->addr,
- WLAN_REASON_MICHAEL_MIC_FAILURE);
+ hapd->drv.sta_deauth(hapd, sta->addr,
+ WLAN_REASON_MICHAEL_MIC_FAILURE);
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC |
WLAN_STA_AUTHORIZED);
- hostapd_sta_remove(hapd, sta->addr);
+ hapd->drv.sta_remove(hapd, sta->addr);
}
}