3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-21 22:09:23 +01:00

network: retain default ECC group for OWE after setting

There is special handling for buggy OWE APs which set a network flag
to use the default OWE group. Utilize the more persistent setting
within known-networks as well as the network object (in case there
is no profile).

This also renames the get/set APIs to be generic to ECC groups rather
than only OWE.
This commit is contained in:
James Prestwood 2024-02-27 10:33:57 -08:00 committed by Denis Kenzior
parent 3f04bc427d
commit b38f71f221
3 changed files with 35 additions and 11 deletions

View File

@ -89,7 +89,7 @@ struct network {
bool provisioning_hidden:1; bool provisioning_hidden:1;
uint8_t transition_disable; /* Temporary cache until info is set */ uint8_t transition_disable; /* Temporary cache until info is set */
bool have_transition_disable:1; bool have_transition_disable:1;
bool force_default_owe_group:1; bool force_default_ecc_group:1;
int rank; int rank;
/* Holds DBus Connect() message if it comes in before ANQP finishes */ /* Holds DBus Connect() message if it comes in before ANQP finishes */
struct l_dbus_message *connect_after_anqp; struct l_dbus_message *connect_after_anqp;
@ -271,8 +271,12 @@ struct network *network_create(struct station *station, const char *ssid,
network->security = security; network->security = security;
network->info = known_networks_find(ssid, security); network->info = known_networks_find(ssid, security);
if (network->info) if (network->info) {
network->info->seen_count++; network->info->seen_count++;
if (network->info->config.ecc_group ==
KNOWN_NETWORK_ECC_GROUP_DEFAULT)
network->force_default_ecc_group = true;
}
network->bss_list = l_queue_new(); network->bss_list = l_queue_new();
network->blacklist = l_queue_new(); network->blacklist = l_queue_new();
@ -553,7 +557,7 @@ int network_handshake_setup(struct network *network, struct scan_bss *bss,
} }
if (hs->akm_suite == IE_RSN_AKM_SUITE_OWE) if (hs->akm_suite == IE_RSN_AKM_SUITE_OWE)
hs->force_default_owe_group = network->force_default_owe_group; hs->force_default_owe_group = network->force_default_ecc_group;
/* /*
* The randomization options in the provisioning file are dependent on * The randomization options in the provisioning file are dependent on
@ -818,14 +822,34 @@ void network_set_info(struct network *network, struct network_info *info)
IWD_NETWORK_INTERFACE, "KnownNetwork"); IWD_NETWORK_INTERFACE, "KnownNetwork");
} }
void network_set_force_default_owe_group(struct network *network) void network_set_force_default_ecc_group(struct network *network)
{ {
network->force_default_owe_group = true; /* No network info, likely a failed OWE connection */
if (!network->info) {
network->force_default_ecc_group = true;
return;
}
/* Profile explicitly wants to try the most secure group */
if (network->info->config.ecc_group ==
KNOWN_NETWORK_ECC_GROUP_MOST_SECURE)
return;
l_debug("Forcing default group for %s", network->ssid);
network->force_default_ecc_group = true;
network->info->config.ecc_group = KNOWN_NETWORK_ECC_GROUP_DEFAULT;
} }
bool network_get_force_default_owe_group(struct network *network) bool network_get_force_default_ecc_group(struct network *network)
{ {
return network->force_default_owe_group; if (!network->info)
return network->force_default_ecc_group;
if (network->info->config.ecc_group == KNOWN_NETWORK_ECC_GROUP_DEFAULT)
return true;
return false;
} }
int network_can_connect_bss(struct network *network, const struct scan_bss *bss) int network_can_connect_bss(struct network *network, const struct scan_bss *bss)

View File

@ -58,8 +58,8 @@ void network_sync_settings(struct network *network);
const struct network_info *network_get_info(const struct network *network); const struct network_info *network_get_info(const struct network *network);
void network_set_info(struct network *network, struct network_info *info); void network_set_info(struct network *network, struct network_info *info);
void network_set_force_default_owe_group(struct network *network); void network_set_force_default_ecc_group(struct network *network);
bool network_get_force_default_owe_group(struct network *network); bool network_get_force_default_ecc_group(struct network *network);
bool network_update_known_frequencies(struct network *network); bool network_update_known_frequencies(struct network *network);

View File

@ -3152,7 +3152,7 @@ static bool station_retry_owe_default_group(struct station *station)
return false; return false;
/* If we already forced group 19, allow the BSS to be blacklisted */ /* If we already forced group 19, allow the BSS to be blacklisted */
if (network_get_force_default_owe_group(station->connected_network)) if (network_get_force_default_ecc_group(station->connected_network))
return false; return false;
l_warn("Failed to connect to OWE BSS "MAC" possibly because the AP is " l_warn("Failed to connect to OWE BSS "MAC" possibly because the AP is "
@ -3160,7 +3160,7 @@ static bool station_retry_owe_default_group(struct station *station)
"Retrying with group 19 as a workaround", "Retrying with group 19 as a workaround",
MAC_STR(station->connected_bss->addr)); MAC_STR(station->connected_bss->addr));
network_set_force_default_owe_group(station->connected_network); network_set_force_default_ecc_group(station->connected_network);
return true; return true;
} }