mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 18:59:22 +01:00
network: Use security_to_str instead of switch(security)
Convert switch (network->security) statements to security_to_str to be consistent across network.c in how the settings file name ending is obtained.
This commit is contained in:
parent
b2bcf97373
commit
33d2ae60e9
@ -105,6 +105,7 @@ bool network_seen(struct network *network)
|
|||||||
int err;
|
int err;
|
||||||
struct network_info *info;
|
struct network_info *info;
|
||||||
struct network_info search;
|
struct network_info search;
|
||||||
|
const char *strtype;
|
||||||
|
|
||||||
search.type = network->security;
|
search.type = network->security;
|
||||||
strncpy(search.ssid, network->ssid, 32);
|
strncpy(search.ssid, network->ssid, 32);
|
||||||
@ -114,14 +115,11 @@ bool network_seen(struct network *network)
|
|||||||
if (info)
|
if (info)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
switch (network->security) {
|
strtype = security_to_str(network->security);
|
||||||
case SECURITY_PSK:
|
if (!strtype)
|
||||||
err = storage_network_get_mtime("psk", network->ssid, &mtim);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
|
err = storage_network_get_mtime(strtype, network->ssid, &mtim);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@ -267,22 +265,18 @@ struct l_settings *network_get_settings(const struct network *network)
|
|||||||
|
|
||||||
bool network_settings_load(struct network *network)
|
bool network_settings_load(struct network *network)
|
||||||
{
|
{
|
||||||
|
const char *strtype;
|
||||||
|
|
||||||
if (network->settings)
|
if (network->settings)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
switch (network->security) {
|
strtype = security_to_str(network->security);
|
||||||
case SECURITY_8021X:
|
if (!strtype)
|
||||||
network->settings = storage_network_open("8021x",
|
|
||||||
network->ssid);
|
|
||||||
break;
|
|
||||||
case SECURITY_PSK:
|
|
||||||
network->settings = storage_network_open("psk", network->ssid);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
return false;
|
return false;
|
||||||
};
|
|
||||||
|
|
||||||
return true;
|
network->settings = storage_network_open(strtype, network->ssid);
|
||||||
|
|
||||||
|
return network->settings != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void network_sync_psk(struct network *network)
|
void network_sync_psk(struct network *network)
|
||||||
|
Loading…
Reference in New Issue
Block a user