Add ctrl_iface events for AP mode STA connect/disconnect

These are used to notify ctrl_iface monitors when a STA completes
connection (the port becomes authorized) and when a STA disconnects.
This commit is contained in:
Jouni Malinen 2009-10-16 17:51:49 +03:00 committed by Jouni Malinen
parent 278da1b52a
commit 20bd9547a1
3 changed files with 18 additions and 0 deletions

View file

@ -36,6 +36,7 @@
#include "accounting.h"
#include "driver_i.h"
#include "mlme.h"
#include "wpa_ctrl.h"
u8 * hostapd_eid_supp_rates(struct hostapd_data *hapd, u8 *eid)
@ -1198,6 +1199,8 @@ static void handle_disassoc(struct hostapd_data *hapd,
}
sta->flags &= ~WLAN_STA_ASSOC;
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
MAC2STR(sta->addr));
wpa_auth_sm_event(sta->wpa_sm, WPA_DISASSOC);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_INFO, "disassociated");
@ -1246,6 +1249,8 @@ static void handle_deauth(struct hostapd_data *hapd,
}
sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
wpa_msg(hapd->msg_ctx, MSG_INFO, AP_STA_DISCONNECTED MACSTR,
MAC2STR(sta->addr));
wpa_auth_sm_event(sta->wpa_sm, WPA_DEAUTH);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
HOSTAPD_LEVEL_DEBUG, "deauthenticated");
@ -1661,6 +1666,8 @@ static void handle_assoc_cb(struct hostapd_data *hapd,
if (!hapd->conf->ieee802_1x && !hapd->conf->wpa) {
/* Open or static WEP; no separate authorization */
sta->flags |= WLAN_STA_AUTHORIZED;
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
}
if (reassoc)

View file

@ -31,6 +31,7 @@
#include "hw_features.h"
#include "eap_server/eap.h"
#include "ieee802_11_defs.h"
#include "wpa_ctrl.h"
static void ieee802_1x_finished(struct hostapd_data *hapd,
@ -83,12 +84,20 @@ void ieee802_1x_set_sta_authorized(struct hostapd_data *hapd,
return;
if (authorized) {
if (!(sta->flags & WLAN_STA_AUTHORIZED))
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_CONNECTED MACSTR, MAC2STR(sta->addr));
sta->flags |= WLAN_STA_AUTHORIZED;
res = hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
WLAN_STA_AUTHORIZED, ~0);
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE8021X,
HOSTAPD_LEVEL_DEBUG, "authorizing port");
} else {
if ((sta->flags & (WLAN_STA_AUTHORIZED | WLAN_STA_ASSOC)) ==
(WLAN_STA_AUTHORIZED | WLAN_STA_ASSOC))
wpa_msg(hapd->msg_ctx, MSG_INFO,
AP_STA_DISCONNECTED MACSTR,
MAC2STR(sta->addr));
sta->flags &= ~WLAN_STA_AUTHORIZED;
res = hostapd_sta_set_flags(hapd, sta->addr, sta->flags,
0, ~WLAN_STA_AUTHORIZED);

View file

@ -74,6 +74,8 @@ extern "C" {
#define WPS_EVENT_NEW_AP_SETTINGS "WPS-NEW-AP-SETTINGS "
#define WPS_EVENT_REG_SUCCESS "WPS-REG-SUCCESS "
#define WPS_EVENT_AP_SETUP_LOCKED "WPS-AP-SETUP-LOCKED "
#define AP_STA_CONNECTED "AP-STA-CONNECTED "
#define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
/* wpa_supplicant/hostapd control interface access */