connman.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH 0/9] Add association state for VPNs
@ 2022-12-13 14:06 Jussi Laakkonen
  2022-12-13 14:06 ` [RFC PATCH 1/9] agent: Cancel agent request on NoReply D-Bus error Jussi Laakkonen
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Jussi Laakkonen @ 2022-12-13 14:06 UTC (permalink / raw)
  To: connman

This patch set adds the association state also for the VPNs. This state is to
indicate that the VPN is waiting for VPN agent to provide input given by user.
In this state service.c must not do connect timeout checks as the timers for
both differ in length, default being 120s for connect timeout and 300s for VPN
agent dialog timeout.

In order to facilitate this change the association state had to be implemented
also for VPNs. It is common state for services and like with services the
association state for VPNs preceeds the configuration state (on VPN side
connect state). Both vpn.c plugins on connmand and vpnd side require changes
to accommodate this state. When the VPN agent succeeds in getting the input
from the user the state transitions from association to connect (configuration)
state and, thus, requires no specific changes to VPN plugins.

On connmand side the association state is the initial state when VPN is getting
connected and the state needs to be accounted as a connecting state in
plugins/vpn.c to not to lose transport ident for it and in provider.c as a
pre-configuration state to not to start the connect timeout for the VPN before
the VPN is in configuration state. The reason for the latter is that the
connect timeout should be exact and start from the point when
connect/configuration state is entered.

On vpnd side association state is, like on connmand side, the initial state for
the VPN getting connected. After the VPN agent succeeds getting the information
from the user (credentials) the state transitions to connect (configuratioin).
There may be a possibility for a VPN plugin to run without VPN agent and thus
in these cases it is ensured that the vpn/plugins/vpn.c:vpn_notify() does
the state transition in such cases. It is allowed go back to association state
from connect state but not from other states.


I'd like to raise the following issues for commenting:
a) Is this current approach sound in the way that the vpn-agent.c is
   responsible of changing the state? vpn-provider.c:connect_cb() would be
   ideal but that does get called in notify if there is no error. Processing
   the message with the vpn_agent_check_and_process_reply_error() with success
   indicates that VPN agent succeeded getting the input.

b) Can we figure out a case where the state transition from VPN plugin notify
   SHOULD change the state back to ASSOCIATION when normally in CONNECT state?
   This change is in vpn/plugins/vpn.c that accommodates transitions from
   CONNECT->ASSOCIATION.

c) Furthermore, might any of the VPN plugins available (elsewhere) work
   without accessing the VPN agent? The flow now requires to use vpn-agent.c
   for processing and state transition. However, these cases should then use
   the vpn_provider_set_state() directly, as most of the plugins now do in,
   e.g., error cases.

d) The VPN and PROVIDER states, should these be harmonized to follow the same
   structure as the common service states to avoid confusion or might this be
   risky as many of the headers are public?

e) Should the specific VPNs that do need VPN agent more than once then do the
   transition back to ASSOCIATION when the first VPN agent returns and sets the
   state to CONNECT? This is what I couldn't decide, there is another option to
   have the vpn_agent_check_and_process_reply_error() to have an additional
   parameter to state that do not transition state, but in the case of OpenVPN
   the private key, for instance, can be decrypted and the management interface
   queries the passphrase on need basis. Thus, there is no apriori information
   on this.

And of course, any other issue that may trouble your mind with these changes.

Jussi Laakkonen (9):
  agent: Cancel agent request on NoReply D-Bus error
  vpn-provider: Use association state for VPN agent input wait
  vpn: Add association state before connect state
  vpn-agent: Do connect state transition after input dialog check
  service: Explicit VPN connect timeout, ignore in VPN agent wait
  provider: Handle VPN configuration and association states
  vpn: Add support for association state, add state getter
  vpn: Check if connecting when setting state or disconnecting
  doc: Update VPN documentation for association state

 doc/vpn-connection-api.txt |  4 +--
 doc/vpn-overview.txt       |  4 ++-
 include/provider.h         |  1 +
 plugins/vpn.c              | 23 ++++++++++++++---
 src/agent.c                |  4 ++-
 src/connman.h              |  2 ++
 src/provider.c             | 22 +++++++++++++++-
 src/service.c              | 52 ++++++++++++++++++++++++++++++++++----
 vpn/plugins/vpn.c          | 29 ++++++++++++++++++++-
 vpn/plugins/vpn.h          |  1 +
 vpn/vpn-agent.c            |  6 ++++-
 vpn/vpn-provider.c         | 45 ++++++++++++++++++++++++++++++---
 vpn/vpn-provider.h         |  6 +++++
 13 files changed, 179 insertions(+), 20 deletions(-)

-- 
2.30.2


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

end of thread, other threads:[~2023-02-27  7:34 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-13 14:06 [RFC PATCH 0/9] Add association state for VPNs Jussi Laakkonen
2022-12-13 14:06 ` [RFC PATCH 1/9] agent: Cancel agent request on NoReply D-Bus error Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 2/9] vpn-provider: Use association state for VPN agent input wait Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 3/9] vpn: Add association state before connect state Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 4/9] vpn-agent: Do connect state transition after input dialog check Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 5/9] service: Explicit VPN connect timeout, ignore in VPN agent wait Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 6/9] provider: Handle VPN configuration and association states Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 7/9] vpn: Add support for association state, add state getter Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 8/9] vpn: Check if connecting when setting state or disconnecting Jussi Laakkonen
2022-12-13 14:07 ` [RFC PATCH 9/9] doc: Update VPN documentation for association state Jussi Laakkonen
2023-01-02  8:10 ` [RFC PATCH 0/9] Add association state for VPNs Daniel Wagner
2023-01-05 11:39   ` Jussi Laakkonen
2023-02-27  7:34     ` Daniel Wagner

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