3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-21 20:12:37 +01:00

network: Move PSK sync to network.c

This commit is contained in:
Denis Kenzior 2016-05-15 21:04:02 -05:00
parent 24366efb32
commit 54e7cced8e
3 changed files with 17 additions and 10 deletions

View File

@ -230,6 +230,21 @@ bool network_settings_load(struct network *network)
return true; return true;
} }
void network_sync_psk(struct network *network)
{
char *hex;
if (!network->update_psk)
return;
network->update_psk = false;
hex = l_util_hexstring(network->psk, 32);
l_settings_set_value(network->settings, "Security",
"PreSharedKey", hex);
l_free(hex);
storage_network_sync("psk", network->ssid, network->settings);
}
void network_settings_close(struct network *network) void network_settings_close(struct network *network)
{ {
if (!network->settings) if (!network->settings)

View File

@ -51,6 +51,7 @@ enum security network_get_security(struct network *network);
bool network_settings_load(struct network *network); bool network_settings_load(struct network *network);
void network_settings_close(struct network *network); void network_settings_close(struct network *network);
void network_sync_psk(struct network *network);
void network_emit_added(struct network *network); void network_emit_added(struct network *network);
void network_emit_removed(struct network *network); void network_emit_removed(struct network *network);

View File

@ -1132,16 +1132,7 @@ static void wiphy_set_tk(uint32_t ifindex, const uint8_t *aa,
} }
/* If we got here, then our PSK works. Save if required */ /* If we got here, then our PSK works. Save if required */
if (network->update_psk) { network_sync_psk(network);
char *hex;
network->update_psk = false;
hex = l_util_hexstring(network->psk, 32);
l_settings_set_value(network->settings, "Security",
"PreSharedKey", hex);
l_free(hex);
storage_network_sync("psk", network->ssid, network->settings);
}
netdev->pairwise_new_key_cmd_id = netdev->pairwise_new_key_cmd_id =
mlme_new_pairwise_key(netdev, cipher, aa, mlme_new_pairwise_key(netdev, cipher, aa,