Rename wpa_blacklist to wpa_bssid_ignore

This is more accurate name for this functionality of temporarily
ignoring BSSIDs.

Signed-off-by: Jouni Malinen <j@w1.fi>
master
Jouni Malinen 3 years ago
parent b58ac90c38
commit 626fc0dcd0

@ -1113,7 +1113,7 @@ def test_wpas_ctrl_bssid_ignore(dev):
@remote_compatible
def test_wpas_ctrl_bssid_ignore_oom(dev):
"""wpa_supplicant ctrl_iface BSSID_IGNORE and out-of-memory"""
with alloc_fail(dev[0], 1, "wpa_blacklist_add"):
with alloc_fail(dev[0], 1, "wpa_bssid_ignore_add"):
if "FAIL" not in dev[0].request("BSSID_IGNORE aa:bb:cc:dd:ee:ff"):
raise Exception("Unexpected success with allocation failure")

@ -1,6 +1,6 @@
/*
* wpa_supplicant - Temporary BSSID blacklist
* Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
* wpa_supplicant - List of temporarily ignored BSSIDs
* Copyright (c) 2003-2021, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
@ -13,29 +13,29 @@
#include "blacklist.h"
/**
* wpa_blacklist_get - Get the blacklist entry for a BSSID
* wpa_bssid_ignore_get - Get the ignore list entry for a BSSID
* @wpa_s: Pointer to wpa_supplicant data
* @bssid: BSSID
* Returns: Matching blacklist entry for the BSSID or %NULL if not found
* Returns: Matching entry for the BSSID or %NULL if not found
*/
struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s,
const u8 *bssid)
struct wpa_bssid_ignore * wpa_bssid_ignore_get(struct wpa_supplicant *wpa_s,
const u8 *bssid)
{
struct wpa_blacklist *e;
struct wpa_bssid_ignore *e;
if (wpa_s == NULL || bssid == NULL)
return NULL;
if (wpa_s->current_ssid &&
wpa_s->current_ssid->was_recently_reconfigured) {
wpa_blacklist_clear(wpa_s);
wpa_bssid_ignore_clear(wpa_s);
wpa_s->current_ssid->was_recently_reconfigured = false;
return NULL;
}
wpa_blacklist_update(wpa_s);
wpa_bssid_ignore_update(wpa_s);
e = wpa_s->blacklist;
e = wpa_s->bssid_ignore;
while (e) {
if (os_memcmp(e->bssid, bssid, ETH_ALEN) == 0)
return e;
@ -47,33 +47,33 @@ struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s,
/**
* wpa_blacklist_add - Add an BSSID to the blacklist
* wpa_bssid_ignore_add - Add an BSSID to the ignore list
* @wpa_s: Pointer to wpa_supplicant data
* @bssid: BSSID to be added to the blacklist
* Returns: Current blacklist count on success, -1 on failure
* @bssid: BSSID to be added to the ignore list
* Returns: Current ignore list count on success, -1 on failure
*
* This function adds the specified BSSID to the blacklist or increases the
* blacklist count if the BSSID was already listed. It should be called when
* This function adds the specified BSSID to the ignore list or increases the
* ignore count if the BSSID was already listed. It should be called when
* an association attempt fails either due to the selected BSS rejecting
* association or due to timeout.
*
* This blacklist is used to force %wpa_supplicant to go through all available
* This ignore list is used to force %wpa_supplicant to go through all available
* BSSes before retrying to associate with an BSS that rejected or timed out
* association. It does not prevent the listed BSS from being used; it only
* changes the order in which they are tried.
*/
int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid)
int wpa_bssid_ignore_add(struct wpa_supplicant *wpa_s, const u8 *bssid)
{
struct wpa_blacklist *e;
struct wpa_bssid_ignore *e;
struct os_reltime now;
if (wpa_s == NULL || bssid == NULL)
return -1;
e = wpa_blacklist_get(wpa_s, bssid);
e = wpa_bssid_ignore_get(wpa_s, bssid);
os_get_reltime(&now);
if (e) {
e->blacklist_start = now;
e->start = now;
e->count++;
if (e->count > 5)
e->timeout_secs = 1800;
@ -86,7 +86,7 @@ int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid)
else
e->timeout_secs = 10;
wpa_printf(MSG_INFO, "BSSID " MACSTR
" blacklist count incremented to %d, blacklisting for %d seconds",
" ignore list count incremented to %d, ignoring for %d seconds",
MAC2STR(bssid), e->count, e->timeout_secs);
return e->count;
}
@ -97,11 +97,11 @@ int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid)
os_memcpy(e->bssid, bssid, ETH_ALEN);
e->count = 1;
e->timeout_secs = 10;
e->blacklist_start = now;
e->next = wpa_s->blacklist;
wpa_s->blacklist = e;
e->start = now;
e->next = wpa_s->bssid_ignore;
wpa_s->bssid_ignore = e;
wpa_printf(MSG_DEBUG, "Added BSSID " MACSTR
" into blacklist, blacklisting for %d seconds",
" into ignore list, ignoring for %d seconds",
MAC2STR(bssid), e->timeout_secs);
return e->count;
@ -109,28 +109,28 @@ int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid)
/**
* wpa_blacklist_del - Remove an BSSID from the blacklist
* wpa_bssid_ignore_del - Remove an BSSID from the ignore list
* @wpa_s: Pointer to wpa_supplicant data
* @bssid: BSSID to be removed from the blacklist
* @bssid: BSSID to be removed from the ignore list
* Returns: 0 on success, -1 on failure
*/
int wpa_blacklist_del(struct wpa_supplicant *wpa_s, const u8 *bssid)
int wpa_bssid_ignore_del(struct wpa_supplicant *wpa_s, const u8 *bssid)
{
struct wpa_blacklist *e, *prev = NULL;
struct wpa_bssid_ignore *e, *prev = NULL;
if (wpa_s == NULL || bssid == NULL)
return -1;
e = wpa_s->blacklist;
e = wpa_s->bssid_ignore;
while (e) {
if (os_memcmp(e->bssid, bssid, ETH_ALEN) == 0) {
if (prev == NULL) {
wpa_s->blacklist = e->next;
wpa_s->bssid_ignore = e->next;
} else {
prev->next = e->next;
}
wpa_printf(MSG_DEBUG, "Removed BSSID " MACSTR " from "
"blacklist", MAC2STR(bssid));
wpa_printf(MSG_DEBUG, "Removed BSSID " MACSTR
" from ignore list", MAC2STR(bssid));
os_free(e);
return 0;
}
@ -142,75 +142,75 @@ int wpa_blacklist_del(struct wpa_supplicant *wpa_s, const u8 *bssid)
/**
* wpa_blacklist_is_blacklisted - Check the blacklist status of a BSS
* wpa_bssid_ignore_is_listed - Check whether a BSSID is ignored temporarily
* @wpa_s: Pointer to wpa_supplicant data
* @bssid: BSSID to be checked
* Returns: count if BSS is currently considered to be blacklisted, 0 otherwise
* Returns: count if BSS is currently considered to be ignored, 0 otherwise
*/
int wpa_blacklist_is_blacklisted(struct wpa_supplicant *wpa_s, const u8 *bssid)
int wpa_bssid_ignore_is_listed(struct wpa_supplicant *wpa_s, const u8 *bssid)
{
struct wpa_blacklist *e;
struct wpa_bssid_ignore *e;
struct os_reltime now;
e = wpa_blacklist_get(wpa_s, bssid);
e = wpa_bssid_ignore_get(wpa_s, bssid);
if (!e)
return 0;
os_get_reltime(&now);
if (os_reltime_expired(&now, &e->blacklist_start, e->timeout_secs))
if (os_reltime_expired(&now, &e->start, e->timeout_secs))
return 0;
return e->count;
}
/**
* wpa_blacklist_clear - Clear the blacklist of all entries
* wpa_bssid_ignore_clear - Clear the ignore list of all entries
* @wpa_s: Pointer to wpa_supplicant data
*/
void wpa_blacklist_clear(struct wpa_supplicant *wpa_s)
void wpa_bssid_ignore_clear(struct wpa_supplicant *wpa_s)
{
struct wpa_blacklist *e, *prev;
struct wpa_bssid_ignore *e, *prev;
e = wpa_s->blacklist;
wpa_s->blacklist = NULL;
e = wpa_s->bssid_ignore;
wpa_s->bssid_ignore = NULL;
while (e) {
prev = e;
e = e->next;
wpa_printf(MSG_DEBUG, "Removed BSSID " MACSTR " from "
"blacklist (clear)", MAC2STR(prev->bssid));
wpa_printf(MSG_DEBUG, "Removed BSSID " MACSTR
" from ignore list (clear)", MAC2STR(prev->bssid));
os_free(prev);
}
}
/**
* wpa_blacklist_update - Update the entries in the blacklist,
* wpa_bssid_ignore_update - Update the entries in the ignore list,
* deleting entries that have been expired for over an hour.
* @wpa_s: Pointer to wpa_supplicant data
*/
void wpa_blacklist_update(struct wpa_supplicant *wpa_s)
void wpa_bssid_ignore_update(struct wpa_supplicant *wpa_s)
{
struct wpa_blacklist *e, *prev = NULL;
struct wpa_bssid_ignore *e, *prev = NULL;
struct os_reltime now;
if (!wpa_s)
return;
e = wpa_s->blacklist;
e = wpa_s->bssid_ignore;
os_get_reltime(&now);
while (e) {
if (os_reltime_expired(&now, &e->blacklist_start,
if (os_reltime_expired(&now, &e->start,
e->timeout_secs + 3600)) {
struct wpa_blacklist *to_delete = e;
struct wpa_bssid_ignore *to_delete = e;
if (prev) {
prev->next = e->next;
e = prev->next;
} else {
wpa_s->blacklist = e->next;
e = wpa_s->blacklist;
wpa_s->bssid_ignore = e->next;
e = wpa_s->bssid_ignore;
}
wpa_printf(MSG_INFO, "Removed BSSID " MACSTR
" from blacklist (expired)",
" from ignore list (expired)",
MAC2STR(to_delete->bssid));
os_free(to_delete);
} else {

@ -1,33 +1,33 @@
/*
* wpa_supplicant - Temporary BSSID blacklist
* Copyright (c) 2003-2007, Jouni Malinen <j@w1.fi>
* wpa_supplicant - List of temporarily ignored BSSIDs
* Copyright (c) 2003-2021, Jouni Malinen <j@w1.fi>
*
* This software may be distributed under the terms of the BSD license.
* See README for more details.
*/
#ifndef BLACKLIST_H
#define BLACKLIST_H
#ifndef BSSID_IGNORE_H
#define BSSID_IGNORE_H
struct wpa_blacklist {
struct wpa_blacklist *next;
struct wpa_bssid_ignore {
struct wpa_bssid_ignore *next;
u8 bssid[ETH_ALEN];
int count;
/* Time of most recent blacklist event. */
struct os_reltime blacklist_start;
/* Time of the most recent trigger to ignore this BSSID. */
struct os_reltime start;
/*
* Number of seconds after blacklist_start that the entry will be
* considered blacklisted.
* Number of seconds after start that the entey will be considered
* valid.
*/
int timeout_secs;
};
struct wpa_blacklist * wpa_blacklist_get(struct wpa_supplicant *wpa_s,
struct wpa_bssid_ignore * wpa_bssid_ignore_get(struct wpa_supplicant *wpa_s,
const u8 *bssid);
int wpa_blacklist_add(struct wpa_supplicant *wpa_s, const u8 *bssid);
int wpa_blacklist_del(struct wpa_supplicant *wpa_s, const u8 *bssid);
int wpa_blacklist_is_blacklisted(struct wpa_supplicant *wpa_s, const u8 *bssid);
void wpa_blacklist_clear(struct wpa_supplicant *wpa_s);
void wpa_blacklist_update(struct wpa_supplicant *wpa_s);
int wpa_bssid_ignore_add(struct wpa_supplicant *wpa_s, const u8 *bssid);
int wpa_bssid_ignore_del(struct wpa_supplicant *wpa_s, const u8 *bssid);
int wpa_bssid_ignore_is_listed(struct wpa_supplicant *wpa_s, const u8 *bssid);
void wpa_bssid_ignore_clear(struct wpa_supplicant *wpa_s);
void wpa_bssid_ignore_update(struct wpa_supplicant *wpa_s);
#endif /* BLACKLIST_H */
#endif /* BSSID_IGNORE_H */

@ -2559,7 +2559,7 @@ static int wpa_supplicant_ctrl_iface_bssid_ignore(struct wpa_supplicant *wpa_s,
size_t buflen)
{
u8 bssid[ETH_ALEN];
struct wpa_blacklist *e;
struct wpa_bssid_ignore *e;
char *pos, *end;
int ret;
@ -2567,7 +2567,7 @@ static int wpa_supplicant_ctrl_iface_bssid_ignore(struct wpa_supplicant *wpa_s,
if (*cmd == '\0') {
pos = buf;
end = buf + buflen;
e = wpa_s->blacklist;
e = wpa_s->bssid_ignore;
while (e) {
ret = os_snprintf(pos, end - pos, MACSTR "\n",
MAC2STR(e->bssid));
@ -2581,7 +2581,7 @@ static int wpa_supplicant_ctrl_iface_bssid_ignore(struct wpa_supplicant *wpa_s,
cmd++;
if (os_strncmp(cmd, "clear", 5) == 0) {
wpa_blacklist_clear(wpa_s);
wpa_bssid_ignore_clear(wpa_s);
os_memcpy(buf, "OK\n", 3);
return 3;
}
@ -2596,10 +2596,10 @@ static int wpa_supplicant_ctrl_iface_bssid_ignore(struct wpa_supplicant *wpa_s,
* Add the BSSID twice, so its count will be 2, causing it to be
* skipped when processing scan results.
*/
ret = wpa_blacklist_add(wpa_s, bssid);
ret = wpa_bssid_ignore_add(wpa_s, bssid);
if (ret < 0)
return -1;
ret = wpa_blacklist_add(wpa_s, bssid);
ret = wpa_bssid_ignore_add(wpa_s, bssid);
if (ret < 0)
return -1;
os_memcpy(buf, "OK\n", 3);
@ -8434,7 +8434,7 @@ static void wpa_supplicant_ctrl_iface_flush(struct wpa_supplicant *wpa_s)
wpa_s->consecutive_conn_failures = 0;
wpa_drv_radio_disable(wpa_s, 0);
wpa_blacklist_clear(wpa_s);
wpa_bssid_ignore_clear(wpa_s);
wpa_supplicant_ctrl_iface_remove_network(wpa_s, "all");
wpa_supplicant_ctrl_iface_remove_cred(wpa_s, "all");
wpa_config_flush_blobs(wpa_s->conf);

@ -1702,7 +1702,8 @@ DBusMessage * wpas_dbus_handler_reassociate(DBusMessage *message,
* Returns: NULL
*
* Handler function for notifying system there will be a expected disconnect.
* This will prevent wpa_supplicant from adding blacklists upon next disconnect..
* This will prevent wpa_supplicant from adding the BSSID to the ignore list
* upon next disconnect.
*/
DBusMessage * wpas_dbus_handler_expect_disconnect(DBusMessage *message,
struct wpa_global *global)

@ -1086,7 +1086,7 @@ static int disabled_freq(struct wpa_supplicant *wpa_s, int freq)
static bool wpa_scan_res_ok(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
const u8 *match_ssid, size_t match_ssid_len,
struct wpa_bss *bss, int blacklist_count,
struct wpa_bss *bss, int bssid_ignore_count,
bool debug_print);
@ -1118,7 +1118,7 @@ static bool sae_pk_acceptable_bss_with_pk(struct wpa_supplicant *wpa_s,
if (bss->est_throughput < 2000)
return false;
count = wpa_blacklist_is_blacklisted(wpa_s, bss->bssid);
count = wpa_bssid_ignore_is_listed(wpa_s, bss->bssid);
if (wpa_scan_res_ok(wpa_s, ssid, match_ssid, match_ssid_len,
bss, count, 0))
return true;
@ -1131,7 +1131,7 @@ static bool sae_pk_acceptable_bss_with_pk(struct wpa_supplicant *wpa_s,
static bool wpa_scan_res_ok(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
const u8 *match_ssid, size_t match_ssid_len,
struct wpa_bss *bss, int blacklist_count,
struct wpa_bss *bss, int bssid_ignore_count,
bool debug_print)
{
int res;
@ -1179,10 +1179,10 @@ static bool wpa_scan_res_ok(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
}
#ifdef CONFIG_WPS
if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && blacklist_count) {
if ((ssid->key_mgmt & WPA_KEY_MGMT_WPS) && bssid_ignore_count) {
if (debug_print)
wpa_dbg(wpa_s, MSG_DEBUG,
" skip - blacklisted (WPS)");
" skip - BSSID ignored (WPS)");
return false;
}
@ -1478,7 +1478,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
int osen;
const u8 *match_ssid;
size_t match_ssid_len;
int blacklist_count;
int bssid_ignore_count;
ie = wpa_bss_get_vendor_ie(bss, WPA_IE_VENDOR_TYPE);
wpa_ie_len = ie ? ie[1] : 0;
@ -1504,13 +1504,13 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
osen ? " osen=1" : "");
}
blacklist_count = wpa_blacklist_is_blacklisted(wpa_s, bss->bssid);
if (blacklist_count) {
bssid_ignore_count = wpa_bssid_ignore_is_listed(wpa_s, bss->bssid);
if (bssid_ignore_count) {
int limit = 1;
if (wpa_supplicant_enabled_networks(wpa_s) == 1) {
/*
* When only a single network is enabled, we can
* trigger blacklisting on the first failure. This
* trigger BSSID ignoring on the first failure. This
* should not be done with multiple enabled networks to
* avoid getting forced to move into a worse ESS on
* single error if there are no other BSSes of the
@ -1518,11 +1518,11 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
*/
limit = 0;
}
if (blacklist_count > limit) {
if (bssid_ignore_count > limit) {
if (debug_print) {
wpa_dbg(wpa_s, MSG_DEBUG,
" skip - blacklisted (count=%d limit=%d)",
blacklist_count, limit);
" skip - BSSID ignored (count=%d limit=%d)",
bssid_ignore_count, limit);
}
return NULL;
}
@ -1558,7 +1558,7 @@ struct wpa_ssid * wpa_scan_res_match(struct wpa_supplicant *wpa_s,
for (ssid = group; ssid; ssid = only_first_ssid ? NULL : ssid->pnext) {
if (wpa_scan_res_ok(wpa_s, ssid, match_ssid, match_ssid_len,
bss, blacklist_count, debug_print))
bss, bssid_ignore_count, debug_print))
return ssid;
}
@ -1660,12 +1660,12 @@ struct wpa_bss * wpa_supplicant_pick_network(struct wpa_supplicant *wpa_s,
break;
}
if (selected == NULL && wpa_s->blacklist &&
if (selected == NULL && wpa_s->bssid_ignore &&
!wpa_s->countermeasures) {
wpa_dbg(wpa_s, MSG_DEBUG, "No APs found - clear "
"blacklist and try again");
wpa_blacklist_clear(wpa_s);
wpa_s->blacklist_cleared++;
wpa_dbg(wpa_s, MSG_DEBUG,
"No APs found - clear BSSID ignore list and try again");
wpa_bssid_ignore_clear(wpa_s);
wpa_s->bssid_ignore_cleared = true;
} else if (selected == NULL)
break;
}
@ -3578,7 +3578,7 @@ wpa_supplicant_event_michael_mic_failure(struct wpa_supplicant *wpa_s,
/* initialize countermeasures */
wpa_s->countermeasures = 1;
wpa_blacklist_add(wpa_s, wpa_s->bssid);
wpa_bssid_ignore_add(wpa_s, wpa_s->bssid);
wpa_msg(wpa_s, MSG_WARNING, "TKIP countermeasures started");

@ -1299,8 +1299,8 @@ void hs20_rx_deauth_imminent_notice(struct wpa_supplicant *wpa_s, u8 code,
code, reauth_delay, url);
if (code == HS20_DEAUTH_REASON_CODE_BSS) {
wpa_printf(MSG_DEBUG, "HS 2.0: Add BSS to blacklist");
wpa_blacklist_add(wpa_s, wpa_s->bssid);
wpa_printf(MSG_DEBUG, "HS 2.0: Add BSS to ignore list");
wpa_bssid_ignore_add(wpa_s, wpa_s->bssid);
/* TODO: For now, disable full ESS since some drivers may not
* support disabling per BSS. */
if (wpa_s->current_ssid) {

@ -223,7 +223,7 @@ static void wpa_supplicant_timeout(void *eloop_ctx, void *timeout_ctx)
bssid = wpa_s->pending_bssid;
wpa_msg(wpa_s, MSG_INFO, "Authentication with " MACSTR " timed out.",
MAC2STR(bssid));
wpa_blacklist_add(wpa_s, bssid);
wpa_bssid_ignore_add(wpa_s, bssid);
wpa_sm_notify_disassoc(wpa_s->wpa);
wpa_supplicant_deauthenticate(wpa_s, WLAN_REASON_DEAUTH_LEAVING);
wpa_s->reassociate = 1;
@ -291,7 +291,7 @@ void wpa_supplicant_cancel_auth_timeout(struct wpa_supplicant *wpa_s)
{
wpa_dbg(wpa_s, MSG_DEBUG, "Cancelling authentication timeout");
eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
wpa_blacklist_del(wpa_s, wpa_s->bssid);
wpa_bssid_ignore_del(wpa_s, wpa_s->bssid);
os_free(wpa_s->last_con_fail_realm);
wpa_s->last_con_fail_realm = NULL;
wpa_s->last_con_fail_realm_len = 0;
@ -578,7 +578,7 @@ static void wpa_supplicant_cleanup(struct wpa_supplicant *wpa_s)
wpa_s->ptksa = NULL;
wpa_sm_deinit(wpa_s->wpa);
wpa_s->wpa = NULL;
wpa_blacklist_clear(wpa_s);
wpa_bssid_ignore_clear(wpa_s);
#ifdef CONFIG_PASN
wpas_pasn_auth_stop(wpa_s);
@ -1200,7 +1200,7 @@ int wpa_supplicant_reload_configuration(struct wpa_supplicant *wpa_s)
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s, 0, 0);
}
wpa_blacklist_clear(wpa_s);
wpa_bssid_ignore_clear(wpa_s);
wpa_dbg(wpa_s, MSG_DEBUG, "Reconfiguration completed");
return 0;
}
@ -7388,7 +7388,7 @@ static int * get_bss_freqs_in_ess(struct wpa_supplicant *wpa_s)
continue;
if (bss->ssid_len == cbss->ssid_len &&
os_memcmp(bss->ssid, cbss->ssid, bss->ssid_len) == 0 &&
!wpa_blacklist_is_blacklisted(wpa_s, bss->bssid)) {
!wpa_bssid_ignore_is_listed(wpa_s, bss->bssid)) {
add_freq(freqs, &num_freqs, bss->freq);
if (num_freqs == max_freqs)
break;
@ -7418,7 +7418,7 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
eloop_cancel_timeout(wpa_supplicant_timeout, wpa_s, NULL);
/*
* There is no point in blacklisting the AP if this event is
* There is no point in ignoring the AP temporarily if this event is
* generated based on local request to disconnect.
*/
if (wpa_s->own_disconnect_req || wpa_s->own_reconnect_req) {
@ -7435,13 +7435,13 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
}
/*
* Add the failed BSSID into the blacklist and speed up next scan
* Add the failed BSSID into the ignore list and speed up next scan
* attempt if there could be other APs that could accept association.
*/
count = wpa_blacklist_add(wpa_s, bssid);
count = wpa_bssid_ignore_add(wpa_s, bssid);
if (count == 1 && wpa_s->current_bss) {
/*
* This BSS was not in the blacklist before. If there is
* This BSS was not in the ignore list before. If there is
* another BSS available for the same ESS, we should try that
* next. Otherwise, we may as well try this one once more
* before allowing other, likely worse, ESSes to be considered.
@ -7450,7 +7450,7 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid)
if (freqs) {
wpa_dbg(wpa_s, MSG_DEBUG, "Another BSS in this ESS "
"has been seen; try it next");
wpa_blacklist_add(wpa_s, bssid);
wpa_bssid_ignore_add(wpa_s, bssid);
/*
* On the next scan, go through only the known channels
* used in this ESS based on previous scans to speed up

@ -725,7 +725,7 @@ struct wpa_supplicant {
unsigned int keys_cleared; /* bitfield of key indexes that the driver is
* known not to be configured with a key */
struct wpa_blacklist *blacklist;
struct wpa_bssid_ignore *bssid_ignore;
/* Number of connection failures since last successful connection */
unsigned int consecutive_conn_failures;
@ -833,7 +833,7 @@ struct wpa_supplicant {
struct wps_er *wps_er;
unsigned int wps_run;
struct os_reltime wps_pin_start_time;
int blacklist_cleared;
bool bssid_ignore_cleared;
struct wpabuf *pending_eapol_rx;
struct os_reltime pending_eapol_rx_time;

@ -14,74 +14,74 @@
#include "blacklist.h"
static int wpas_blacklist_module_tests(void)
static int wpas_bssid_ignore_module_tests(void)
{
struct wpa_supplicant wpa_s;
int ret = -1;
os_memset(&wpa_s, 0, sizeof(wpa_s));
wpa_blacklist_clear(&wpa_s);
wpa_bssid_ignore_clear(&wpa_s);
if (wpa_blacklist_get(NULL, NULL) != NULL ||
wpa_blacklist_get(NULL, (u8 *) "123456") != NULL ||
wpa_blacklist_get(&wpa_s, NULL) != NULL ||
wpa_blacklist_get(&wpa_s, (u8 *) "123456") != NULL)
if (wpa_bssid_ignore_get(NULL, NULL) != NULL ||
wpa_bssid_ignore_get(NULL, (u8 *) "123456") != NULL ||
wpa_bssid_ignore_get(&wpa_s, NULL) != NULL ||
wpa_bssid_ignore_get(&wpa_s, (u8 *) "123456") != NULL)
goto fail;
if (wpa_blacklist_add(NULL, NULL) == 0 ||
wpa_blacklist_add(NULL, (u8 *) "123456") == 0 ||
wpa_blacklist_add(&wpa_s, NULL) == 0)
if (wpa_bssid_ignore_add(NULL, NULL) == 0 ||
wpa_bssid_ignore_add(NULL, (u8 *) "123456") == 0 ||
wpa_bssid_ignore_add(&wpa_s, NULL) == 0)
goto fail;
if (wpa_blacklist_del(NULL, NULL) == 0 ||
wpa_blacklist_del(NULL, (u8 *) "123456") == 0 ||
wpa_blacklist_del(&wpa_s, NULL) == 0 ||
wpa_blacklist_del(&wpa_s, (u8 *) "123456") == 0)
if (wpa_bssid_ignore_del(NULL, NULL) == 0 ||
wpa_bssid_ignore_del(NULL, (u8 *) "123456") == 0 ||
wpa_bssid_ignore_del(&wpa_s, NULL) == 0 ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "123456") == 0)
goto fail;
if (wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "333333") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "444444") < 0 ||
wpa_blacklist_del(&wpa_s, (u8 *) "333333") < 0 ||
wpa_blacklist_del(&wpa_s, (u8 *) "xxxxxx") == 0 ||
wpa_blacklist_get(&wpa_s, (u8 *) "xxxxxx") != NULL ||
wpa_blacklist_get(&wpa_s, (u8 *) "111111") == NULL ||
wpa_blacklist_get(&wpa_s, (u8 *) "222222") == NULL ||
wpa_blacklist_get(&wpa_s, (u8 *) "444444") == NULL ||
wpa_blacklist_del(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_del(&wpa_s, (u8 *) "222222") < 0 ||
wpa_blacklist_del(&wpa_s, (u8 *) "444444") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "333333") < 0)
if (wpa_bssid_ignore_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "333333") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "444444") < 0 ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "333333") < 0 ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "xxxxxx") == 0 ||
wpa_bssid_ignore_get(&wpa_s, (u8 *) "xxxxxx") != NULL ||
wpa_bssid_ignore_get(&wpa_s, (u8 *) "111111") == NULL ||
wpa_bssid_ignore_get(&wpa_s, (u8 *) "222222") == NULL ||
wpa_bssid_ignore_get(&wpa_s, (u8 *) "444444") == NULL ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "111111") < 0 ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "222222") < 0 ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "444444") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "333333") < 0)
goto fail;
wpa_blacklist_clear(&wpa_s);
wpa_bssid_ignore_clear(&wpa_s);
if (wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "333333") < 0 ||
wpa_blacklist_add(&wpa_s, (u8 *) "444444") < 0 ||
!wpa_blacklist_is_blacklisted(&wpa_s, (u8 *) "111111") ||
wpa_blacklist_del(&wpa_s, (u8 *) "111111") < 0 ||
wpa_blacklist_is_blacklisted(&wpa_s, (u8 *) "111111") ||
wpa_blacklist_add(&wpa_s, (u8 *) "111111") < 0)
if (wpa_bssid_ignore_add(&wpa_s, (u8 *) "111111") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "222222") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "333333") < 0 ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "444444") < 0 ||
!wpa_bssid_ignore_is_listed(&wpa_s, (u8 *) "111111") ||
wpa_bssid_ignore_del(&wpa_s, (u8 *) "111111") < 0 ||
wpa_bssid_ignore_is_listed(&wpa_s, (u8 *) "111111") ||
wpa_bssid_ignore_add(&wpa_s, (u8 *) "111111") < 0)
goto fail;
wpa_blacklist_update(&wpa_s);
wpa_bssid_ignore_update(&wpa_s);
if (!wpa_blacklist_is_blacklisted(&wpa_s, (u8 *) "111111"))
if (!wpa_bssid_ignore_is_listed(&wpa_s, (u8 *) "111111"))
goto fail;
ret = 0;
fail:
wpa_blacklist_clear(&wpa_s);
wpa_bssid_ignore_clear(&wpa_s);
if (ret)
wpa_printf(MSG_ERROR, "blacklist module test failure");
wpa_printf(MSG_ERROR, "bssid_ignore module test failure");
return ret;
}
@ -93,7 +93,7 @@ int wpas_module_tests(void)
wpa_printf(MSG_INFO, "wpa_supplicant module tests");
if (wpas_blacklist_module_tests() < 0)
if (wpas_bssid_ignore_module_tests() < 0)
ret = -1;
#ifdef CONFIG_WPS

@ -94,14 +94,14 @@ int wpas_wps_eapol_cb(struct wpa_supplicant *wpa_s)
wpa_printf(MSG_DEBUG, "WPS: PIN registration with " MACSTR
" did not succeed - continue trying to find "
"suitable AP", MAC2STR(bssid));
wpa_blacklist_add(wpa_s, bssid);
wpa_bssid_ignore_add(wpa_s, bssid);
wpa_supplicant_deauthenticate(wpa_s,
WLAN_REASON_DEAUTH_LEAVING);
wpa_s->reassociate = 1;
wpa_supplicant_req_scan(wpa_s,
wpa_s->blacklist_cleared ? 5 : 0, 0);
wpa_s->blacklist_cleared = 0;
wpa_s->bssid_ignore_cleared ? 5 : 0, 0);
wpa_s->bssid_ignore_cleared = false;
return 1;
}
@ -1139,7 +1139,7 @@ static void wpas_wps_reassoc(struct wpa_supplicant *wpa_s,
wpa_s->scan_runs = 0;
wpa_s->normal_scans = 0;
wpa_s->wps_success = 0;
wpa_s->blacklist_cleared = 0;
wpa_s->bssid_ignore_cleared = false;
wpa_supplicant_cancel_sched_scan(wpa_s);
wpa_supplicant_req_scan(wpa_s, 0, 0);
@ -2883,10 +2883,11 @@ static void wpas_wps_dump_ap_info(struct wpa_supplicant *wpa_s)
for (i = 0; i < wpa_s->num_wps_ap; i++) {
struct wps_ap_info *ap = &wpa_s->wps_ap[i];
struct wpa_blacklist *e = wpa_blacklist_get(wpa_s, ap->bssid);
struct wpa_bssid_ignore *e = wpa_bssid_ignore_get(wpa_s,
ap->bssid);
wpa_printf(MSG_DEBUG, "WPS: AP[%d] " MACSTR " type=%d "
"tries=%d last_attempt=%d sec ago blacklist=%d",
"tries=%d last_attempt=%d sec ago bssid_ignore=%d",
(int) i, MAC2STR(ap->bssid), ap->type, ap->tries,
ap->last_attempt.sec > 0 ?
(int) now.sec - (int) ap->last_attempt.sec : -1,
@ -2948,7 +2949,7 @@ static void wpas_wps_update_ap_info_bss(struct wpa_supplicant *wpa_s,
MAC2STR(res->bssid), ap->type, type);
ap->type = type;
if (type != WPS_AP_NOT_SEL_REG)
wpa_blacklist_del(wpa_s, ap->bssid);
wpa_bssid_ignore_del(wpa_s, ap->bssid);
}
ap->pbc_active = pbc_active;
if (uuid)

Loading…
Cancel
Save