diff mbox series

hostapd: Send an event before throwing a station

Message ID f76cead4-bff9-054f-22f4-9ca12a457880@cloudguard.ch
State Accepted
Headers show
Series hostapd: Send an event before throwing a station | expand

Commit Message

Andreas Tobler Aug. 13, 2018, 7:19 a.m. UTC
Hi,

We use the ctrl interface to record station connect/disconnect events. 
At the end of the day we often had more stations connected than the 
kernel reported.
The result of the investigation of this issue is the attached patch.

I hope the format is ok.

Thanks,
Andreas
From 900e02ddd7872afa91f645b9af0f28c683ce3b7f Mon Sep 17 00:00:00 2001
From: Andreas Tobler <andreas.tobler@cloudguard.ch>
Date: Mon, 13 Aug 2018 07:45:37 +0200
Subject: [PATCH] hostapd: Send an event before throwing a station

If you modify the WLAN-STA-AUTHORIZED bit in sta->flags, you have
to call the ap-sta-set-authorized() function to make sure the
corresponding event is sent. Otherwise we leak entries in the event
history.

Signed-off-by: Andreas Tobler <andreas.tobler@cloudguard.ch>
---
 src/ap/ieee802_11.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Jouni Malinen Sept. 2, 2018, 2:40 p.m. UTC | #1
On Mon, Aug 13, 2018 at 09:19:56AM +0200, Andreas Tobler wrote:
> We use the ctrl interface to record station connect/disconnect events. At
> the end of the day we often had more stations connected than the kernel
> reported.
> The result of the investigation of this issue is the attached patch.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index d7e7210f7..d8b34fa52 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2014,6 +2014,7 @@  static void handle_auth(struct hostapd_data *hapd,
 		 * updated. To handle this, station's added_unassoc flag is
 		 * cleared once the station has completed association.
 		 */
+		ap_sta_set_authorized(hapd, sta, 0);
 		hostapd_drv_sta_remove(hapd, sta->addr);
 		sta->flags &= ~(WLAN_STA_ASSOC | WLAN_STA_AUTH |
 				WLAN_STA_AUTHORIZED);