From dfdc8716be31d87b6956d35f357b3755d0d94585 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 6 Jul 2021 11:46:33 -0500 Subject: [PATCH] network: Rename _sync_psk to _sync_settings There will be additional security-related settings that will be introduced for settings files. In particular, Hash-to-Curve PT elements, Transition Disable settings and potentially others in the future. Since PSK is now not the only element that would require update, rename this function to better reflect this. --- src/network.c | 14 +++++++------- src/network.h | 2 +- src/station.c | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/network.c b/src/network.c index 68542d52..7f017ddf 100644 --- a/src/network.c +++ b/src/network.c @@ -73,7 +73,7 @@ struct network { uint8_t hessid[6]; char **nai_realms; uint8_t *rc_ie; - bool update_psk:1; /* Whether PSK should be written to storage */ + bool sync_settings:1; /* should settings be synced on connect? */ bool ask_passphrase:1; /* Whether we should force-ask agent */ bool is_hs20:1; bool anqp_pending:1; /* Set if there is a pending ANQP request */ @@ -420,7 +420,7 @@ static int network_load_psk(struct network *network, bool need_passphrase) r = crypto_psk_from_passphrase(network->passphrase, (uint8_t *) ssid, strlen(ssid), network->psk); if (!r) { - network->update_psk = true; + network->sync_settings = true; return 0; } @@ -432,15 +432,15 @@ static int network_load_psk(struct network *network, bool need_passphrase) return r; } -void network_sync_psk(struct network *network) +void network_sync_settings(struct network *network) { struct l_settings *fs_settings; const char *ssid = network_get_ssid(network); - if (!network->update_psk) + if (!network->sync_settings) return; - network->update_psk = false; + network->sync_settings = false; fs_settings = storage_network_open(SECURITY_PSK, ssid); @@ -607,7 +607,7 @@ void network_connect_failed(struct network *network, bool in_handshake) * for the passphrase once more */ if (network_get_security(network) == SECURITY_PSK && in_handshake) { - network->update_psk = false; + network->sync_settings = false; network->ask_passphrase = true; } @@ -891,7 +891,7 @@ static void passphrase_callback(enum agent_result result, * we do that, make sure the PSK works. We write to the store only * when we are connected */ - network->update_psk = true; + network->sync_settings = true; station_connect_network(station, network, bss, message); l_dbus_message_unref(message); diff --git a/src/network.h b/src/network.h index bd51945f..5d23216e 100644 --- a/src/network.h +++ b/src/network.h @@ -47,7 +47,7 @@ int network_get_signal_strength(const struct network *network); struct l_settings *network_get_settings(const struct network *network); bool network_set_psk(struct network *network, const uint8_t *psk); -void network_sync_psk(struct network *network); +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); diff --git a/src/station.c b/src/station.c index 0b0cc59c..32fe0374 100644 --- a/src/station.c +++ b/src/station.c @@ -704,8 +704,8 @@ static void station_handshake_event(struct handshake_state *hs, case HANDSHAKE_EVENT_SETTING_KEYS: l_debug("Setting keys"); - /* If we got here, then our PSK works. Save if required */ - network_sync_psk(network); + /* If we got here, then our settings work. Update if needed */ + network_sync_settings(network); break; case HANDSHAKE_EVENT_FAILED: netdev_handshake_failed(hs, va_arg(args, int));