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

knownnetworks: Load Autoconnect along with other settings

Previously, 'Autoconnect' setting was loaded only at the
connection time, this patch makes autoconnect to load along
with other settings.
This commit is contained in:
Tim Kourt 2019-04-10 15:58:21 -07:00 committed by Denis Kenzior
parent bb33c5db8c
commit 531bb3f0b5
3 changed files with 22 additions and 7 deletions

View File

@ -103,6 +103,18 @@ static void known_network_register_dbus(struct network_info *network)
L_DBUS_INTERFACE_PROPERTIES);
}
static void known_network_set_autoconnect(struct network_info *network,
bool autoconnect)
{
if (network->is_autoconnectable == autoconnect)
return;
network->is_autoconnectable = autoconnect;
l_dbus_property_changed(dbus_get_bus(), known_network_get_path(network),
IWD_KNOWN_NETWORK_INTERFACE, "Autoconnect");
}
static void known_network_update(struct network_info *orig_network,
const char *ssid,
enum security security,
@ -111,6 +123,7 @@ static void known_network_update(struct network_info *orig_network,
{
struct network_info *network;
bool is_hidden = false;
bool is_autoconnectable;
if (orig_network)
network = orig_network;
@ -148,6 +161,13 @@ static void known_network_update(struct network_info *orig_network,
if (network->is_hidden)
num_known_hidden_networks++;
if (!l_settings_get_bool(settings, "Settings", "Autoconnect",
&is_autoconnectable))
/* If no entry, default to Autoconnectable=True */
is_autoconnectable = true;
known_network_set_autoconnect(network, is_autoconnectable);
if (orig_network)
return;

View File

@ -543,7 +543,6 @@ int network_autoconnect(struct network *network, struct scan_bss *bss)
struct wiphy *wiphy = station_get_wiphy(station);
enum security security = network_get_security(network);
struct ie_rsn_info rsn;
bool is_autoconnectable;
bool is_rsn;
int ret;
@ -566,13 +565,8 @@ int network_autoconnect(struct network *network, struct scan_bss *bss)
if (!network_settings_load(network))
return -ENOKEY;
/* If no entry, default to Autoconnectable=True */
if (!l_settings_get_bool(network->settings, "Settings",
"Autoconnect", &is_autoconnectable))
is_autoconnectable = true;
ret = -EPERM;
if (!is_autoconnectable)
if (!network->info->is_autoconnectable)
goto close_settings;
if (!is_rsn)

View File

@ -77,6 +77,7 @@ struct network_info {
int seen_count; /* Ref count for network.info */
bool is_hidden:1;
bool is_known:1;
bool is_autoconnectable:1;
};
struct network_info *network_info_add_known(const char *ssid,