aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd/ctrl_iface.c
diff options
context:
space:
mode:
authorNadim Zubidat <nadimz@ti.com>2012-11-05 11:18:26 +0800
committerArik Nemtsov <arik@wizery.com>2012-11-06 17:39:54 +0200
commit0e14818d3e4f9185d30638cb748c396c0f2b1efe (patch)
treefcea92ba7edce39da01c8cc4ea6df51d8dea38c4 /hostapd/ctrl_iface.c
parentfb634d7768b87e1174d2a21f4c899da3706432e8 (diff)
downloadexternal_wpa_supplicant_8_ti-0e14818d3e4f9185d30638cb748c396c0f2b1efe.zip
external_wpa_supplicant_8_ti-0e14818d3e4f9185d30638cb748c396c0f2b1efe.tar.gz
external_wpa_supplicant_8_ti-0e14818d3e4f9185d30638cb748c396c0f2b1efe.tar.bz2
hostapd: enable dynamic modification of acl policy
add APIs for dynamically changing the macaddr_acl policy and mac addresses lists. once changed, hostapd will deauth stations which do not pass the new policy. Signed-off-by: Nadim Zubidat <nadimz@ti.com>
Diffstat (limited to 'hostapd/ctrl_iface.c')
-rw-r--r--hostapd/ctrl_iface.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/hostapd/ctrl_iface.c b/hostapd/ctrl_iface.c
index 8f42f90..e6a8ced 100644
--- a/hostapd/ctrl_iface.c
+++ b/hostapd/ctrl_iface.c
@@ -514,6 +514,42 @@ static int hostapd_ctrl_iface_ess_disassoc(struct hostapd_data *hapd,
}
+static int hostapd_ctrl_iface_set_accept_mac(struct hostapd_data *hapd,
+ char *fname)
+{
+ hapd->conf->num_accept_mac = 0;
+
+ if (hostapd_config_read_maclist(fname, &hapd->conf->accept_mac,
+ &hapd->conf->num_accept_mac)) {
+ wpa_printf(MSG_ERROR, "Reading mac list from file failed");
+ return -1;
+ }
+
+ /* Accept mac list changed, check if need to deauth stations*/
+ hostapd_macaddr_acl_accept_sta(hapd);
+
+ return 0;
+}
+
+
+static int hostapd_ctrl_iface_set_deny_mac(struct hostapd_data *hapd,
+ char *fname)
+{
+ hapd->conf->num_deny_mac = 0;
+
+ if (hostapd_config_read_maclist(fname, &hapd->conf->deny_mac,
+ &hapd->conf->num_deny_mac)) {
+ wpa_printf(MSG_ERROR, "Reading mac list from file failed");
+ return -1;
+ }
+
+ /* Deny mac list changed, check if need to deauth stations*/
+ hostapd_macaddr_acl_deny_sta(hapd);
+
+ return 0;
+}
+
+
static int hostapd_ctrl_iface_get_config(struct hostapd_data *hapd,
char *buf, size_t buflen)
{
@@ -723,6 +759,12 @@ static int hostapd_ctrl_iface_set(struct hostapd_data *hapd, char *cmd)
else
hapd->gas_frag_limit = val;
#endif /* CONFIG_INTERWORKING */
+ } else if (os_strcasecmp(cmd, "macaddr_acl") == 0) {
+ ret = hostapd_macaddr_acl_command(hapd, value);
+ } else if (os_strcasecmp(cmd, "accept_mac_file") == 0) {
+ ret = hostapd_ctrl_iface_set_accept_mac(hapd, value);
+ } else if (os_strcasecmp(cmd, "deny_mac_file") == 0) {
+ ret = hostapd_ctrl_iface_set_deny_mac(hapd, value);
} else {
ret = hostapd_set_iface(hapd->iconf, hapd->conf, cmd, value);
}