Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openvpn: Disable connection retry attempts when TCP is used as transport
By default OpenVPN will retry the connection ad infinitum with TCP unless the limit is explicitly specified. The process is not restarted, nor is the error reported via management channel. When establishing the connection following is being output by OpenVPN if the TCP connection is reset, but none of this is reported back to ConnMan and OpenVPN keeps on trying: openvpn[18161]: Attempting to establish TCP connection with [AF_INET]<IP>:<PORT> [nonblock] openvpn[18161]: TCP connection established with [AF_INET]<IP>:<PORT> openvpn[18161]: TCP_CLIENT link local: (not bound) openvpn[18161]: TCP_CLIENT link remote: [AF_INET]<IP>:<PORT> openvpn[18161]: Connection reset, restarting [0] openvpn[18161]: SIGUSR1[soft,connection-reset] received, process restarting openvpn[18161]: Restart pause, 5 second(s) The delay will increase up to 300s. And the process may just keep on going if the connection is only reset. If the TCP connection breaks while OpenVPN is in connected state, and hostname of the VPN server is used following is output by OpenVPN - and still none of this is reported to ConnMan via management socket: openvpn[5639]: RESOLVE: Cannot resolve host address: <addr> (Temporary failure in name resolution) openvpn[5639]: RESOLVE: Cannot resolve host address: <addr> (Temporary failure in name resolution) openvpn[5639]: Could not determine IPv4/IPv6 protocol openvpn[5639]: SIGUSR1[soft,init_instance] received, process restarting openvpn[5639]: Restart pause, 160 second(s) After this network neturally ceases to work, DNS servers set cannot respond because there is no TCP connection to the VPN server and the VPN adapter set as default route will drop all packets because of that. For this reason it is better to let OpenVPN connect only once and report the error back to ConnMan. Therefore, disable connection retrying by setting the retry count to 1 (no retry).
- Loading branch information