This set of patches addresses the issue of replying a VPN connection
request twice. Also the VPN connection requests are limited to one per
VPN. Connecting a previously failed VPN is also improved.
The plugins/vpn.c is enhanced to keep track of connection requests. If
there is a pending call to connect the VPN report -EALREADY and handle
that in provider.c. This must not create a state change indication but
only inform that the connection is still in progress.
Each connection request must be replied only once and vpn-provider.c:
do_connect() must not reply to the call immediately if -EINPROGRESS is
returned. This is because vpn-provider.c:connect_cb() will send an
appropriate reply later using the VPN plugin return code. If the VPN
is in failure state or is disconnecting a direct reply must be sent as
VPN plugin connect() is not called, thus connect_cb() is not reached.
Also, when a VPN settings are saved the previously set failure state
must be changed to idle. This then follows same approach as it is used
with error counters (reset when settings saved).
The error and state must be also reset, when user changes autoconnect
value for the VPN to true value. This is similar to when connecting a
VPN using D-Bus method Connect(). Without changing the state autoconnect
for the VPN (service.c:do_auto_connect()) does not work as with
CONNMAN_SERVICE_CONNET_REASON_AUTO a VPN in failure state should not
Jussi Laakkonen (5):
vpn-provider: Change provider in failure state to idle when saving
vpn-provider: Always reply to connect request D-Bus message
vpn: Restrict connection requests to one per connection
provider: Handle -EALREADY in __connman_provider_connect()
service: Clear VPN error and state if AutoConnect is set on
plugins/vpn.c | 42 ++++++++++++++++++++++++++++++----
src/provider.c | 17 +++++++++-----
src/service.c | 56 +++++++++++++++++++++++++++++++++++++++-------
vpn/vpn-provider.c | 19 +++++++++++++++-
4 files changed, 116 insertions(+), 18 deletions(-)