aboutsummaryrefslogtreecommitdiffstats
path: root/src/ap
diff options
context:
space:
mode:
authorVishal Mahaveer <vishalm@ti.com>2012-12-11 10:28:54 -0600
committerVishal Mahaveer <vishalm@ti.com>2012-12-11 10:28:54 -0600
commit68bd90b2df35d0854416f4f8bb79c5fc073237fa (patch)
treed9f566e78fcb1efd93740a0cdc7dc7bbd01fe713 /src/ap
parent0613a964c52b31d6763fd30dd45521314f3a2429 (diff)
parent4e1835b2ccb4698e8e7022522928317d219bca32 (diff)
downloadexternal_wpa_supplicant_8_ti-68bd90b2df35d0854416f4f8bb79c5fc073237fa.zip
external_wpa_supplicant_8_ti-68bd90b2df35d0854416f4f8bb79c5fc073237fa.tar.gz
external_wpa_supplicant_8_ti-68bd90b2df35d0854416f4f8bb79c5fc073237fa.tar.bz2
Merge commit 'ol_r8.a5.06' into p-jb-mr1-release
Conflicts: wpa_supplicant/wpa_supplicant_template.conf Change-Id: Ifb38077650e8bb6075a17b8f2232f14b704281f1 Signed-off-by: Vishal Mahaveer <vishalm@ti.com>
Diffstat (limited to 'src/ap')
-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,