Squashed 'OpenVPN Adapter/Vendors/openvpn/' changes from da99df6..4095565

4095565 OpenVPN 3 client: added tun abstraction layer.
4bfaafc AsioTimer: use expires_after() method when possible.
782e8eb Apple: moved some source files.
f89da96 OpenVPN 3 client: added single-thread mode:
233dfde OpenVPN 3 client: fixed state->session typos.
d689b6d Added new Apple Core Foundation wrappers:
3838a62 i/o layer: added OPENVPN_IO_REQUIRES_STOP compile flag.
138ec96 asiopolysock.hpp: don't call SockOpt::set_cloexec(fd) if fd is undefined (i.e. fd == -1).
10eb723 Apple CF wrapper: renamed OWN/BORROW.
962fe87 Apple CF wrapper: simplify cf.hpp dependency profile.
4fcc99c Objective C++: fix symbol conflicts.
8f63cbb tunwrapasio.hpp: make generic with respect to i/o layer.
67e0013 AsioTimer: added expires_after() method.
fc7eaaf Apple CF wrappers: moved CFRunLoop/CFRunLoopSource wrapper to applecrypto/cf, where all other CF wrappers currently reside.
1215912 Revamped Function (our own functor object) to be more flexible.
10fa276 process.hpp: added compile option to avoid async pipe usage.
9e09451 gwv4.hpp: added missing includes
916856d build script: updated Objective-C support when OBJC=1.

git-subtree-dir: OpenVPN Adapter/Vendors/openvpn
git-subtree-split: 4095565b4de2c7d738e728cae989f632100a8ce8
This commit is contained in:
Sergey Abramchuk
2017-04-15 11:59:39 +03:00
parent f65d76170b
commit 9b95600d06
39 changed files with 773 additions and 223 deletions
+25 -15
View File
@@ -66,8 +66,9 @@
#include <openvpn/client/cliemuexr.hpp>
#endif
#if defined(OPENVPN_CUSTOM_TUN_FACTORY)
// includer of this file must define OPENVPN_CUSTOM_TUN_FACTORY class
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
// requires that client implements ExternalTun::Factory::new_tun_factory
#include <openvpn/tun/extern/config.hpp>
#elif defined(USE_TUN_BUILDER)
#include <openvpn/tun/builder/client.hpp>
#elif defined(OPENVPN_PLATFORM_LINUX) && !defined(OPENVPN_FORCE_TUN_NULL)
@@ -151,6 +152,10 @@ namespace openvpn {
#if defined(USE_TUN_BUILDER)
TunBuilderBase* builder = nullptr;
#endif
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
ExternalTun::Factory* extern_tun_factory = nullptr;
#endif
};
ClientOptions(const OptionList& opt, // only needs to remain in scope for duration of constructor call
@@ -191,7 +196,7 @@ namespace openvpn {
rng.reset(new SSLLib::RandomAPI(false));
prng.reset(new SSLLib::RandomAPI(true));
#if defined(ENABLE_DCO) && !defined(OPENVPN_FORCE_TUN_NULL) && !defined(OPENVPN_CUSTOM_TUN_FACTORY)
#if defined(ENABLE_DCO) && !defined(OPENVPN_FORCE_TUN_NULL) && !defined(OPENVPN_EXTERNAL_TUN_FACTORY)
if (config.dco)
dco = DCOTransport::new_controller();
#else
@@ -292,17 +297,22 @@ namespace openvpn {
}
else
{
#if defined(OPENVPN_CUSTOM_TUN_FACTORY)
#if defined(OPENVPN_EXTERNAL_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;
ExternalTun::Config tunconf;
tunconf.tun_prop.layer = layer;
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;
tun_factory = tunconf;
tunconf.tun_prop.mtu = tun_mtu;
tunconf.frame = frame;
tunconf.stats = cli_stats;
tunconf.tun_prop.remote_list = remote_list;
tunconf.tun_persist = config.tun_persist;
tunconf.stop = config.stop;
tun_factory.reset(config.extern_tun_factory->new_tun_factory(tunconf, opt));
if (!tun_factory)
throw option_error("OPENVPN_EXTERNAL_TUN_FACTORY: no tun factory");
}
#elif defined(USE_TUN_BUILDER)
{
@@ -448,7 +458,7 @@ namespace openvpn {
// IPv6
{
const unsigned int n = push_base->singleton.extend(opt, "block-ipv6");
if (!n && config.ipv6() == IPv6Setting::NO)
if (!n && config.ipv6() == IPv6Setting::No)
push_base->singleton.emplace_back("block-ipv6");
}
}
@@ -463,9 +473,9 @@ namespace openvpn {
PeerInfo::Set::Ptr pi(new PeerInfo::Set);
// IPv6
if (config.ipv6() == IPv6Setting::NO)
if (config.ipv6() == IPv6Setting::No)
pi->emplace_back("IV_IPv6", "0");
else if (config.ipv6() == IPv6Setting::YES)
else if (config.ipv6() == IPv6Setting::Yes)
pi->emplace_back("IV_IPv6", "1");
// autologin sessions