[PATCH 3/7] network: call network_connected with BSS

James Prestwood
2023-12-20T13:12:12Z

This will allow the BSS frequency to be inserted at the head of the
known frequency list, allowing future scans to prefer that frequency.
---
src/network.c | 4 +++-
src/network.h | 2 +-
src/station.c | 2 +-
3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/network.c b/src/network.c
index 3e8770bc..f4496c25 100644
--- a/src/network.c
+++ b/src/network.c
@@ -167,7 +167,7 @@ static bool network_secret_check_cacheable(void *data, void *user_data)
return false;
}

-void network_connected(struct network *network)
+void network_connected(struct network *network, struct scan_bss *bss)
{
enum security security = network_get_security(network);
const char *ssid = network_get_ssid(network);
@@ -190,6 +190,8 @@ void network_connected(struct network *network)
if (err < 0)
l_error("Error %i touching network config", err);

+ known_network_add_connected_frequency(network->info,
+ bss->frequency);
/* Syncs frequencies of already known network*/
known_network_frequency_sync(network->info);
}
diff --git a/src/network.h b/src/network.h
index f29649f7..e7638899 100644
--- a/src/network.h
+++ b/src/network.h
@@ -31,7 +31,7 @@ struct scan_bss;
struct handshake_state;
struct erp_cache_entry;

-void network_connected(struct network *network);
+void network_connected(struct network *network, struct scan_bss *bss);
void network_disconnected(struct network *network);
bool network_rankmod(const struct network *network, double *rankmod);

diff --git a/src/station.c b/src/station.c
index 73de26bb..4facc0bc 100644
--- a/src/station.c
+++ b/src/station.c
@@ -3213,7 +3213,7 @@ static void station_connect_ok(struct station *station)
l_warn("Could not request neighbor report");
}

- network_connected(station->connected_network);
+ network_connected(station->connected_network, station->connected_bss);

if (station->netconfig) {
if (hs->fils_ip_req_ie && hs->fils_ip_resp_ie) {
--
2.34.1