0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 04:02:15 +02:00

dcocli.cpp: add missing socket_protect call

As other transport clients, call socket_protect()
before establishing connection.

This gives ability to create bypass route.

Signed-off-by: Lev Stipakov <lev@openvpn.net>
This commit is contained in:
Lev Stipakov 2020-08-21 10:30:30 +00:00
parent 5bc16a71ef
commit e419e07c7f
3 changed files with 12 additions and 0 deletions

View File

@ -790,6 +790,7 @@ namespace openvpn {
transconf.frame = frame;
transconf.stats = cli_stats;
transconf.server_addr_float = server_addr_float;
transconf.socket_protect = socket_protect;
transport_factory = dco->new_transport_factory(transconf);
}
else if (alt_proxy)

View File

@ -335,6 +335,16 @@ namespace openvpn {
transport_parent->transport_wait();
udp().socket.open(udp().server_endpoint.protocol());
if (config->transport.socket_protect)
{
if (!config->transport.socket_protect->socket_protect(udp().socket.native_handle(), server_endpoint_addr()))
{
stop();
transport_parent->transport_error(Error::UNDEF, "socket_protect error (UDP)");
return;
}
}
udp().socket.async_connect(udp().server_endpoint, [self=Ptr(this)](const openvpn_io::error_code& error)
{
self->start_impl_udp(error);

View File

@ -53,6 +53,7 @@ namespace openvpn {
bool server_addr_float;
Frame::Ptr frame;
SessionStats::Ptr stats;
SocketProtect* socket_protect = nullptr;
};
struct TunConfig