Rename network profiles parameters for ignoring/accepted BSSIDs

Rename the network profile parameters bssid_blacklist and
bssid_whitelist to bssid_ignore and bssid_accept to use more specific
names for the configuration of which BSSs are ignored/accepted during
BSS selection. The old parameter names are maintained as aliases for the
new names to avoid breaking compatibility with previously used
configurations.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2021-02-07 16:10:18 +02:00
parent 6a12acbb78
commit 752b1c6081
7 changed files with 96 additions and 40 deletions

View file

@ -442,47 +442,99 @@ static char * wpa_config_write_bssid_hint(const struct parse_data *data,
#endif /* NO_CONFIG_WRITE */
static int wpa_config_parse_bssid_ignore(const struct parse_data *data,
struct wpa_ssid *ssid, int line,
const char *value)
{
return wpa_config_parse_addr_list(data, line, value,
&ssid->bssid_ignore,
&ssid->num_bssid_ignore,
"bssid_ignore", 1, 1);
}
/* deprecated alias for bssid_ignore for backwards compatibility */
static int wpa_config_parse_bssid_blacklist(const struct parse_data *data,
struct wpa_ssid *ssid, int line,
const char *value)
{
return wpa_config_parse_addr_list(data, line, value,
&ssid->bssid_blacklist,
&ssid->num_bssid_blacklist,
"bssid_blacklist", 1, 1);
&ssid->bssid_ignore,
&ssid->num_bssid_ignore,
"bssid_ignore", 1, 1);
}
#ifndef NO_CONFIG_WRITE
static char * wpa_config_write_bssid_ignore(const struct parse_data *data,
struct wpa_ssid *ssid)
{
return wpa_config_write_addr_list(data, ssid->bssid_ignore,
ssid->num_bssid_ignore,
"bssid_ignore");
}
/* deprecated alias for bssid_ignore for backwards compatibility */
static char * wpa_config_write_bssid_blacklist(const struct parse_data *data,
struct wpa_ssid *ssid)
{
return wpa_config_write_addr_list(data, ssid->bssid_blacklist,
ssid->num_bssid_blacklist,
"bssid_blacklist");
return wpa_config_write_addr_list(data, ssid->bssid_ignore,
ssid->num_bssid_ignore,
"bssid_ignore");
}
#endif /* NO_CONFIG_WRITE */
static int wpa_config_parse_bssid_accept(const struct parse_data *data,
struct wpa_ssid *ssid, int line,
const char *value)
{
return wpa_config_parse_addr_list(data, line, value,
&ssid->bssid_accept,
&ssid->num_bssid_accept,
"bssid_accept", 1, 1);
}
/* deprecated alias for bssid_accept for backwards compatibility */
static int wpa_config_parse_bssid_whitelist(const struct parse_data *data,
struct wpa_ssid *ssid, int line,
const char *value)
{
return wpa_config_parse_addr_list(data, line, value,
&ssid->bssid_whitelist,
&ssid->num_bssid_whitelist,
"bssid_whitelist", 1, 1);
&ssid->bssid_accept,
&ssid->num_bssid_accept,
"bssid_accept", 1, 1);
}
#ifndef NO_CONFIG_WRITE
static char * wpa_config_write_bssid_accept(const struct parse_data *data,
struct wpa_ssid *ssid)
{
return wpa_config_write_addr_list(data, ssid->bssid_accept,
ssid->num_bssid_accept,
"bssid_accept");
}
/* deprecated alias for bssid_accept for backwards compatibility */
static char * wpa_config_write_bssid_whitelist(const struct parse_data *data,
struct wpa_ssid *ssid)
{
return wpa_config_write_addr_list(data, ssid->bssid_whitelist,
ssid->num_bssid_whitelist,
"bssid_whitelist");
return wpa_config_write_addr_list(data, ssid->bssid_accept,
ssid->num_bssid_accept,
"bssid_accept");
}
#endif /* NO_CONFIG_WRITE */
#ifndef NO_CONFIG_WRITE
#endif /* NO_CONFIG_WRITE */
@ -2362,8 +2414,10 @@ static const struct parse_data ssid_fields[] = {
{ INT_RANGE(scan_ssid, 0, 1) },
{ FUNC(bssid) },
{ FUNC(bssid_hint) },
{ FUNC(bssid_blacklist) },
{ FUNC(bssid_whitelist) },
{ FUNC(bssid_ignore) },
{ FUNC(bssid_accept) },
{ FUNC(bssid_blacklist) }, /* deprecated alias for bssid_ignore */
{ FUNC(bssid_whitelist) }, /* deprecated alias for bssid_accept */
{ FUNC_KEY(psk) },
{ INT(mem_only_psk) },
{ STR_KEY(sae_password) },
@ -2763,8 +2817,8 @@ void wpa_config_free_ssid(struct wpa_ssid *ssid)
os_free(ssid->freq_list);
os_free(ssid->bgscan);
os_free(ssid->p2p_client_list);
os_free(ssid->bssid_blacklist);
os_free(ssid->bssid_whitelist);
os_free(ssid->bssid_ignore);
os_free(ssid->bssid_accept);
#ifdef CONFIG_HT_OVERRIDES
os_free(ssid->ht_mcs);
#endif /* CONFIG_HT_OVERRIDES */

View file

@ -767,8 +767,8 @@ static void wpa_config_write_network(FILE *f, struct wpa_ssid *ssid)
INT(scan_ssid);
write_bssid(f, ssid);
write_bssid_hint(f, ssid);
write_str(f, "bssid_blacklist", ssid);
write_str(f, "bssid_whitelist", ssid);
write_str(f, "bssid_ignore", ssid);
write_str(f, "bssid_accept", ssid);
write_psk(f, ssid);
INT(mem_only_psk);
STR(sae_password);

View file

@ -153,16 +153,16 @@ struct wpa_ssid {
u8 bssid[ETH_ALEN];
/**
* bssid_blacklist - List of inacceptable BSSIDs
* bssid_ignore - List of inacceptable BSSIDs
*/
u8 *bssid_blacklist;
size_t num_bssid_blacklist;
u8 *bssid_ignore;
size_t num_bssid_ignore;
/**
* bssid_blacklist - List of acceptable BSSIDs
* bssid_accept - List of acceptable BSSIDs
*/
u8 *bssid_whitelist;
size_t num_bssid_whitelist;
u8 *bssid_accept;
size_t num_bssid_accept;
/**
* bssid_set - Whether BSSID is configured for this network

View file

@ -138,7 +138,9 @@ DBusMessage * wpas_dbus_error_no_memory(DBusMessage *message)
static const char * const dont_quote[] = {
"key_mgmt", "proto", "pairwise", "auth_alg", "group", "eap",
"bssid", "scan_freq", "freq_list", "scan_ssid", "bssid_hint",
"bssid_blacklist", "bssid_whitelist", "group_mgmt",
"bssid_ignore", "bssid_accept", /* deprecated aliases */
"bssid_blacklist", "bssid_whitelist",
"group_mgmt",
"ignore_broadcast_ssid",
#ifdef CONFIG_MESH
"mesh_basic_rates",

View file

@ -1217,23 +1217,23 @@ static bool wpa_scan_res_ok(struct wpa_supplicant *wpa_s, struct wpa_ssid *ssid,
return false;
}
/* check blacklist */
if (ssid->num_bssid_blacklist &&
addr_in_list(bss->bssid, ssid->bssid_blacklist,
ssid->num_bssid_blacklist)) {
/* check the list of BSSIDs to ignore */
if (ssid->num_bssid_ignore &&
addr_in_list(bss->bssid, ssid->bssid_ignore,
ssid->num_bssid_ignore)) {
if (debug_print)
wpa_dbg(wpa_s, MSG_DEBUG,
" skip - BSSID blacklisted");
" skip - BSSID configured to be ignored");
return false;
}
/* 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)) {
/* if there is a list of accepted BSSIDs, only accept those APs */
if (ssid->num_bssid_accept &&
!addr_in_list(bss->bssid, ssid->bssid_accept,
ssid->num_bssid_accept)) {
if (debug_print)
wpa_dbg(wpa_s, MSG_DEBUG,
" skip - BSSID not in whitelist");
" skip - BSSID not in list of accepted values");
return false;
}

View file

@ -1408,8 +1408,8 @@ static int wpa_cli_cmd_get_network(struct wpa_ctrl *ctrl, int argc,
static const char *network_fields[] = {
"ssid", "scan_ssid", "bssid", "bssid_blacklist",
"bssid_whitelist", "psk", "proto", "key_mgmt",
"ssid", "scan_ssid", "bssid", "bssid_ignore",
"bssid_accept", "psk", "proto", "key_mgmt",
"bg_scan_period", "pairwise", "group", "auth_alg", "scan_freq",
"freq_list", "max_oper_chwidth", "ht40", "vht", "vht_center_freq1",
"vht_center_freq2", "ht", "edmg",

View file

@ -2009,12 +2009,12 @@ network={
key_mgmt=NONE
}
# Example configuration blacklisting two APs - these will be ignored
# Example configuration ignoring two APs - these will be ignored
# for this network.
network={
ssid="example"
psk="very secret passphrase"
bssid_blacklist=02:11:22:33:44:55 02:22:aa:44:55:66
bssid_ignore=02:11:22:33:44:55 02:22:aa:44:55:66
}
# Example configuration limiting AP selection to a specific set of APs;
@ -2022,7 +2022,7 @@ network={
network={
ssid="example"
psk="very secret passphrase"
bssid_whitelist=02:55:ae:bc:00:00/ff:ff:ff:ff:00:00 00:00:77:66:55:44/00:00:ff:ff:ff:ff
bssid_accept=02:55:ae:bc:00:00/ff:ff:ff:ff:00:00 00:00:77:66:55:44/00:00:ff:ff:ff:ff
}
# Example config file that will only scan on channel 36.