[PATCH] ctrl_iface: Send an event when an inactive station is removed

Nicolas Cavallari Nicolas.Cavallari
Fri Oct 28 00:30:48 PDT 2011


Currently there is no events over the control interface when
a station is removed due to inactivity.  With this patch, an
"AP-INACTIVE-STA-DISCONNECTED"  event is sent when a station
is removed.

This doesn't break anything for existing applications which
expect that an "AP-STA-DISCONNECTED" event mean an explicit
disassociation from the client.
---
 doc/ctrl_iface.doxygen |    9 +++++++++
 src/ap/sta_info.c      |    4 ++++
 src/common/wpa_ctrl.h  |    1 +
 3 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/doc/ctrl_iface.doxygen b/doc/ctrl_iface.doxygen
index f820f9e..ae8c1fe 100644
--- a/doc/ctrl_iface.doxygen
+++ b/doc/ctrl_iface.doxygen
@@ -896,6 +896,15 @@ AP_STA_DISCONNECTED: A station disassociated (AP mode event)
 AP-STA-DISCONNECTED 02:2a:c4:18:5b:f3
 \endverbatim
 
+\subsection ctrl_iface_event_AP_INACTIVE_STA_DISCONNECTED AP-INACTIVE-STA-DISCONNECTED
+
+AP_INACTIVE_STA_DISCONNECTED: A station was disassociated due to
+inactivity (AP mode event)
+
+\verbatim
+AP-INACTIVE-STA-DISCONNECTED 02:2a:c4:18:5b:f3
+\endverbatim
+
 \subsection ctrl_iface_event_P2P_EVENT_DEVICE_FOUND P2P-DEVICE-FOUND
 
 P2P_EVENT_DEVICE_FOUND: Indication of a discovered P2P device with
diff --git a/src/ap/sta_info.c b/src/ap/sta_info.c
index d82b9ce..f45d1f3 100644
--- a/src/ap/sta_info.c
+++ b/src/ap/sta_info.c
@@ -17,6 +17,7 @@
 #include "utils/common.h"
 #include "utils/eloop.h"
 #include "common/ieee802_11_defs.h"
+#include "common/wpa_ctrl.h"
 #include "radius/radius.h"
 #include "radius/radius_client.h"
 #include "drivers/driver.h"
@@ -375,6 +376,9 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
 		mlme_deauthenticate_indication(
 			hapd, sta,
 			WLAN_REASON_PREV_AUTH_NOT_VALID);
+
+		wpa_msg(hapd->msg_ctx, MSG_INFO, AP_INACTIVE_STA_DISCONNECTED
+				MACSTR, MAC2STR(sta->addr));
 		ap_free_sta(hapd, sta);
 		break;
 	}
diff --git a/src/common/wpa_ctrl.h b/src/common/wpa_ctrl.h
index fd096e7..249ffed 100644
--- a/src/common/wpa_ctrl.h
+++ b/src/common/wpa_ctrl.h
@@ -138,6 +138,7 @@ extern "C" {
 #define WPS_EVENT_AP_PIN_DISABLED "WPS-AP-PIN-DISABLED "
 #define AP_STA_CONNECTED "AP-STA-CONNECTED "
 #define AP_STA_DISCONNECTED "AP-STA-DISCONNECTED "
+#define AP_INACTIVE_STA_DISCONNECTED "AP-INACTIVE-STA-DISCONNECTED "
 
 
 /* wpa_supplicant/hostapd control interface access */
-- 
1.7.7.1




More information about the Hostap mailing list