0
0
mirror of https://github.com/OpenVPN/openvpn3.git synced 2024-09-20 20:13:05 +02:00
Commit Graph

1300 Commits

Author SHA1 Message Date
James Yonan
3ccb094f79 In openvpn/addr/route.hpp, added route_from_string_prefix(). 2015-11-10 23:05:26 -07:00
James Yonan
054946ca5f Minor mod to openvpn/common/abort.hpp for C++11. 2015-11-10 23:04:05 -07:00
James Yonan
2f40c52fbc Change to calls of Windows API methods:
* Where unicode/ansi versions of a method exist, always
  explicitly call one of unicode or ansi methods by
  appending a 'W' or 'A' to the end of the method name.
  Never omit the 'W' or 'A' because that will cause the
  default method to be used which may vary according to
  build flags.

* Prepend all Windows API method references with "::" to
  indicate that the method names should be resolved from
  the top-level namespace.
2015-11-09 14:56:08 -07:00
James Yonan
2c7bfc37ed Added new file openvpn/common/sleep.hpp with
portable sleep_milliseconds() function.
2015-11-05 16:11:49 -08:00
James Yonan
9d87472e3c In tunutil.hpp, show Windows error strings for RegOpenKeyEx
errors that throw an exception.
2015-11-05 14:50:25 -07:00
James Yonan
2a3a73bfe1 Windows build system changes:
* Support static linking via "STATIC" parm.

* New methods in utils.py: rm, rm_obj, vc_parms, zipdir.
2015-11-03 13:11:16 -07:00
James Yonan
f162a5b491 Windows: added WFP-based packet filter to prevent DNS leaks
when tunnel is active.

Based on ValdikSS's C patch for OpenVPN 2.x:
  3bd4d503d2
2015-11-02 20:19:04 -07:00
James Yonan
c859a46187 Added class Cleanup (openvpn/common/cleanup.hpp), a
general model for executing a std::function in the
destructor.
2015-11-02 20:10:46 -07:00
James Yonan
d08cc059e7 Implemented "block-ipv6" directive for Windows. 2015-11-01 17:37:05 -07:00
James Yonan
eb9ac6eb83 Added regex verification of WinCmd command strings.
Includes new source file openvpn/addr/regex.hpp
containing validating regular expressions for
IPv4/v6.
2015-11-01 15:11:36 -07:00
James Yonan
64087b88e5 In win/utils.py, changed wipetree() signature to:
wipetree(dir, wipe=True)

where wipetree always recreates the directory
but the actual wiping is optional.
2015-11-01 15:05:53 -07:00
James Yonan
9fac4c0770 win/call.hpp mostly stylistic cleanup:
* Prefix Windows API calls with "::"
* Fix comment alignment
2015-11-01 15:03:05 -07:00
James Yonan
8cacebfd7a Modularize Windows build system to make it easier for external
scripts to drive it.
2015-11-01 00:46:55 -06:00
James Yonan
5c76a94bf2 Moved deps/win to win for ease of reference. 2015-10-30 20:06:49 -06:00
James Yonan
dcebf7b559 Added sort parameter (bool) to enum_dir() to sort results. 2015-10-30 16:41:18 -06:00
James Yonan
4b1379e919 In hexstr.hpp, extended dump_hex() to show both hex and ascii. 2015-10-30 16:39:38 -06:00
James Yonan
d4be16c109 Added string::is_printable() methods for char and unsigned char. 2015-10-30 16:38:41 -06:00
James Yonan
1d855b1ef1 Minimal update to Linux tuncli.hpp to accomodate new
ActionList changes and fix compiler breakage.
2015-10-28 22:37:59 -07:00
James Yonan
f10f03bbc7 Very minimal update to Mac tuncli.hpp to accomodate new
ActionList changes and fix compiler breakage.
2015-10-28 23:26:15 -06:00
James Yonan
4c7f7af10d In process.hpp, added new system_cmd() variant that uses pipes
to communicate with subprocess and provides std::strings for
input/output/error.

Updated Command class with new execute() signature.

Added RedirectPipe (redir.hpp) to deal with handling
input/output/error pipes for a subprocess.
2015-10-28 22:40:15 -06:00
James Yonan
27061e01b1 In openvpn/common/signal.hpp, added SIGPIPE support. 2015-10-28 22:38:14 -06:00
James Yonan
1b0ac32140 In BufferList, added put_consume() method. 2015-10-28 22:37:04 -06:00
James Yonan
79fdea43d2 buffer.hpp changes:
* added const_buffers_1_limit() method that is like
  const_buffers_1_clamp() but includes an upper-bound size
  constraint.

* realign() should be a no-op if headroom == offset_

* added additional reset() convenience method that also calls
  init_headroom()
2015-10-28 22:33:26 -06:00
James Yonan
03dcf82004 Changed OPENVPN_COMMAND_AGENT #include to:
<openvpn/client/<platform>/cmdagent.hpp>

Where platform should be "win" or "mac".
2015-10-27 20:04:13 -06:00
James Yonan
4ea436667e Windows TAP interface code:
* Work with new polymorphic ActionList objects.

* Implemented TAP setup code for pre-Vista Windows
  (when _WIN32_WINNT < 0x0600).

* Still to do: sanity check input to from_json_untrusted()
  methods.
2015-10-27 18:56:02 -06:00
James Yonan
0cb18b6084 Created new ActionListFactory abstraction, to allow client tun
implementations to provide custom ActionList handlers.
This can be used, for example, to forward tun configuration
commands requiring higher privileges to a remote daemon.
2015-10-27 18:34:13 -06:00
James Yonan
aa4f2773f3 Added openvpn/common/wstring.hpp for classes that deal
with wchar_t and std::wstring types.
2015-10-27 18:30:57 -06:00
James Yonan
226aa0825c Minor change to LogBase -- added Ptr typedef for smart pointer. 2015-10-27 18:28:29 -06:00
James Yonan
5e1a706c67 Added string::remove_blanks() method. 2015-10-27 18:19:32 -06:00
James Yonan
a267d9b32a In bufstr.hpp, added buf_append_string() methods. 2015-10-27 18:18:09 -06:00
James Yonan
617a74a8e9 Added new method IPv4::Addr::extent_from_netmask_uint32(). 2015-10-27 18:15:07 -06:00
James Yonan
5200ab2c38 Windows build system changes:
1. Use os.path.join(parms['BUILD'], parms['ARCH']) as the build
   directory, to allow concurrent build directories to exist for
   multiple architectures.

2. Allow extra build parameters to be specified out-of-tree
   in c:/src/ovpn3/common/deps/win/extra.py
2015-10-27 17:46:31 -06:00
James Yonan
a94b4815f4 Windows build system:
* Added support for x86_xp target for Windows XP, but
  note that this requires that vcvarsall.patch be
  applied.

* Fixed issue where wipetree() was failing if target
  directory didn't exist.

* build.py can now infer trailing .cpp on argument.
2015-10-25 21:21:31 -06:00
James Yonan
a6b5e84905 urlparse.hpp : if URI is empty, set to "/". 2015-10-24 18:28:04 -06:00
James Yonan
c393d3d3ba Added some missing includes to altproxy.hpp. 2015-10-23 13:42:00 -06:00
James Yonan
97384f66f6 Added to_string() method to BufferList. 2015-10-23 11:12:49 -06:00
James Yonan
ac2da3dc07 Minor change to MacDNS to_string() formatting. 2015-10-23 11:00:59 -06:00
James Yonan
cc4acb8996 Added stub implementations for Log::Context and
Log::Context::Wrapper when logsimple.hpp is being used.
2015-10-19 08:11:55 -07:00
James Yonan
5f6989465a Fixed recent regression in userpass.hpp where parse()
method was failing to identify auth-user-pass directive
when given without parameters.
2015-10-19 08:07:17 -07:00
James Yonan
cabb3917cd Implemented tcp-queue-limit parameter for OpenVPN 3 client,
with a default value of 64 (this is the same parameter name
and default from OpenVPN 2 server).

tcp-queue-limit sets a maximum size limit on the outgoing
TCP packet queue and will drop packets and increment the
TCP_OVERFLOW counter if the limit would be exceeded.

Previously, the limit was hardcoded at 1024 packets and
would result in a disconnect/reconnect if exceeded rather
than merely dropping the packet.
2015-10-18 23:32:13 -07:00
James Yonan
a35ed0375f Removed write_private() as it's no longer used on this branch. 2015-10-18 15:21:25 -07:00
James Yonan
ee6882725b Added comment that class UMask is not thread-safe. 2015-10-18 15:07:17 -07:00
James Yonan
94d6a7419f Added Win::Error and Win::LastError wrappers
around asio::error_code (openvpn/win/winerr.hpp).
2015-10-18 07:25:48 -06:00
James Yonan
979f04174f URL::Parse changes:
* Added from_components() static initializer.

* In to_string() method, don't include the port number
  in the URL if it is standard, i.e. 80 for http or 443
  for https.

* In to_string() method, bracket the host/address if it
  contains one of these chars: ':', '/', or '\'.

* Normalize and document the usage where special address
  types such as unix domain sockets or windows named pipes
  store a tag such as "unix" or "np" as the port component
  of an address/port tuple.
2015-10-17 11:49:40 -06:00
James Yonan
32b6912931 Added Windows named-pipe support to RemoteList,
Listen::List, Protocol, and AsioPolySock.
2015-10-16 21:00:51 -06:00
James Yonan
98dcae166c In class ScopedHANDLE (Windows), added C++11 move
construction/assignment.
2015-10-16 20:57:28 -06:00
James Yonan
137bd7a07b Lowered the warning level of Windows build script to zero,
as higher values generate too many false positives.
2015-10-16 20:54:43 -06:00
James Yonan
7b14dae436 In zlib.hpp, don't compile zlib code unless
HAVE_ZLIB is defined.

In scripts/build-extras/zlib.sh, define
HAVE_ZLIB when running build script with
ZLIB=1.
2015-10-16 13:49:11 -06:00
James Yonan
b319973fec Added URL::Parse() class for parsing/validating URLs. 2015-10-15 23:45:00 -07:00
James Yonan
f6ae9caec3 In tlsver.hpp, break out parse_tls_version_min() core
functionality into a new method that can be called
with simple parameters and without an OptionList.
2015-10-15 23:40:52 -07:00