aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/events.c
diff options
context:
space:
mode:
authorStefan Tomanek <stefan.tomanek@wertarbyte.de>2015-01-05 20:08:49 (GMT)
committerJouni Malinen <j@w1.fi>2015-01-10 15:35:53 (GMT)
commitb83e455451a875ba233b3b8ac29aff8b62f064f2 (patch)
tree37841cc6f6991da2d725e9cab0a3107db08433b9 /wpa_supplicant/events.c
parentb3d6a0a8259002448a29f14855d58fe0a624ab76 (diff)
downloadhostap-b83e455451a875ba233b3b8ac29aff8b62f064f2.zip
hostap-b83e455451a875ba233b3b8ac29aff8b62f064f2.tar.gz
hostap-b83e455451a875ba233b3b8ac29aff8b62f064f2.tar.bz2
Add network specific BSSID black and white lists
This change adds the configuration options "bssid_whitelist" and "bssid_blacklist" used to limit the AP selection of a network to a specified (finite) set or discard certain APs. This can be useful for environments where multiple networks operate using the same SSID and roaming between those is not desired. It is also useful to ignore a faulty or otherwise unwanted AP. Signed-off-by: Stefan Tomanek <stefan.tomanek@wertarbyte.de>
Diffstat (limited to 'wpa_supplicant/events.c')
-rw-r--r--wpa_supplicant/events.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 7f90393..4dd9bc6 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -698,6 +698,20 @@ static int bss_is_ess(struct wpa_bss *bss)
}
+static int addr_in_list(const u8 *addr, const u8 *list, size_t num)
+{
+ size_t i;
+
+ for (i = 0; i < num; i++) {
+ const u8 *a = list + (i * ETH_ALEN);
+
+ if (os_memcmp(a, addr, ETH_ALEN) == 0)
+ return 1;
+ }
+ return 0;
+}
+
+
static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
int i, struct wpa_bss *bss,
struct wpa_ssid *group,
@@ -822,6 +836,24 @@ static struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
continue;
}
+ /* check blacklist */
+ if (ssid->num_bssid_blacklist &&
+ addr_in_list(bss->bssid, ssid->bssid_blacklist,
+ ssid->num_bssid_blacklist)) {
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ " skip - BSSID blacklisted");
+ continue;
+ }
+
+ /* if there is a whitelist, only accept those APs */
+ if (ssid->num_bssid_whitelist &&
+ !addr_in_list(bss->bssid, ssid->bssid_whitelist,
+ ssid->num_bssid_whitelist)) {
+ wpa_dbg(wpa_s, MSG_DEBUG,
+ " skip - BSSID not in whitelist");
+ continue;
+ }
+
if (!wpa_supplicant_ssid_bss_match(wpa_s, ssid, bss))
continue;