The different returns from VPN agent should be handled accordingly in VPN
plugins as well as in connmand. Otherwise there will be a race between each
VPN agent supporting VPN type as canceling or timeouting the VPN agent dialog
would not unset the autoconnect value (to false) and change is not propagated to
service file written to disk. This will manifest itself after the next restart
of connmand as continuous connect-disconnect-connect loop between the VPNs that
were attempted to connect but their VPN agent dialog was canceled.
This set of patches enables processing of the different VPN agent return types
and ensures that autoconnect value changes are done internally and written to
disk. Improved processing of VPN agent return is used in the VPN plugins that
utilize it (L2TP, OpenConnect, PPTP and VPNC, OpenVPN is excluded) and a proper
reply is sent back to caller.
Each aforementioned plugin should not have own implementation of error checking
and thus, a generic one is implemented in vpn-agent.c. Processing of the error
is done using the callback of the VPN plugin, which eventually is
vpn-provider.c:connect_cb() that is also amended to support the different error
types. If there is no error returned from VPN agent normal operation is resumed.
The returned error is then passed to caller as appropriate D-Bus error message.
The caller (plugins/vpn.c) should be able to disable VPN autoconnect if the user
has cancelled the VPN agent dialog. For this the new error type
OperationCanceled (ECANCELED) is implemented and setters for autoconnect value
are created into provider.c and service.c.
Jussi Laakkonen (10):
vpn-agent: Implement generic D-Bus error checker for plugins.
vpn-provider: React to different error types in connect_cb()
l2tp: Use vpn-agent.c error processing for VPN agent errors.
openconnect: Use vpn-agent.c error processing for VPN agent errors.
pptp: Use vpn-agent.c error processing for VPN agent errors.
vpnc: Use vpn-agent.c error processing for VPN agent errors.
service: Implement function to set service autoconnect value
provider: Implement function to set VPN service autoconnect value
error: Implement OperationCanceled error type
vpn: Handle OperationCanceled D-Bus message reply
include/provider.h | 2 ++
include/service.h | 2 ++
plugins/vpn.c | 14 +++++++++++-
src/connman.h | 1 +
src/error.c | 8 +++++++
src/provider.c | 11 +++++++++
src/service.c | 12 ++++++++++
vpn/plugins/l2tp.c | 18 ++++++++++++---
vpn/plugins/openconnect.c | 11 +++++++--
vpn/plugins/pptp.c | 18 ++++++++++++---
vpn/plugins/vpnc.c | 40 +++++++-------------------------
vpn/vpn-agent.c | 48 +++++++++++++++++++++++++++++++++++++++
vpn/vpn-agent.h | 4 ++++
vpn/vpn-provider.c | 46 +++++++++++++++++++++++++++++++++++--
14 files changed, 192 insertions(+), 43 deletions(-)