aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Prestwood <prestwoj@gmail.com>2024-02-27 10:33:57 -0800
committerDenis Kenzior <denkenz@gmail.com>2024-02-27 13:55:37 -0600
commitb38f71f221bb3e02dd729b39036a6f834b302b88 (patch)
tree0213f141201831b1c5ccecf01de7c3d907d9065a
parent3f04bc427d276db83d9b34216274093a69dcae47 (diff)
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.
-rw-r--r--src/network.c38
-rw-r--r--src/network.h4
-rw-r--r--src/station.c4
3 files changed, 35 insertions, 11 deletions
diff --git a/src/network.c b/src/network.c
index 287e2be00..a0a89e63d 100644
--- a/src/network.c
+++ b/src/network.c
@@ -89,7 +89,7 @@ struct network {
bool provisioning_hidden:1;
uint8_t transition_disable; /* Temporary cache until info is set */
bool have_transition_disable:1;
- bool force_default_owe_group:1;
+ bool force_default_ecc_group:1;
int rank;
/* Holds DBus Connect() message if it comes in before ANQP finishes */
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->info = known_networks_find(ssid, security);
- if (network->info)
+ if (network->info) {
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->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)
- 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
@@ -818,14 +822,34 @@ void network_set_info(struct network *network, struct network_info *info)
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)
diff --git a/src/network.h b/src/network.h
index ea619f3f6..17dfcca89 100644
--- a/src/network.h
+++ b/src/network.h
@@ -58,8 +58,8 @@ void network_sync_settings(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_force_default_owe_group(struct network *network);
-bool network_get_force_default_owe_group(struct network *network);
+void network_set_force_default_ecc_group(struct network *network);
+bool network_get_force_default_ecc_group(struct network *network);
bool network_update_known_frequencies(struct network *network);
diff --git a/src/station.c b/src/station.c
index fa5d449da..b564f4aad 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3152,7 +3152,7 @@ static bool station_retry_owe_default_group(struct station *station)
return false;
/* 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;
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",
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;
}