Moved disassociation processing away from driver_*.c
This commit is contained in:
parent
940a0ce970
commit
33eb3c4ec4
5 changed files with 28 additions and 67 deletions
|
@ -218,5 +218,6 @@ void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
|
||||||
void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd, const u8 *addr);
|
void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd, const u8 *addr);
|
||||||
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
|
||||||
const u8 *ie, size_t ielen);
|
const u8 *ie, size_t ielen);
|
||||||
|
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
|
||||||
|
|
||||||
#endif /* DRIVER_H */
|
#endif /* DRIVER_H */
|
||||||
|
|
|
@ -34,12 +34,9 @@
|
||||||
#include "driver.h"
|
#include "driver.h"
|
||||||
#include "ieee802_1x.h"
|
#include "ieee802_1x.h"
|
||||||
#include "eloop.h"
|
#include "eloop.h"
|
||||||
#include "sta_info.h"
|
|
||||||
#include "l2_packet/l2_packet.h"
|
#include "l2_packet/l2_packet.h"
|
||||||
|
|
||||||
#include "eapol_sm.h"
|
#include "eapol_sm.h"
|
||||||
#include "wpa.h"
|
|
||||||
#include "radius/radius.h"
|
|
||||||
#include "ieee802_11.h"
|
#include "ieee802_11.h"
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
|
|
||||||
|
@ -504,28 +501,6 @@ bsd_sta_disassoc(void *priv, const u8 *addr, int reason_code)
|
||||||
return set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme));
|
return set80211var(drv, IEEE80211_IOC_MLME, &mlme, sizeof(mlme));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
bsd_del_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
|
||||||
{
|
|
||||||
struct hostapd_data *hapd = drv->hapd;
|
|
||||||
struct hostapd_bss_config *conf = hapd->conf;
|
|
||||||
struct sta_info *sta;
|
|
||||||
|
|
||||||
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
|
|
||||||
HOSTAPD_LEVEL_INFO, "deassociated");
|
|
||||||
|
|
||||||
sta = ap_get_sta(hapd, addr);
|
|
||||||
if (sta != NULL) {
|
|
||||||
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
|
|
||||||
if (conf->wpa)
|
|
||||||
wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
|
|
||||||
sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
|
|
||||||
ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
|
|
||||||
ap_free_sta(hapd, sta);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
bsd_new_sta(struct bsd_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
||||||
{
|
{
|
||||||
|
@ -593,7 +568,7 @@ bsd_wireless_event_receive(int sock, void *ctx, void *sock_ctx)
|
||||||
break;
|
break;
|
||||||
case RTM_IEEE80211_LEAVE:
|
case RTM_IEEE80211_LEAVE:
|
||||||
leave = (struct ieee80211_leave_event *) &ifan[1];
|
leave = (struct ieee80211_leave_event *) &ifan[1];
|
||||||
bsd_del_sta(drv, leave->iev_addr);
|
hostapd_notif_disassoc(drv, leave->iev_addr);
|
||||||
break;
|
break;
|
||||||
case RTM_IEEE80211_JOIN:
|
case RTM_IEEE80211_JOIN:
|
||||||
#ifdef RTM_IEEE80211_REJOIN
|
#ifdef RTM_IEEE80211_REJOIN
|
||||||
|
|
|
@ -60,13 +60,9 @@
|
||||||
#include "ieee802_1x.h"
|
#include "ieee802_1x.h"
|
||||||
#include "eloop.h"
|
#include "eloop.h"
|
||||||
#include "priv_netlink.h"
|
#include "priv_netlink.h"
|
||||||
#include "sta_info.h"
|
|
||||||
#include "l2_packet/l2_packet.h"
|
#include "l2_packet/l2_packet.h"
|
||||||
|
|
||||||
#include "wpa.h"
|
|
||||||
#include "radius/radius.h"
|
|
||||||
#include "ieee802_11.h"
|
#include "ieee802_11.h"
|
||||||
#include "accounting.h"
|
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "wps_hostapd.h"
|
#include "wps_hostapd.h"
|
||||||
|
|
||||||
|
@ -795,26 +791,6 @@ static int madwifi_receive_probe_req(struct madwifi_driver_data *drv)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
|
||||||
madwifi_del_sta(struct madwifi_driver_data *drv, u8 addr[IEEE80211_ADDR_LEN])
|
|
||||||
{
|
|
||||||
struct hostapd_data *hapd = drv->hapd;
|
|
||||||
struct sta_info *sta;
|
|
||||||
|
|
||||||
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
|
|
||||||
HOSTAPD_LEVEL_INFO, "disassociated");
|
|
||||||
|
|
||||||
sta = ap_get_sta(hapd, addr);
|
|
||||||
if (sta != NULL) {
|
|
||||||
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
|
|
||||||
wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
|
|
||||||
sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
|
|
||||||
ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
|
|
||||||
ap_free_sta(hapd, sta);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef CONFIG_WPS
|
#ifdef CONFIG_WPS
|
||||||
static int
|
static int
|
||||||
madwifi_set_wps_ie(void *priv, const u8 *ie, size_t len, u32 frametype)
|
madwifi_set_wps_ie(void *priv, const u8 *ie, size_t len, u32 frametype)
|
||||||
|
@ -994,7 +970,8 @@ madwifi_wireless_event_wireless(struct madwifi_driver_data *drv,
|
||||||
|
|
||||||
switch (iwe->cmd) {
|
switch (iwe->cmd) {
|
||||||
case IWEVEXPIRED:
|
case IWEVEXPIRED:
|
||||||
madwifi_del_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
hostapd_notif_disassoc(drv->hapd,
|
||||||
|
(u8 *) iwe->u.addr.sa_data);
|
||||||
break;
|
break;
|
||||||
case IWEVREGISTERED:
|
case IWEVREGISTERED:
|
||||||
madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
madwifi_new_sta(drv, (u8 *) iwe->u.addr.sa_data);
|
||||||
|
|
|
@ -21,10 +21,7 @@
|
||||||
#include "sha1.h"
|
#include "sha1.h"
|
||||||
#include "eloop.h"
|
#include "eloop.h"
|
||||||
#include "ieee802_1x.h"
|
#include "ieee802_1x.h"
|
||||||
#include "sta_info.h"
|
|
||||||
#include "wpa.h"
|
#include "wpa.h"
|
||||||
#include "accounting.h"
|
|
||||||
#include "radius/radius.h"
|
|
||||||
#include "l2_packet/l2_packet.h"
|
#include "l2_packet/l2_packet.h"
|
||||||
#include "ieee802_11.h"
|
#include "ieee802_11.h"
|
||||||
#include "hw_features.h"
|
#include "hw_features.h"
|
||||||
|
@ -522,24 +519,12 @@ static void test_driver_disassoc(struct test_driver_data *drv,
|
||||||
struct sockaddr_un *from, socklen_t fromlen)
|
struct sockaddr_un *from, socklen_t fromlen)
|
||||||
{
|
{
|
||||||
struct test_client_socket *cli;
|
struct test_client_socket *cli;
|
||||||
struct sta_info *sta;
|
|
||||||
|
|
||||||
cli = test_driver_get_cli(drv, from, fromlen);
|
cli = test_driver_get_cli(drv, from, fromlen);
|
||||||
if (!cli)
|
if (!cli)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
hostapd_logger(drv->hapd, cli->addr, HOSTAPD_MODULE_IEEE80211,
|
hostapd_notif_disassoc(drv->hapd, cli->addr);
|
||||||
HOSTAPD_LEVEL_INFO, "disassociated");
|
|
||||||
|
|
||||||
sta = ap_get_sta(drv->hapd, cli->addr);
|
|
||||||
if (sta != NULL) {
|
|
||||||
sta->flags &= ~WLAN_STA_ASSOC;
|
|
||||||
wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
|
|
||||||
sta->acct_terminate_cause =
|
|
||||||
RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
|
|
||||||
ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
|
|
||||||
ap_free_sta(drv->hapd, sta);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@
|
||||||
#include "driver_i.h"
|
#include "driver_i.h"
|
||||||
#include "radius/radius_client.h"
|
#include "radius/radius_client.h"
|
||||||
#include "radius/radius_server.h"
|
#include "radius/radius_server.h"
|
||||||
|
#include "radius/radius.h"
|
||||||
#include "wpa.h"
|
#include "wpa.h"
|
||||||
#include "preauth.h"
|
#include "preauth.h"
|
||||||
#include "wme.h"
|
#include "wme.h"
|
||||||
|
@ -367,6 +368,28 @@ skip_wpa_check:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr)
|
||||||
|
{
|
||||||
|
struct sta_info *sta;
|
||||||
|
|
||||||
|
hostapd_logger(hapd, addr, HOSTAPD_MODULE_IEEE80211,
|
||||||
|
HOSTAPD_LEVEL_INFO, "disassociated");
|
||||||
|
|
||||||
|
sta = ap_get_sta(hapd, addr);
|
||||||
|
if (sta == NULL) {
|
||||||
|
wpa_printf(MSG_DEBUG, "Disassociation notification for "
|
||||||
|
"unknown STA " MACSTR, MAC2STR(addr));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
|
||||||
|
wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
|
||||||
|
sta->acct_terminate_cause = RADIUS_ACCT_TERMINATE_CAUSE_USER_REQUEST;
|
||||||
|
ieee802_1x_notify_port_enabled(sta->eapol_sm, 0);
|
||||||
|
ap_free_sta(hapd, sta);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef EAP_SERVER
|
#ifdef EAP_SERVER
|
||||||
static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
|
static int hostapd_sim_db_cb_sta(struct hostapd_data *hapd,
|
||||||
struct sta_info *sta, void *ctx)
|
struct sta_info *sta, void *ctx)
|
||||||
|
|
Loading…
Reference in a new issue