connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Implement connmand state monitoring to vpnd
@ 2021-08-30  9:24 Jussi Laakkonen
  2021-08-30  9:24 ` [PATCH v3 1/2] vpn-provider: Implement connmand online state checking Jussi Laakkonen
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Jussi Laakkonen @ 2021-08-30  9:24 UTC (permalink / raw)
  To: connman

Implement connmand state monitoring into vpnd to keep track of the state
changes in regards to connectivity and D-Bus registration. vpnd retrieves the
state from connmand using Manager interface when started and otherwise it
monitors PropertyChanged signals as well as utilizes D-Bus service monitoring
to get the changes.

This change prevents connecting VPNs when connmand is not yet online or has
gone away from D-Bus (e.g., restart). In case VPN is connected before the state
has been queried a delayed connection function is utilized to connect that VPN
when online/ready state is reached.

In case connmand is offline or gone from D-Bus ENOLINK is returned as an error.
This is handled in plugins/vpn.c and returned back to the caller as NoCarrier
D-Bus error message.

Changes since V2:
 - Updated vpn-provider patch to v3: cleanups, reformat, remove agent checks.
 - Updated vpn patch to v2: do handle ENOLINK properly and reformat.

Jussi Laakkonen (2):
  vpn-provider: Implement connmand online state checking
  vpn: Refactor connect_reply() and handle NoCarrier ->  ENOLINK error

 plugins/vpn.c      |  14 +-
 vpn/vpn-provider.c | 357 ++++++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 368 insertions(+), 3 deletions(-)

-- 
2.20.1


^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH 2/2] vpn: Handle ENOLINK error in connect callback
@ 2021-08-17 15:14 Jussi Laakkonen
  2021-08-20 13:06 ` [PATCH v2 2/2] vpn: Refactor connect_reply() and handle NoCarrier -> ENOLINK error Jussi Laakkonen
  0 siblings, 1 reply; 8+ messages in thread
From: Jussi Laakkonen @ 2021-08-17 15:14 UTC (permalink / raw)
  To: connman

Add handling of ENOLINK error that is reported back by vpnd when a VPN
cannot be connected because connmand is in offline state. ENOLINK has
to be handled similarly to EINPROGRESS as it is not a real error in the
actual VPN connection.
---
 plugins/vpn.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/plugins/vpn.c b/plugins/vpn.c
index d708d1ff..bc025c0c 100644
--- a/plugins/vpn.c
+++ b/plugins/vpn.c
@@ -491,6 +491,9 @@ static int errorstr2val(const char *error) {
 	if (g_strcmp0(error, CONNMAN_ERROR_INTERFACE ".AlreadyConnected") == 0)
 		return -EISCONN;
 
+	if (g_strcmp0(error, CONNMAN_ERROR_INTERFACE ".NoCarrier") == 0)
+		return -ENOLINK;
+
 	if (g_strcmp0(error, CONNMAN_ERROR_INTERFACE ".OperationCanceled") == 0)
 		return -ECANCELED;
 
@@ -538,7 +541,12 @@ static void connect_reply(DBusPendingCall *call, void *user_data)
 		if (err == -ECANCELED) {
 			DBG("%s connect canceled", data->path);
 			connman_provider_set_autoconnect(data->provider, false);
-		} else if (err != -EINPROGRESS) {
+		/*
+		 * ENOLINK (No carrier) is not an error situation but is caused
+		 * by connman not being online when VPN is attempted to be
+		 * connected.
+		 */
+		} else if (err != -EINPROGRESS && err != -ENOLINK) {
 			connman_error("Connect reply: %s (%s)", error.message,
 								error.name);
 			DBG("data %p cb_data %p", data, cb_data);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-08-31 10:29 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-30  9:24 [PATCH v2 0/2] Implement connmand state monitoring to vpnd Jussi Laakkonen
2021-08-30  9:24 ` [PATCH v3 1/2] vpn-provider: Implement connmand online state checking Jussi Laakkonen
2021-08-30  9:24 ` [PATCH v2 2/2] vpn: Refactor connect_reply() and handle NoCarrier -> ENOLINK error Jussi Laakkonen
2021-08-30 17:06 ` [PATCH v2 0/2] Implement connmand state monitoring to vpnd Daniel Wagner
2021-08-31  7:00   ` Jussi Laakkonen
2021-08-31  7:22     ` Daniel Wagner
2021-08-31 10:29       ` Jussi Laakkonen
  -- strict thread matches above, loose matches on Subject: below --
2021-08-17 15:14 [PATCH 2/2] vpn: Handle ENOLINK error in connect callback Jussi Laakkonen
2021-08-20 13:06 ` [PATCH v2 2/2] vpn: Refactor connect_reply() and handle NoCarrier -> ENOLINK error Jussi Laakkonen

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).