mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 20:13:05 +02:00
ae99307219
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> |
||
---|---|---|
.. | ||
client | ||
server | ||
altproxy.hpp | ||
dco.hpp | ||
gremlin.hpp | ||
mssfix.hpp | ||
mutate.hpp | ||
pktstream.hpp | ||
protocol.hpp | ||
reconnect_notify.hpp | ||
socket_protect.hpp | ||
tcplink.hpp | ||
tcplinkbase.hpp | ||
tcplinkcommon.hpp | ||
udplink.hpp |