[PATCH 2/2] hostapd: deauthenticate clients forbidden by maclists

Emanuel Taube emanuel.taube at gmail.com
Tue Feb 18 05:36:35 EST 2014


After adding or removing a mac address from a list the
corresponding station is not deauthenticated as expected.

Signed-off-by: Emanuel Taube <emanuel.taube at gmail.com>
---
 hostapd/ctrl_iface.c |   24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 4a9da5f..e2df568 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -984,6 +984,30 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
 #endif /* CONFIG_TESTING_OPTIONS */
 	} else {
 		ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
+		if (ret)
+			return ret;
+		if (os_strcasecmp(cmd, "deny_mac_file") == 0) {
+			struct sta_info *sta;
+			int vlan_id;
+			for (sta = hapd->sta_list; sta; sta = sta->next) {
+				if (hostapd_maclist_found(hapd->conf->deny_mac,
+				    hapd->conf->num_deny_mac, sta->addr,&vlan_id) &&
+				   (!vlan_id || vlan_id == sta->vlan_id))
+					ap_sta_deauthenticate(hapd, sta,
+						     WLAN_REASON_UNSPECIFIED);
+			}
+		} else if (os_strcasecmp(cmd, "accept_mac_file") == 0) {
+			struct sta_info *sta;
+			int vlan_id;
+			for (sta = hapd->sta_list; sta; sta = sta->next) {
+				if (!hostapd_maclist_found(hapd->conf->accept_mac,
+				    hapd->conf->num_accept_mac, sta->addr,&vlan_id) ||
+				   (vlan_id && vlan_id != sta->vlan_id))
+					ap_sta_deauthenticate(hapd, sta,
+						     WLAN_REASON_UNSPECIFIED);
+			}
+		}
+
 	}
 
 	return ret;
-- 
1.7.10.4



More information about the HostAP mailing list