service: Implement a do_auto_connect() to include VPNs in autoconnect

This commit adds a function to include VPNs in service.c internal
autoconnect processes. Use of do_auto_connect() should be preferred
within service.c instead of __connman_service_auto_connect(). Reason is
that auto_connect_service(), which is called by run_auto_connect(),
ignores VPN services when connecting a service using preferred tech
list.

Function do_auto_connect() starts both service and VPN auto connection
in case the service is not VPN type service. For a VPN type service
running vpn_auto_connect() is sufficient and connection reason has to
be set as user/auto.

VPN services should not be kept reconnecting if the VPN is in failure
state unless the user has requested a connection. This is because
do_auto_connect() can be triggered via service_complete() by an VPN that
is entering failure state in service_indicate_state(). Otherwise the
timeout of vpn_auto_connect() will be reset and the delays for VPN
connections are being reset likewise. It must be user's request that
resets the timer. In case the network conditions cause the failure other
autoconnection mechanisms do trigger re-connection of VPN, which rely on
correct state reporting from connman-vpnd.
1 file changed