Send connman mailing list submissions to connman@lists.01.org To subscribe or unsubscribe via email, send a message with subject or body 'help' to connman-requ...@lists.01.org
You can reach the person managing the list at connman-ow...@lists.01.org When replying, please edit your Subject line so it is more specific than "Re: Contents of connman digest..." Today's Topics: 1. [PATCH] service: Prevent auto connection during passphrase request (VAUTRIN Emmanuel (Canal Plus Prestataire)) 2. [PATCH] service: Complete only after user connection retries (VAUTRIN Emmanuel (Canal Plus Prestataire)) 3. [PATCH] service: Fix disconnection search before connecting (VAUTRIN Emmanuel (Canal Plus Prestataire)) ---------------------------------------------------------------------- Date: Thu, 11 Mar 2021 13:03:09 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: [PATCH] service: Prevent auto connection during passphrase request To: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb4794d4faca9411fef37fd4d193...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" Avoid concurrent associations between a user connection to a secure service, blocked by an agent passphrase input request, and a starting auto connection on a different service of the same interface. --- src/service.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/service.c b/src/service.c index cfe14e3eb936..b4b9375411eb 100644 --- a/src/service.c +++ b/src/service.c @@ -49,6 +49,7 @@ static DBusConnection *connection = NULL; static GList *service_list = NULL; static GHashTable *service_hash = NULL; +static GHashTable *passphrase_requested = NULL; static GSList *counter_list = NULL; static unsigned int autoconnect_id = 0; static unsigned int vpn_autoconnect_id = 0; @@ -4160,6 +4161,7 @@ static bool auto_connect_service(GList *services, bool ignore[MAX_CONNMAN_SERVICE_TYPES] = { }; bool autoconnecting = false; GList *list; + int index; DBG("preferred %d sessions %d reason %s", preferred, active_count, reason2string(reason)); @@ -4175,6 +4177,11 @@ static bool auto_connect_service(GList *services, continue; } + index = __connman_service_get_index(service); + if (g_hash_table_lookup(passphrase_requested, + GINT_TO_POINTER(index))) + return true; + if (service->pending || is_connecting(service->state) || is_connected(service->state)) { @@ -5651,6 +5658,7 @@ static void request_input_cb(struct connman_service *service, struct connman_device *device; const char *security; int err = 0; + int index; DBG("RequestInput return, %p", service); @@ -5713,6 +5721,10 @@ static void request_input_cb(struct connman_service *service, err = __connman_service_set_passphrase(service, passphrase); done: + index = __connman_service_get_index(service); + g_hash_table_replace(passphrase_requested, + GINT_TO_POINTER(index), false); + if (err >= 0) { /* We forget any previous error. */ set_error(service, CONNMAN_SERVICE_ERROR_UNKNOWN); @@ -6562,6 +6574,7 @@ static int service_connect(struct connman_service *service) int __connman_service_connect(struct connman_service *service, enum connman_service_connect_reason reason) { + int index; int err; DBG("service %p state %s connect reason %s -> %s", @@ -6642,6 +6655,12 @@ int __connman_service_connect(struct connman_service *service, if (service->hidden && err != -EINPROGRESS) service->pending = pending; + if (err == -EINPROGRESS) { + index = __connman_service_get_index(service); + g_hash_table_replace(passphrase_requested, + GINT_TO_POINTER(index), true); + } + return err; } } @@ -7630,6 +7649,8 @@ int __connman_service_init(void) service_hash = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, service_free); + passphrase_requested = g_hash_table_new(g_direct_hash, g_direct_equal); + services_notify = g_new0(struct _services_notify, 1); services_notify->remove = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); @@ -7662,6 +7683,9 @@ void __connman_service_cleanup(void) g_hash_table_destroy(service_hash); service_hash = NULL; + g_hash_table_destroy(passphrase_requested); + passphrase_requested = NULL; + g_slist_free(counter_list); counter_list = NULL; -- 2.25.1 ------------------------------ Date: Thu, 11 Mar 2021 13:04:11 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: [PATCH] service: Complete only after user connection retries To: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb4794eb6ada4a23aa374ee58493...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" When a user connection fails, let the report_error_cb manage exclusively service update, after all retries. --- src/service.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/service.c b/src/service.c index 43e39bf79a72..ceac18468079 100644 --- a/src/service.c +++ b/src/service.c @@ -5611,6 +5611,7 @@ static void report_error_cb(void *user_context, bool retry, __connman_service_clear_error(service); service_complete(service); + service_list_sort(); __connman_connection_update_gateway(); } } @@ -6008,6 +6009,7 @@ static int service_indicate_state(struct connman_service *service) report_error_cb, get_dbus_sender(service), NULL); + goto notifier; } service_complete(service); break; @@ -6017,6 +6019,7 @@ static int service_indicate_state(struct connman_service *service) __connman_connection_update_gateway(); +notifier: if ((old_state == CONNMAN_SERVICE_STATE_ONLINE && new_state != CONNMAN_SERVICE_STATE_READY) || (old_state == CONNMAN_SERVICE_STATE_READY && -- 2.25.1 ------------------------------ Date: Thu, 11 Mar 2021 13:05:00 +0000 From: "VAUTRIN Emmanuel (Canal Plus Prestataire)" <emmanuel.vaut...@cpexterne.org> Subject: [PATCH] service: Fix disconnection search before connecting To: "connman@lists.01.org" <connman@lists.01.org> Message-ID: <pr1pr02mb4794a86bd2deb3cedca75e0493...@pr1pr02mb4794.eur prd02.prod.outlook.com> Content-Type: text/plain; charset="iso-8859-1" At the beginning of a connection, the search of potential disconnection shall not stop at the first idle service. Fixes: e89d4abfaf36 ("service: Clear up connect logic when called from D-Bus") --- src/service.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/service.c b/src/service.c index 048747e5b2b3..a24dea729545 100644 --- a/src/service.c +++ b/src/service.c @@ -4511,7 +4511,7 @@ static DBusMessage *connect_service(DBusConnection *conn, struct connman_service *temp = list->data; if (!is_connecting(temp->state) && !is_connected(temp->state)) - break; + continue; if (service == temp) continue; -- 2.25.1 ------------------------------ Subject: Digest Footer _______________________________________________ connman mailing list -- connman@lists.01.org To unsubscribe send an email to connman-le...@lists.01.org ------------------------------ End of connman Digest, Vol 65, Issue 3 **************************************