aboutsummaryrefslogtreecommitdiffstats
path: root/hostapd
diff options
context:
space:
mode:
Diffstat (limited to 'hostapd')
-rw-r--r--hostapd/config_file.c4
-rw-r--r--hostapd/config_file.h2
-rw-r--r--hostapd/ctrl_iface.c42
3 files changed, 46 insertions, 2 deletions
diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index 59745fa..41dd242 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -116,8 +116,8 @@ static int hostapd_acl_comp(const void *a, const void *b)
}
-static int hostapd_config_read_maclist(const char *fname,
- struct mac_acl_entry **acl, int *num)
+int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num)
{
FILE *f;
char buf[128], *pos;
diff --git a/hostapd/config_file.h b/hostapd/config_file.h
index fba57b8..61759f3 100644
--- a/hostapd/config_file.h
+++ b/hostapd/config_file.h
@@ -13,5 +13,7 @@ struct hostapd_config * hostapd_config_read(const char *fname);
int hostapd_set_iface(struct hostapd_config *conf,
struct hostapd_bss_config *bss, char *field,
char *value);
+int hostapd_config_read_maclist(const char *fname,
+ struct mac_acl_entry **acl, int *num);
#endif /* CONFIG_FILE_H */
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);
}