0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00
openvpn3/openvpn/transport
Lev Stipakov ae99307219
tun: add persis-tun support for dco-win
Add DcoTunPersist object to DCO::TunConfig.

DcoTunPersist stores:

 - device handle
 - tun settings
 - adapter index/name
 - pointer to TunSetup object, which itself
 stores commands to undo tun settings

When intializing client options, instantiate DcoTunPersist
object within the scope of ClientConfig, which serves as
transport and tun factory for dco. Indicate that "sock" object
(device handle) should be preserved - not replaced when persisting
tun settings.

When establishing dco-win connection in OvpnDcoWinClient,
either use tun_persist created above (if persistance is enabled)
or instantiate it in-place (no persistance).

If nothing is stored in tun_persist (means this is first
connection or reconnect without persistance), acquire device
handle from tun_setup, wrap it into ASIO's basic_stream_handle
and store it in OvpnDcoWinClient - no need to persist it yet.

When starting tun, check if persisted tun session matches
to-be-created session. If no - clear previous tun settings,
set up tun and persist tun state. If device handle is already
stored in tun_persist, it won't be replaced.

On tun stop, send DEL_PEER command, which deletes peer
from the driver but keeps adapter in connected state. Then
close locally stored ASIO handle and reset tun_persist.
In case of "short term persistance" this will undo tun settings
and close device handle. For long term persistence, tun_persist
is also stored in ClientConfig and handle won't be closed yet.

In case of disconnect, ClientConfig::finalize(disconnect=true)
is called, which resets tun_persist, which in turn
undoes tun settings and closes device handle.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
2022-10-13 15:16:25 +02:00
..
client mark a couple of methods override instead of virtual 2021-09-28 15:29:03 +02:00
server ManClientInstance, ServerProto::Session, TransportClientInstance::Recv: added ipma_notify() virtual method 2022-02-07 13:56:13 -07:00
altproxy.hpp Update copyrights 2020-03-18 19:37:32 +01:00
dco.hpp tun: add persis-tun support for dco-win 2022-10-13 15:16:25 +02:00
gremlin.hpp Update copyrights 2020-03-18 19:37:32 +01:00
mssfix.hpp support for default mssfix 2022-05-04 18:15:07 +03:00
mutate.hpp Update copyrights 2020-03-18 19:37:32 +01:00
pktstream.hpp PacketStream: change message size validation logic to support growable buffers for DNS-over-TCP 2021-08-03 10:42:35 +02:00
protocol.hpp fix occ proto strings 2021-06-10 22:40:18 +02:00
reconnect_notify.hpp Update copyrights 2020-03-18 19:37:32 +01:00
socket_protect.hpp Update copyrights 2020-03-18 19:37:32 +01:00
tcplink.hpp Update copyrights 2020-03-18 19:37:32 +01:00
tcplinkbase.hpp Update copyrights 2020-03-18 19:37:32 +01:00
tcplinkcommon.hpp TCPTransport::LinkCommon: updated initialization of halt to use C++11 member initializer 2021-05-31 13:34:44 -06:00
udplink.hpp Update copyrights 2020-03-18 19:37:32 +01:00