aboutsummaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-rw-r--r--src/ap/hostapd.c56
-rw-r--r--src/ap/hostapd.h3
2 files changed, 59 insertions, 0 deletions
diff --git a/src/ap/hostapd.c b/src/ap/hostapd.c
index 4e06808..ac9ef26 100644
--- a/src/ap/hostapd.c
+++ b/src/ap/hostapd.c
@@ -1137,3 +1137,59 @@ hostapd_channel_data *hostapd_get_valid_channel(struct hostapd_data *hapd,
wpa_printf(MSG_WARNING, "Could't get requested channel");
return NULL;
}
+
+void hostapd_macaddr_acl_accept_sta(struct hostapd_data *hapd)
+{
+ struct sta_info *sta = NULL;
+
+ if (hapd->conf->macaddr_acl != DENY_UNLESS_ACCEPTED)
+ return;
+
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ if (!hostapd_maclist_found(hapd->conf->accept_mac,
+ hapd->conf->num_accept_mac, sta->addr, NULL)) {
+ hostapd_drv_sta_deauth(hapd, sta->addr,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
+ ap_sta_deauthenticate(hapd, sta,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
+ }
+ }
+}
+
+void hostapd_macaddr_acl_deny_sta(struct hostapd_data *hapd)
+{
+ struct sta_info *sta = NULL;
+
+ if (hapd->conf->macaddr_acl != ACCEPT_UNLESS_DENIED)
+ return;
+
+ for (sta = hapd->sta_list; sta; sta = sta->next) {
+ if (hostapd_maclist_found(hapd->conf->deny_mac,
+ hapd->conf->num_deny_mac, sta->addr, NULL)) {
+ hostapd_drv_sta_deauth(hapd, sta->addr,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
+ ap_sta_deauthenticate(hapd, sta,
+ WLAN_REASON_PREV_AUTH_NOT_VALID);
+ }
+ }
+}
+
+int hostapd_macaddr_acl_command(struct hostapd_data *hapd, char *cmd)
+{
+ int ret = 0;
+
+ if (os_strcasecmp(cmd, "accept") == 0) {
+ wpa_printf(MSG_DEBUG, "Changing to access control accept list");
+ hapd->conf->macaddr_acl = DENY_UNLESS_ACCEPTED;
+ hostapd_macaddr_acl_accept_sta(hapd);
+ } else if (os_strcasecmp(cmd, "deny") == 0) {
+ wpa_printf(MSG_DEBUG, "Changing to accees control deny list");
+ hapd->conf->macaddr_acl = ACCEPT_UNLESS_DENIED;
+ hostapd_macaddr_acl_deny_sta(hapd);
+ } else {
+ wpa_printf(MSG_ERROR, "Unknown acl command");
+ ret = -1;
+ }
+
+ return ret;
+}
diff --git a/src/ap/hostapd.h b/src/ap/hostapd.h
index feea42d..6193200 100644
--- a/src/ap/hostapd.h
+++ b/src/ap/hostapd.h
@@ -276,6 +276,9 @@ void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
struct
hostapd_channel_data *hostapd_get_valid_channel(struct hostapd_data *hapd,
int req_freq);
+void hostapd_macaddr_acl_accept_sta(struct hostapd_data *hapd);
+void hostapd_macaddr_acl_deny_sta(struct hostapd_data *hapd);
+int hostapd_macaddr_acl_command(struct hostapd_data *hapd, char *cmd);
/* utils.c */
int hostapd_register_probereq_cb(struct hostapd_data *hapd,