From: lists@jade.fyi
To: connman@lists.linux.dev
Cc: Daniel Wagner <wagi@monom.org>, Jade Lovelace <lists@jade.fyi>
Subject: [PATCH] service: Fix an additional case of autoconnect breakage under iwd
Date: Wed, 11 Jan 2023 14:08:37 -0500 [thread overview]
Message-ID: <20230111190837.209460-1-lists@jade.fyi> (raw)
In-Reply-To: <CAFA9we_1LwKgh1Dm7eBT6DwaFPf0f8hxA4O9o2PMsR0ddrxeTA@mail.gmail.com>
From: Jade Lovelace <lists@jade.fyi>
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.
---
src/service.c | 4 ++++
1 file changed, 4 insertions(+)
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) {
--
2.38.1
next prev parent reply other threads:[~2023-01-11 19:08 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-07 21:50 Patches for the AutoConnect bug I hit in the iwd plugin lists
2023-01-07 21:50 ` [PATCH 1/3] plugins/iwd: Rename autoconnect fields to clarify meaning lists
2023-01-07 21:50 ` [PATCH 2/3] plugins/iwd: Fix typo in create_known_network name lists
2023-01-07 21:50 ` [PATCH 3/3] plugins/iwd: fix iwd autoconnect being set wrongly on new connections lists
2023-01-09 21:02 ` Jade Lovelace
2023-01-11 19:08 ` lists [this message]
2023-01-16 7:52 ` [PATCH] service: Fix an additional case of autoconnect breakage under iwd Daniel Wagner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230111190837.209460-1-lists@jade.fyi \
--to=lists@jade.fyi \
--cc=connman@lists.linux.dev \
--cc=wagi@monom.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).