summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJade Lovelace <lists@jade.fyi>2023-01-11 14:08:37 -0500
committerDaniel Wagner <wagi@monom.org>2023-01-16 08:49:09 +0100
commit9971144ae862e83f1f5d8cb84c0b62f2542dcdec (patch)
tree197c3fd9e07c89c9cdb825f2089d6542469db748
parent372fd6dde5cee26b4d0d6b8bdf903f7d410a646b (diff)
downloadconnman-9971144ae862e83f1f5d8cb84c0b62f2542dcdec.tar.gz
service: Fix an additional case of autoconnect breakage under iwd
Error flow: - __connman_service_create_from_network() creates network, but it is not favorite since it is not yet saved - trigger_autoconnect is skipped since !favorite *** User calls Connect() *** - iwd plugin gets connect() call - iwd plugin finds out about new known network and copies the autoconnect state of the iwd_network to the iwd_known_network, which is false since it was zero initialized and nobody called connman_network_set_autoconnect on it. - iwd plugin tells iwd to set AutoConnect to false - service_indicate_state() calls __connman_service_set_favorite(service, true) - nobody tells the iwd plugin about the change in favorite state This patch calls trigger_autoconnect right at the end there, which will then propagate the outcome of the favorite state to the iwd plugin. I think this patch is the right design for the current architecture of the autoconnect state management, but I think the autoconnect design probably needs some changes outside the scope of this patch since it is too easy to make these mistakes.
-rw-r--r--src/service.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/service.c b/src/service.c
index 079c7a6c..6f31adb3 100644
--- a/src/service.c
+++ b/src/service.c
@@ -156,6 +156,7 @@ static struct connman_ipconfig *create_ip6config(struct connman_service *service
int index);
static void dns_changed(struct connman_service *service);
static void vpn_auto_connect(void);
+static void trigger_autoconnect(struct connman_service *service);
struct find_data {
const char *path;
@@ -5624,6 +5625,9 @@ int __connman_service_set_favorite_delayed(struct connman_service *service,
service->favorite = favorite;
favorite_changed(service);
+ /* If native autoconnect is in use, the favorite state may affect the
+ * autoconnect state, so it needs to be rerun. */
+ trigger_autoconnect(service);
if (!delay_ordering) {