hostapd: Fix dynamic ACCEPT_ACL management over control interface

hostapd_disassoc_accept_mac() was called after a new accept MAC address
was added (ACCEPT_ACL ADD_MAC), but this function should have been
called after an accept MAC address was removed and accept MAC list was
cleared to disconnect a STA which is not listed in the update accept MAC
address list. Fix this by moving the call to places where a connected
STA can actually end up losing its previously present accept entry.

Signed-off-by: Masafumi Utsugi <mutsugi@allied-telesis.co.jp>
This commit is contained in:
Masafumi Utsugi 2020-09-29 15:12:01 +09:00 committed by Jouni Malinen
parent 0f8994b11d
commit 15251c6584

View file

@ -3681,16 +3681,15 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
eloop_terminate(); eloop_terminate();
} else if (os_strncmp(buf, "ACCEPT_ACL ", 11) == 0) { } else if (os_strncmp(buf, "ACCEPT_ACL ", 11) == 0) {
if (os_strncmp(buf + 11, "ADD_MAC ", 8) == 0) { if (os_strncmp(buf + 11, "ADD_MAC ", 8) == 0) {
if (!hostapd_ctrl_iface_acl_add_mac( if (hostapd_ctrl_iface_acl_add_mac(
&hapd->conf->accept_mac,
&hapd->conf->num_accept_mac, buf + 19))
reply_len = -1;
} else if (os_strncmp((buf + 11), "DEL_MAC ", 8) == 0) {
if (!hostapd_ctrl_iface_acl_del_mac(
&hapd->conf->accept_mac, &hapd->conf->accept_mac,
&hapd->conf->num_accept_mac, buf + 19)) &hapd->conf->num_accept_mac, buf + 19))
hostapd_disassoc_accept_mac(hapd); hostapd_disassoc_accept_mac(hapd);
else
reply_len = -1;
} else if (os_strncmp((buf + 11), "DEL_MAC ", 8) == 0) {
hostapd_ctrl_iface_acl_del_mac(
&hapd->conf->accept_mac,
&hapd->conf->num_accept_mac, buf + 19);
} else if (os_strcmp(buf + 11, "SHOW") == 0) { } else if (os_strcmp(buf + 11, "SHOW") == 0) {
reply_len = hostapd_ctrl_iface_acl_show_mac( reply_len = hostapd_ctrl_iface_acl_show_mac(
hapd->conf->accept_mac, hapd->conf->accept_mac,
@ -3699,6 +3698,7 @@ static int hostapd_ctrl_iface_receive_process(struct hostapd_data *hapd,
hostapd_ctrl_iface_acl_clear_list( hostapd_ctrl_iface_acl_clear_list(
&hapd->conf->accept_mac, &hapd->conf->accept_mac,
&hapd->conf->num_accept_mac); &hapd->conf->num_accept_mac);
hostapd_disassoc_accept_mac(hapd);
} }
} else if (os_strncmp(buf, "DENY_ACL ", 9) == 0) { } else if (os_strncmp(buf, "DENY_ACL ", 9) == 0) {
if (os_strncmp(buf + 9, "ADD_MAC ", 8) == 0) { if (os_strncmp(buf + 9, "ADD_MAC ", 8) == 0) {