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 */ #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, static int wpa_config_parse_bssid_blacklist(const struct parse_data *data,
struct wpa_ssid *ssid, int line, struct wpa_ssid *ssid, int line,
const char *value) const char *value)
{ {
return wpa_config_parse_addr_list(data, line, value, return wpa_config_parse_addr_list(data, line, value,
&ssid->bssid_blacklist, &ssid->bssid_ignore,
&ssid->num_bssid_blacklist, &ssid->num_bssid_ignore,
"bssid_blacklist", 1, 1); "bssid_ignore", 1, 1);
} }
#ifndef NO_CONFIG_WRITE #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, static char * wpa_config_write_bssid_blacklist(const struct parse_data *data,
struct wpa_ssid *ssid) struct wpa_ssid *ssid)
{ {
return wpa_config_write_addr_list(data, ssid->bssid_blacklist, return wpa_config_write_addr_list(data, ssid->bssid_ignore,
ssid->num_bssid_blacklist, ssid->num_bssid_ignore,
"bssid_blacklist"); "bssid_ignore");
} }
#endif /* NO_CONFIG_WRITE */ #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, static int wpa_config_parse_bssid_whitelist(const struct parse_data *data,
struct wpa_ssid *ssid, int line, struct wpa_ssid *ssid, int line,
const char *value) const char *value)
{ {
return wpa_config_parse_addr_list(data, line, value, return wpa_config_parse_addr_list(data, line, value,
&ssid->bssid_whitelist, &ssid->bssid_accept,
&ssid->num_bssid_whitelist, &ssid->num_bssid_accept,
"bssid_whitelist", 1, 1); "bssid_accept", 1, 1);
} }
#ifndef NO_CONFIG_WRITE #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, static char * wpa_config_write_bssid_whitelist(const struct parse_data *data,
struct wpa_ssid *ssid) struct wpa_ssid *ssid)
{ {
return wpa_config_write_addr_list(data, ssid->bssid_whitelist, return wpa_config_write_addr_list(data, ssid->bssid_accept,
ssid->num_bssid_whitelist, ssid->num_bssid_accept,
"bssid_whitelist"); "bssid_accept");
} }
#endif /* NO_CONFIG_WRITE */
#ifndef NO_CONFIG_WRITE
#endif /* NO_CONFIG_WRITE */ #endif /* NO_CONFIG_WRITE */
@ -2362,8 +2414,10 @@ static const struct parse_data ssid_fields[] = {
{ INT_RANGE(scan_ssid, 0, 1) }, { INT_RANGE(scan_ssid, 0, 1) },
{ FUNC(bssid) }, { FUNC(bssid) },
{ FUNC(bssid_hint) }, { FUNC(bssid_hint) },
{ FUNC(bssid_blacklist) }, { FUNC(bssid_ignore) },
{ FUNC(bssid_whitelist) }, { FUNC(bssid_accept) },
{ FUNC(bssid_blacklist) }, /* deprecated alias for bssid_ignore */
{ FUNC(bssid_whitelist) }, /* deprecated alias for bssid_accept */
{ FUNC_KEY(psk) }, { FUNC_KEY(psk) },
{ INT(mem_only_psk) }, { INT(mem_only_psk) },
{ STR_KEY(sae_password) }, { 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->freq_list);
os_free(ssid->bgscan); os_free(ssid->bgscan);
os_free(ssid->p2p_client_list); os_free(ssid->p2p_client_list);
os_free(ssid->bssid_blacklist); os_free(ssid->bssid_ignore);
os_free(ssid->bssid_whitelist); os_free(ssid->bssid_accept);
#ifdef CONFIG_HT_OVERRIDES #ifdef CONFIG_HT_OVERRIDES
os_free(ssid->ht_mcs); os_free(ssid->ht_mcs);
#endif /* CONFIG_HT_OVERRIDES */ #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); INT(scan_ssid);
write_bssid(f, ssid); write_bssid(f, ssid);
write_bssid_hint(f, ssid); write_bssid_hint(f, ssid);
write_str(f, "bssid_blacklist", ssid); write_str(f, "bssid_ignore", ssid);
write_str(f, "bssid_whitelist", ssid); write_str(f, "bssid_accept", ssid);
write_psk(f, ssid); write_psk(f, ssid);
INT(mem_only_psk); INT(mem_only_psk);
STR(sae_password); STR(sae_password);

View file

@ -153,16 +153,16 @@ struct wpa_ssid {
u8 bssid[ETH_ALEN]; u8 bssid[ETH_ALEN];
/** /**
* bssid_blacklist - List of inacceptable BSSIDs * bssid_ignore - List of inacceptable BSSIDs
*/ */
u8 *bssid_blacklist; u8 *bssid_ignore;
size_t num_bssid_blacklist; size_t num_bssid_ignore;
/** /**
* bssid_blacklist - List of acceptable BSSIDs * bssid_accept - List of acceptable BSSIDs
*/ */
u8 *bssid_whitelist; u8 *bssid_accept;
size_t num_bssid_whitelist; size_t num_bssid_accept;
/** /**
* bssid_set - Whether BSSID is configured for this network * 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[] = { static const char * const dont_quote[] = {
"key_mgmt", "proto", "pairwise", "auth_alg", "group", "eap", "key_mgmt", "proto", "pairwise", "auth_alg", "group", "eap",
"bssid", "scan_freq", "freq_list", "scan_ssid", "bssid_hint", "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", "ignore_broadcast_ssid",
#ifdef CONFIG_MESH #ifdef CONFIG_MESH
"mesh_basic_rates", "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; return false;
} }
/* check blacklist */ /* check the list of BSSIDs to ignore */
if (ssid->num_bssid_blacklist && if (ssid->num_bssid_ignore &&
addr_in_list(bss->bssid, ssid->bssid_blacklist, addr_in_list(bss->bssid, ssid->bssid_ignore,
ssid->num_bssid_blacklist)) { ssid->num_bssid_ignore)) {
if (debug_print) if (debug_print)
wpa_dbg(wpa_s, MSG_DEBUG, wpa_dbg(wpa_s, MSG_DEBUG,
" skip - BSSID blacklisted"); " skip - BSSID configured to be ignored");
return false; return false;
} }
/* if there is a whitelist, only accept those APs */ /* if there is a list of accepted BSSIDs, only accept those APs */
if (ssid->num_bssid_whitelist && if (ssid->num_bssid_accept &&
!addr_in_list(bss->bssid, ssid->bssid_whitelist, !addr_in_list(bss->bssid, ssid->bssid_accept,
ssid->num_bssid_whitelist)) { ssid->num_bssid_accept)) {
if (debug_print) if (debug_print)
wpa_dbg(wpa_s, MSG_DEBUG, wpa_dbg(wpa_s, MSG_DEBUG,
" skip - BSSID not in whitelist"); " skip - BSSID not in list of accepted values");
return false; 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[] = { static const char *network_fields[] = {
"ssid", "scan_ssid", "bssid", "bssid_blacklist", "ssid", "scan_ssid", "bssid", "bssid_ignore",
"bssid_whitelist", "psk", "proto", "key_mgmt", "bssid_accept", "psk", "proto", "key_mgmt",
"bg_scan_period", "pairwise", "group", "auth_alg", "scan_freq", "bg_scan_period", "pairwise", "group", "auth_alg", "scan_freq",
"freq_list", "max_oper_chwidth", "ht40", "vht", "vht_center_freq1", "freq_list", "max_oper_chwidth", "ht40", "vht", "vht_center_freq1",
"vht_center_freq2", "ht", "edmg", "vht_center_freq2", "ht", "edmg",

View file

@ -2009,12 +2009,12 @@ network={
key_mgmt=NONE key_mgmt=NONE
} }
# Example configuration blacklisting two APs - these will be ignored # Example configuration ignoring two APs - these will be ignored
# for this network. # for this network.
network={ network={
ssid="example" ssid="example"
psk="very secret passphrase" 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; # Example configuration limiting AP selection to a specific set of APs;
@ -2022,7 +2022,7 @@ network={
network={ network={
ssid="example" ssid="example"
psk="very secret passphrase" 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. # Example config file that will only scan on channel 36.