mirror of
https://github.com/OpenVPN/openvpn3.git
synced 2024-09-20 04:02:15 +02:00
OpenVPN 3 client now supports compile-time overriding of
tun factory using OPENVPN_CUSTOM_TUN_FACTORY.
This commit is contained in:
parent
efcba26714
commit
17057f5dc7
@ -63,7 +63,9 @@
|
||||
|
||||
// boost asserts on null smart pointer dereferences are fairly useless
|
||||
// since a segfault will generate more actionable debug info
|
||||
#ifndef BOOST_DISABLE_ASSERTS
|
||||
#define BOOST_DISABLE_ASSERTS
|
||||
#endif
|
||||
|
||||
// if 1, enable special PRNG that is distinct from RNG
|
||||
#ifndef ENABLE_PRNG
|
||||
@ -76,23 +78,22 @@
|
||||
// log cleartext tunnel packets to file for debugging/analysis
|
||||
//#define OPENVPN_PACKET_LOG "pkt.log"
|
||||
|
||||
#ifndef OPENVPN_LOG
|
||||
// log thread settings
|
||||
#define OPENVPN_LOG_CLASS openvpn::ClientAPI::OpenVPNClient
|
||||
#define OPENVPN_LOG_INFO openvpn::ClientAPI::LogInfo
|
||||
#include <openvpn/log/logthread.hpp> // should be included early
|
||||
#endif
|
||||
|
||||
// log SSL handshake messages
|
||||
#define OPENVPN_LOG_SSL(x) OPENVPN_LOG(x)
|
||||
|
||||
// on Android and iOS, use TunBuilderBase abstraction
|
||||
#include <openvpn/common/platform.hpp>
|
||||
#if (defined(OPENVPN_PLATFORM_ANDROID) || defined(OPENVPN_PLATFORM_IPHONE)) && !defined(OPENVPN_FORCE_TUN_NULL)
|
||||
#if (defined(OPENVPN_PLATFORM_ANDROID) || defined(OPENVPN_PLATFORM_IPHONE)) && !defined(OPENVPN_FORCE_TUN_NULL) && !defined(OPENVPN_CUSTOM_TUN_FACTORY)
|
||||
#define USE_TUN_BUILDER
|
||||
#endif
|
||||
|
||||
#ifndef OPENVPN_LOG
|
||||
#include <openvpn/log/logthread.hpp> // should be included early
|
||||
#endif
|
||||
|
||||
#include <openvpn/init/initprocess.hpp>
|
||||
#include <openvpn/common/types.hpp>
|
||||
#include <openvpn/common/scoped_ptr.hpp>
|
||||
|
@ -60,7 +60,9 @@
|
||||
#include <openvpn/random/prng.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(USE_TUN_BUILDER)
|
||||
#if defined(OPENVPN_CUSTOM_TUN_FACTORY)
|
||||
// includer of this file must define OPENVPN_CUSTOM_TUN_FACTORY class
|
||||
#elif defined(USE_TUN_BUILDER)
|
||||
#include <openvpn/tun/builder/client.hpp>
|
||||
#elif defined(OPENVPN_PLATFORM_LINUX) && !defined(OPENVPN_FORCE_TUN_NULL)
|
||||
#include <openvpn/tun/linux/client/tuncli.hpp>
|
||||
@ -270,7 +272,16 @@ namespace openvpn {
|
||||
#endif
|
||||
|
||||
// initialize tun/tap
|
||||
#if defined(USE_TUN_BUILDER)
|
||||
#if defined(OPENVPN_CUSTOM_TUN_FACTORY)
|
||||
OPENVPN_CUSTOM_TUN_FACTORY::Ptr tunconf = OPENVPN_CUSTOM_TUN_FACTORY::new_obj();
|
||||
tunconf->tun_prop.session_name = session_name;
|
||||
tunconf->tun_prop.google_dns_fallback = config.google_dns_fallback;
|
||||
if (tun_mtu)
|
||||
tunconf->tun_prop.mtu = tun_mtu;
|
||||
tunconf->frame = frame;
|
||||
tunconf->stats = cli_stats;
|
||||
tunconf->tun_prop.remote_list = remote_list;
|
||||
#elif defined(USE_TUN_BUILDER)
|
||||
TunBuilderClient::ClientConfig::Ptr tunconf = TunBuilderClient::ClientConfig::new_obj();
|
||||
tunconf->builder = config.builder;
|
||||
tunconf->tun_prop.session_name = session_name;
|
||||
|
Loading…
Reference in New Issue
Block a user