Merge commit '82fea30fcce1d169de7ec42be84d079e0899519c' into feature/update-dependenies

This commit is contained in:
Sergey Abramchuk
2018-01-08 11:44:56 +03:00
437 changed files with 7377 additions and 2864 deletions
@@ -1 +1,4 @@
README.html README.html
x64
*.vcxproj.user
*.ipch
@@ -0,0 +1,60 @@
dist: trusty
os: linux
language: cpp
env:
global:
- secure: "dqiLqbzug/xs6F4Q9ei1pGpNf9Q6H3+iKN1W+P0TtODbCXPr/mLWdvHGVMIMqr7H7rBrIUPFPrfqd80nu3jQuQonjcHK/XyJJfmf5hUdhGAszSaixhWnGfVmn/VSV7/5+9DGAU3l9S6YZg4lvi12+cOrlblNgx8GeI5VdN/6HBSHkEqKNI56qn3Y+ugSdLeL1opmzlY58vRsCCmpBH8Ronn4tmSyi85/WZXfF43o9FGGJcygdh6QVWA1CDdNMeLTCt9ld+oToUIiFLiUrhfS1JpSvzysz2xsuEntxZaTMDYPyL4+O8Mj/scl6ejLLXzxTNa7AZOgySLBahf+F4b+yhL1deSVuu40MfxPW6XiM1jKy3KPH/GlYgM8CZQ3D1hQIq1CIUg8DgnTa06RUzevsR5DqDvz+EcPanFHE7dHGrPy9Rs/0y59dNHp3qWKjWMoSA06GerbF61XFOb4mcE29053kV8uxqIa5ZShZ/ndoLeVpQ4mZ+/XSkUybysVl0gWrKnnNNEPtqrdmKf+jlmKY0jyRPdwf425Ldn+wcbGw9ZEnkosYzqAhDBDX4OETAKLi8G0FEYECKKQcd1OX+HNvsOIyOAoLOj7H30F8UkPsjR3ysdIEmc6702ly06gDYjWmwQaCigL/1ktRKgf7ePB0HS+8fOa5SML7619kQrGrWA="
- PREFIX="${HOME}/opt"
- ASIO_VERSION="862aed305dcf91387535519c9549c17630339a12"
- LZ4_VERSION="1.7.5"
- MBEDTLS_VERSION="2.5.1"
- MBEDTLS_CFLAGS="-I${PREFIX}/include"
- MBEDTLS_LIBS="-lmbedtls -lmbedx509 -lmbedcrypto"
- OPENSSL_VERSION="1.0.2l"
- OPENSSL_CFLAGS="-I${PREFIX}/include"
- OPENSSL_LIBS="-lssl -lcrypto"
- COVERITY_BRANCH="master"
matrix:
include:
- env: SSLLIB="openssl"
os: osx
osx_image: xcode8.3
compiler: clang
- env: SSLLIB="mbedtls"
os: osx
osx_image: xcode8.3
compiler: clang
- env: SSLLIB="openssl" RUN_COVERITY_SCAN="1"
os: linux
compiler: gcc
- env: SSLLIB="openssl"
os: linux
compiler: clang
- env: SSLLIB="mbedtls"
os: linux
compiler: gcc
- env: SSLLIB="mbedtls"
os: linux
compiler: clang
addons:
apt:
packages:
- libboost-all-dev
- linux-libc-dev
cache:
ccache: true
directories:
- download-cache
- ${HOME}/opt
install:
- .travis/build-deps.sh
script:
- .travis/build-check.sh
+75
View File
@@ -0,0 +1,75 @@
#!/bin/sh
set -eux
PREFIX="${PREFIX:-${HOME}/opt}"
RUN_COVERITY_SCAN="${RUN_COVERITY_SCAN:-0}"
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
export LD_LIBRARY_PATH="${PREFIX}/lib:${LD_LIBRARY_PATH:-}"
fi
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
export DYLD_LIBRARY_PATH="${PREFIX}/lib:${DYLD_LIBRARY_PATH:-}"
fi
if [ "${SSLLIB}" = "openssl" ]; then
SSL_LIBS="${OPENSSL_LIBS}"
SSL_CFLAGS="-DUSE_OPENSSL"
elif [ "${SSLLIB}" = "mbedtls" ]; then
SSL_LIBS="${MBEDTLS_LIBS}"
SSL_CFLAGS="-DUSE_MBEDTLS"
else
echo "Invalid crypto lib: ${SSLLIB}"
exit 1
fi
LIBS="${SSL_LIBS} -llz4"
CXXFLAGS="-O3 -std=c++11 -Wall -pthread \
-DOPENVPN_SHOW_SESSION_TOKEN -DHAVE_LZ4 \
-DUSE_ASIO -DASIO_STANDALONE -DASIO_NO_DEPRECATED ${SSL_CFLAGS}"
if [[ "${CC}" == "gcc"* ]]; then
CXXFLAGS="${CXXFLAGS} -fwhole-program -flto=4"
fi
INCLUDEDIRS="-I../../asio/asio/include -I${PREFIX}/include -I../../"
LDFLAGS="-L${PREFIX}/lib"
if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
LDFLAGS="${LDFLAGS} -Wl,--no-as-needed"
fi
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
CXXFLAGS="${CXXFLAGS} -stdlib=libc++ -arch x86_64"
LIBS="${LIBS} -framework Security \
-framework CoreFoundation \
-framework SystemConfiguration \
-framework IOKit \
-framework ApplicationServices"
fi
(
cd test/ovpncli
${CXX} ${CXXFLAGS} ${INCLUDEDIRS} ${LDFLAGS} cli.cpp -o cli ${LIBS}
)
(
cd test/ssl
${CXX} ${CXXFLAGS} -DNOERR ${INCLUDEDIRS} ${LDFLAGS} proto.cpp -o proto ${LIBS}
./proto
)
if [ "${RUN_COVERITY_SCAN}" = "1" -a "${TRAVIS_BRANCH}" = "${COVERITY_BRANCH}" ]; then
unset LD_LIBRARY_PATH #don't mess up SSL for curl/wget
export COVERITY_SCAN_PROJECT_NAME="OpenVPN/openvpn3"
export COVERITY_SCAN_BRANCH_PATTERN="${COVERITY_BRANCH}"
export COVERITY_SCAN_NOTIFICATION_EMAIL="scan-reports@openvpn.net"
export COVERITY_SCAN_BUILD_COMMAND_PREPEND="cd test/ssl"
export COVERITY_SCAN_BUILD_COMMAND="${CXX} ${CXXFLAGS} ${INCLUDEDIRS} \
${LDFLAGS} proto.cpp -o proto ${LIBS}"
# Ignore exit code, script exits with 1 if we're not on the right branch
curl -s "https://scan.coverity.com/scripts/travisci_build_coverity_scan.sh" | bash || true
fi
+133
View File
@@ -0,0 +1,133 @@
#!/bin/sh
set -eux
# Set defaults
PREFIX="${PREFIX:-${HOME}/opt}"
download_asio () {
if [ ! -d "download-cache/asio" ]; then
git clone https://github.com/chriskohlhoff/asio.git \
download-cache/asio
else
(
cd download-cache/asio
if [ "$(git log -1 --format=%H)" != "${ASIO_VERSION}" ]; then
git checkout master
git pull
git checkout ${ASIO_VERSION}
fi
)
fi
}
build_asio () {
(
if [ ! -L asio ]; then
rm -Rf asio
ln -s download-cache/asio asio
fi
)
}
download_lz4 () {
if [ ! -f "download-cache/lz4-${LZ4_VERSION}.tar.gz" ]; then
wget "https://github.com/lz4/lz4/archive/v${LZ4_VERSION}.tar.gz" \
-O download-cache/lz4-${LZ4_VERSION}.tar.gz
fi
}
build_lz4 () {
if [ "$(cat ${PREFIX}/.lz4-version)" != "${LZ4_VERSION}" ]; then
tar zxf download-cache/lz4-${LZ4_VERSION}.tar.gz
(
cd "lz4-${LZ4_VERSION}"
make default CC=$CC CXX=$CXX
make install PREFIX="${PREFIX}"
)
echo "${LZ4_VERSION}" > "${PREFIX}/.lz4-version"
fi
}
download_mbedtls () {
if [ ! -f "download-cache/mbedtls-${MBEDTLS_VERSION}-apache.tgz" ]; then
wget -P download-cache/ \
"https://tls.mbed.org/download/mbedtls-${MBEDTLS_VERSION}-apache.tgz"
fi
}
build_mbedtls () {
if [ "$(cat ${PREFIX}/.mbedtls-version)" != "${MBEDTLS_VERSION}" ]; then
tar zxf download-cache/mbedtls-${MBEDTLS_VERSION}-apache.tgz
(
cd "mbedtls-${MBEDTLS_VERSION}"
make CC=$CC CXX=$CXX
make install DESTDIR="${PREFIX}"
)
echo "${MBEDTLS_VERSION}" > "${PREFIX}/.mbedtls-version"
fi
}
download_openssl () {
if [ ! -f "download-cache/openssl-${OPENSSL_VERSION}.tar.gz" ]; then
wget -P download-cache/ \
"https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz"
fi
}
build_openssl_linux () {
(
cd "openssl-${OPENSSL_VERSION}/"
./config shared --prefix="${PREFIX}" --openssldir="${PREFIX}" -DPURIFY
make all install_sw
)
}
build_openssl_osx () {
(
cd "openssl-${OPENSSL_VERSION}/"
./Configure darwin64-x86_64-cc shared \
--prefix="${PREFIX}" --openssldir="${PREFIX}" -DPURIFY
make depend all install_sw
)
}
build_openssl () {
if [ "$(cat ${PREFIX}/.openssl-version)" != "${OPENSSL_VERSION}" ]; then
tar zxf "download-cache/openssl-${OPENSSL_VERSION}.tar.gz"
if [ "${TRAVIS_OS_NAME}" = "osx" ]; then
build_openssl_osx
elif [ "${TRAVIS_OS_NAME}" = "linux" ]; then
build_openssl_linux
fi
echo "${OPENSSL_VERSION}" > "${PREFIX}/.openssl-version"
fi
}
# Enable ccache
if [ "${TRAVIS_OS_NAME}" != "osx" ] && [ -z ${CHOST+x} ]; then
# ccache not available on osx, see:
# https://github.com/travis-ci/travis-ci/issues/5567
# also ccache not enabled for cross builds
mkdir -p "${HOME}/bin"
ln -s "$(which ccache)" "${HOME}/bin/${CXX}"
ln -s "$(which ccache)" "${HOME}/bin/${CC}"
PATH="${HOME}/bin:${PATH}"
fi
# Download and build crypto lib
if [ "${SSLLIB}" = "openssl" ]; then
download_openssl
build_openssl
elif [ "${SSLLIB}" = "mbedtls" ]; then
download_mbedtls
build_mbedtls
else
echo "Invalid crypto lib: ${SSLLIB}"
exit 1
fi
download_asio
build_asio
download_lz4
build_lz4
+11 -13
View File
@@ -1,5 +1,5 @@
Contributor agreement for the OpenVPN project version 1.2 - March 2017 Contributor agreement for the OpenVPN project version 1.3 - December 2017
######################################################################## #########################################################################
This Contributor Agreement consists of two parts. Part I is the This Contributor Agreement consists of two parts. Part I is the
Developer Certificate of Origin available at Developer Certificate of Origin available at
@@ -8,7 +8,7 @@ http://developercertificate.org/.
In this contributor agreement, "This project" refers to the OpenVPN In this contributor agreement, "This project" refers to the OpenVPN
project and project and
"open source license indicated in `the file <LICENSE.rst>`_" refers to "open source license indicated in `the file <LICENSE.rst>`_" refers to
the GPLv3 license with an additional permission that allows linking the AGPLv3 license with an additional permission that allows linking
the OpenSSL software, https://www.openssl.org/, with the OpenVPN the OpenSSL software, https://www.openssl.org/, with the OpenVPN
software. software.
@@ -50,16 +50,14 @@ the open source license(s) involved.
Part II Part II
####### #######
Copyright (C) 2017 OpenVPN Technologies, Inc. Copyright (C) 2017 OpenVPN Inc.
In addition: In addition:
(e) I understand that OpenVPN Technologies, Inc. may relicense this (e) I understand that OpenVPN Inc. may relicense this project, this
project, this contribution, and any modification to it under any contribution, and any modification to it under any license. I certify that I,
license. I certify that I, or the person on whose behalf I am or the person on whose behalf I am submitting the contribution, have the
submitting the contribution, have the right to grant and hereby grant right to grant and hereby grant OpenVPN Inc. a license to do so for this
OpenVPN Technologies, Inc. a license to do so for this contribution. My grant is made on the condition that OpenVPN Inc. will make
contribution. My grant is made on the condition that OpenVPN any modification to this contribution available to the OpenVPN project under
Technologies, Inc. will make any modification to this contribution the open source license indicated in the file.
available to the OpenVPN project under the open source license
indicated in the file.
@@ -1,5 +1,5 @@
GNU GENERAL PUBLIC LICENSE GNU AFFERO GENERAL PUBLIC LICENSE
Version 3, 29 June 2007 Version 3, 19 November 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies Everyone is permitted to copy and distribute verbatim copies
@@ -7,17 +7,15 @@
Preamble Preamble
The GNU General Public License is a free, copyleft license for The GNU Affero General Public License is a free, copyleft license for
software and other kinds of works. software and other kinds of works, specifically designed to ensure
cooperation with the community in the case of network server software.
The licenses for most software and other practical works are designed The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast, to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to our General Public Licenses are intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the software for all its users.
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you price. Our General Public Licenses are designed to make sure that you
@@ -26,44 +24,34 @@ them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things. free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you Developers that use our General Public Licenses protect your rights
these rights or asking you to surrender the rights. Therefore, you have with two steps: (1) assert copyright on the software, and (2) offer
certain responsibilities if you distribute copies of the software, or if you this License which gives you legal permission to copy, distribute
you modify it: responsibilities to respect the freedom of others. and/or modify the software.
For example, if you distribute copies of such a program, whether A secondary benefit of defending all users' freedom is that
gratis or for a fee, you must pass on to the recipients the same improvements made in alternate versions of the program, if they
freedoms that you received. You must make sure that they, too, receive receive widespread use, become available for other developers to
or can get the source code. And you must show them these terms so they incorporate. Many developers of free software are heartened and
know their rights. encouraged by the resulting cooperation. However, in the case of
software used on network servers, this result may fail to come about.
The GNU General Public License permits making a modified version and
letting the public access it on a server without ever releasing its
source code to the public.
Developers that use the GNU GPL protect your rights with two steps: The GNU Affero General Public License is designed specifically to
(1) assert copyright on the software, and (2) offer you this License ensure that, in such cases, the modified source code becomes available
giving you legal permission to copy, distribute and/or modify it. to the community. It requires the operator of a network server to
provide the source code of the modified version running there to the
users of that server. Therefore, public use of a modified version, on
a publicly accessible server, gives the public access to the source
code of the modified version.
For the developers' and authors' protection, the GPL clearly explains An older license, called the Affero General Public License and
that there is no warranty for this free software. For both users' and published by Affero, was designed to accomplish similar goals. This is
authors' sake, the GPL requires that modified versions be marked as a different license, not a version of the Affero GPL, but Affero has
changed, so that their problems will not be attributed erroneously to released a new version of the Affero GPL which permits relicensing under
authors of previous versions. this license.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and The precise terms and conditions for copying, distribution and
modification follow. modification follow.
@@ -72,7 +60,7 @@ modification follow.
0. Definitions. 0. Definitions.
"This License" refers to version 3 of the GNU General Public License. "This License" refers to version 3 of the GNU Affero General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of "Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks. works, such as semiconductor masks.
@@ -549,35 +537,45 @@ to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program. License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License. 13. Remote Network Interaction; Use with the GNU General Public License.
Notwithstanding any other provision of this License, if you modify the
Program, your modified version must prominently offer all users
interacting with it remotely through a computer network (if your version
supports such interaction) an opportunity to receive the Corresponding
Source of your version by providing access to the Corresponding Source
from a network server at no charge, through some standard or customary
means of facilitating copying of software. This Corresponding Source
shall include the Corresponding Source for any work covered by version 3
of the GNU General Public License that is incorporated pursuant to the
following paragraph.
Notwithstanding any other provision of this License, you have Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single under version 3 of the GNU General Public License into a single
combined work, and to convey the resulting work. The terms of this combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work, License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License, but the work with which it is combined will remain governed by version
section 13, concerning interaction through a network will apply to the 3 of the GNU General Public License.
combination as such.
14. Revised Versions of this License. 14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will the GNU Affero General Public License from time to time. Such new versions
be similar in spirit to the present version, but may differ in detail to will be similar in spirit to the present version, but may differ in detail to
address new problems or concerns. address new problems or concerns.
Each version is given a distinguishing version number. If the Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General Program specifies that a certain numbered version of the GNU Affero General
Public License "or any later version" applies to it, you have the Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published GNU Affero General Public License, you may choose any version ever published
by the Free Software Foundation. by the Free Software Foundation.
If the Program specifies that a proxy can decide which future If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's versions of the GNU Affero General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you public statement of acceptance of a version permanently authorizes you
to choose that version for the Program. to choose that version for the Program.
@@ -635,40 +633,29 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author> Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU Affero General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail. Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short If your software can interact with users remotely through a computer
notice like this when it starts in an interactive mode: network, you should also make sure that it provides a way for users to
get its source. For example, if your program is a web application, its
<program> Copyright (C) <year> <name of author> interface could display a "Source" link that leads users to an archive
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. of the code. There are many ways you could offer source, and different
This is free software, and you are welcome to redistribute it solutions will be better for different programs; see section 13 for the
under certain conditions; type `show c' for details. specific requirements.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school, You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary. if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see For more information on this, and how to apply and follow the GNU AGPL, see
<http://www.gnu.org/licenses/>. <http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
+2 -2
View File
@@ -1,10 +1,10 @@
OpenVPN 3 is distributed under OpenVPN 3 is distributed under
`GNU General Public License version 3 <COPYRIGHT.GPLV3>`_ `GNU Affero General Public License version 3 <COPYRIGHT.AGPLV3>`_
with a special permission to link against OpenSSL: with a special permission to link against OpenSSL:
:: ::
Additional permission under GNU GPL version 3 section 7 Additional permission under GNU AGPL version 3 section 7
If you modify this Program, or any covered work, by linking or combining If you modify this Program, or any covered work, by linking or combining
it with OpenSSL (or a modified version of that library), containing parts it with OpenSSL (or a modified version of that library), containing parts
@@ -145,6 +145,65 @@ To connect::
$ ./cli client.ovpn $ ./cli client.ovpn
Building the OpenVPN 3 client on Windows
----------------------------------------
Those instructions were tested with Git Bash.
Prerequisites:
- Visual Studio 2015
- Python 2.7
To make python interpreter work inside Git Bash terminal, add::
alias python='winpty python.exe'
to ``.bashrc``.
Clone the OpenVPN 3 source repo::
$ mkdir ovpn3
$ cd ovpn3
$ git clone https://github.com/OpenVPN/openvpn3.git core
Create ``parms_local.py`` inside ``~/ovpn3/core/win`` directory which overrides build settings from ``parms.py``. For example:
.. code-block:: python
PARMS = {
"OVPN3" : "c:\\Users\\user\\Projects\\ovpn3",
"TAP" : "c:\\Users\\user\\Projects\\tap-windows",
"DEP" : "c:\\Users\\user\\Downloads",
"BUILD" : "c:\\Users\\user\\Projects\\ovpn3-build",
"LIB_VERSIONS" : {
"asio" : "asio-cc1bd58f9ebb15afbebf53207015ff690b338195"
},
"GTEST_ROOT": "c:\\Users\\user\\Projects\\googletest"
}
Download dependencies as tar(zip)balls to DEP directory defined in previous step:
1. Asio — https://github.com/chriskohlhoff/asio
2. mbed TLS (2.3.0 or higher) — https://tls.mbed.org/
3. LZ4 — https://github.com/Cyan4973/lz4
Extract and build dependencies (assuming you are in ``~/ovpn3/core/win`` directory)::
$ python buildep.py
Build the OpenVPN 3 client executable:
$ python build.py
Visual Studio 2015 project and solution files are located in ``~/ovpn3/core/win`` directory.
Before opening project you need to build dependencies and define environmental variables:
- OVPN3_BUILD - path where dependencies are build (BUILD in parms.py)
- OVPN3_CORE - path where ovpn3-core was checked out (OVPN3 in parms.py)
- OVPN3_TAP_WINDOWS - path where tap-windows was checked out (TAP in parms.py)
Testing Testing
------- -------
@@ -175,6 +234,36 @@ Run the test::
user 0m15.800s user 0m15.800s
sys 0m0.004s sys 0m0.004s
The OpenVPN 3 core also includes unit tests, which are based on
Google Test framework. To run unit tests, you need to install
CMake and build Google Test.
Building Google Test on Linux::
$ git clone https://github.com/google/googletest.git
$ cd googletest
$ cmake . && cmake --build .
Building Google Test on Windows::
> git clone https://github.com/google/googletest.git
> cd googletest
> cmake -G "Visual Studio 14 2015 Win64" .
> cmake --build .
After Google Test is built you are ready to build and run unit tests.
Build and run tests on Linux::
$ cd ovpn3/core/test/unittests
$ GTEST_DIR=~/googletest ECHO=1 PROF=linux ASIO_DIR=~/asio MTLS_SYS=1 LZ4_SYS=1 NOSSL=1 $O3/core/scripts/build test_log
$ ./test_log
Build and run tests on Windows::
$ cd ovpn3/core/win
$ python build.py ../test/unittests/test_log.cpp unittest
$ test_log.exe
Developer Guide Developer Guide
--------------- ---------------
@@ -553,3 +642,4 @@ License
------- -------
See `<LICENSE.rst>`_. See `<LICENSE.rst>`_.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -406,11 +406,13 @@ namespace openvpn {
// extra settings submitted by API client // extra settings submitted by API client
std::string server_override; std::string server_override;
std::string port_override;
Protocol proto_override; Protocol proto_override;
IPv6Setting ipv6; IPv6Setting ipv6;
int conn_timeout = 0; int conn_timeout = 0;
bool tun_persist = false; bool tun_persist = false;
bool google_dns_fallback = false; bool google_dns_fallback = false;
bool synchronous_dns_lookup = false;
bool autologin_sessions = false; bool autologin_sessions = false;
std::string private_key_password; std::string private_key_password;
std::string external_pki_alias; std::string external_pki_alias;
@@ -475,6 +477,8 @@ namespace openvpn {
~ClientState() ~ClientState()
{ {
stop_scope_local.reset();
stop_scope_global.reset();
socket_protect.detach_from_parent(); socket_protect.detach_from_parent();
reconnect_notify.detach_from_parent(); reconnect_notify.detach_from_parent();
remote_override.detach_from_parent(); remote_override.detach_from_parent();
@@ -532,6 +536,17 @@ namespace openvpn {
clock_tick->cancel(); clock_tick->cancel();
} }
void setup_async_stop_scopes()
{
stop_scope_local.reset(new AsioStopScope(*io_context(), async_stop_local(), [this]() {
session->graceful_stop();
}));
stop_scope_global.reset(new AsioStopScope(*io_context(), async_stop_global(), [this]() {
trigger_async_stop_local();
}));
}
private: private:
ClientState(const ClientState&) = delete; ClientState(const ClientState&) = delete;
ClientState& operator=(const ClientState&) = delete; ClientState& operator=(const ClientState&) = delete;
@@ -541,6 +556,9 @@ namespace openvpn {
Stop async_stop_local_; Stop async_stop_local_;
Stop* async_stop_global_ = nullptr; Stop* async_stop_global_ = nullptr;
std::unique_ptr<AsioStopScope> stop_scope_local;
std::unique_ptr<AsioStopScope> stop_scope_global;
openvpn_io::io_context* io_context_ = nullptr; openvpn_io::io_context* io_context_ = nullptr;
bool io_context_owned = false; bool io_context_owned = false;
@@ -630,9 +648,11 @@ namespace openvpn {
{ {
try { try {
state->server_override = config.serverOverride; state->server_override = config.serverOverride;
state->port_override = config.portOverride;
state->conn_timeout = config.connTimeout; state->conn_timeout = config.connTimeout;
state->tun_persist = config.tunPersist; state->tun_persist = config.tunPersist;
state->google_dns_fallback = config.googleDnsFallback; state->google_dns_fallback = config.googleDnsFallback;
state->synchronous_dns_lookup = config.synchronousDnsLookup;
state->autologin_sessions = config.autologinSessions; state->autologin_sessions = config.autologinSessions;
state->private_key_password = config.privateKeyPassword; state->private_key_password = config.privateKeyPassword;
if (!config.protoOverride.empty()) if (!config.protoOverride.empty())
@@ -828,12 +848,61 @@ namespace openvpn {
OPENVPN_CLIENT_EXPORT Status OpenVPNClient::do_connect() OPENVPN_CLIENT_EXPORT Status OpenVPNClient::do_connect()
{ {
Status ret; Status status;
bool in_run = false; bool session_started = false;
connect_attach();
try { try {
connect_attach();
#if defined(OPENVPN_OVPNCLI_ASYNC_SETUP)
openvpn_io::post(*state->io_context(), [this]() {
do_connect_async();
});
#else
connect_setup(status, session_started);
#endif
connect_run();
return status;
}
catch (const std::exception& e)
{
if (session_started)
connect_session_stop();
return status_from_exception(e);
}
}
OPENVPN_CLIENT_EXPORT void OpenVPNClient::do_connect_async()
{
enum StopType {
NONE,
SESSION,
EXPLICIT,
};
StopType stop_type = NONE;
Status status;
bool session_started = false;
try {
connect_setup(status, session_started);
}
catch (const std::exception& e)
{
stop_type = session_started ? SESSION : EXPLICIT;
status = status_from_exception(e);
}
if (status.error)
{
ClientEvent::Base::Ptr ev = new ClientEvent::ClientSetup(status.status, status.message);
state->events->add_event(std::move(ev));
}
if (stop_type == SESSION)
connect_session_stop();
#ifdef OPENVPN_IO_REQUIRES_STOP
if (stop_type == EXPLICIT)
state->io_context()->stop();
#endif
}
OPENVPN_CLIENT_EXPORT void OpenVPNClient::connect_setup(Status& status, bool& session_started)
{
// set global MbedTLS debug level // set global MbedTLS debug level
#if defined(USE_MBEDTLS) || defined(USE_MBEDTLS_APPLE_HYBRID) #if defined(USE_MBEDTLS) || defined(USE_MBEDTLS_APPLE_HYBRID)
mbedtls_debug_set_threshold(state->ssl_debug_level); // fixme -- using a global method for this seems wrong mbedtls_debug_set_threshold(state->ssl_debug_level); // fixme -- using a global method for this seems wrong
@@ -844,11 +913,13 @@ namespace openvpn {
cc.cli_stats = state->stats; cc.cli_stats = state->stats;
cc.cli_events = state->events; cc.cli_events = state->events;
cc.server_override = state->server_override; cc.server_override = state->server_override;
cc.port_override = state->port_override;
cc.proto_override = state->proto_override; cc.proto_override = state->proto_override;
cc.ipv6 = state->ipv6; cc.ipv6 = state->ipv6;
cc.conn_timeout = state->conn_timeout; cc.conn_timeout = state->conn_timeout;
cc.tun_persist = state->tun_persist; cc.tun_persist = state->tun_persist;
cc.google_dns_fallback = state->google_dns_fallback; cc.google_dns_fallback = state->google_dns_fallback;
cc.synchronous_dns_lookup = state->synchronous_dns_lookup;
cc.autologin_sessions = state->autologin_sessions; cc.autologin_sessions = state->autologin_sessions;
cc.proto_context_options = state->proto_context_options; cc.proto_context_options = state->proto_context_options;
cc.http_proxy_options = state->http_proxy_options; cc.http_proxy_options = state->http_proxy_options;
@@ -879,7 +950,9 @@ namespace openvpn {
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY) #if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
cc.extern_tun_factory = this; cc.extern_tun_factory = this;
#endif #endif
#if defined(OPENVPN_EXTERNAL_TRANSPORT_FACTORY)
cc.extern_transport_factory = this;
#endif
// force Session ID use and disable password cache if static challenge is enabled // force Session ID use and disable password cache if static challenge is enabled
if (state->creds if (state->creds
&& !state->creds->get_replace_password_with_session_id() && !state->creds->get_replace_password_with_session_id()
@@ -907,14 +980,14 @@ namespace openvpn {
else else
{ {
external_pki_error(req, Error::EPKI_CERT_ERROR); external_pki_error(req, Error::EPKI_CERT_ERROR);
return ret; return;
} }
} }
else else
{ {
ret.error = true; status.error = true;
ret.message = "Missing External PKI alias"; status.message = "Missing External PKI alias";
return ret; return;
} }
} }
#endif #endif
@@ -939,28 +1012,20 @@ namespace openvpn {
check_app_expired(); check_app_expired();
// start VPN // start VPN
state->session->start(); // queue parallel async reads state->session->start(); // queue reads on socket/tun
session_started = true;
// wire up async stop // wire up async stop
AsioStopScope scope_local(*state->io_context(), state->async_stop_local(), [this]() { state->setup_async_stop_scopes();
state->session->graceful_stop();
});
AsioStopScope scope_global(*state->io_context(), state->async_stop_global(), [this]() {
state->trigger_async_stop_local();
});
// prepare to start reactor // prepare to start reactor
connect_pre_run(); connect_pre_run();
// run i/o reactor
state->enable_foreign_thread_access(); state->enable_foreign_thread_access();
in_run = true;
connect_run();
} }
catch (const std::exception& e)
OPENVPN_CLIENT_EXPORT Status OpenVPNClient::status_from_exception(const std::exception& e)
{ {
if (in_run) Status ret;
connect_session_stop();
ret.error = true; ret.error = true;
ret.message = Unicode::utf8_printable<std::string>(e.what(), 256); ret.message = Unicode::utf8_printable<std::string>(e.what(), 256);
@@ -971,7 +1036,6 @@ namespace openvpn {
if (ec && ec->code_defined()) if (ec && ec->code_defined())
ret.status = Error::name(ec->code()); ret.status = Error::name(ec->code());
} }
}
return ret; return ret;
} }
@@ -1293,10 +1357,5 @@ namespace openvpn {
{ {
delete state; delete state;
} }
OPENVPN_CLIENT_EXPORT LogInfo::LogInfo(std::string str)
: text(std::move(str))
{
}
} }
} }
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -31,6 +31,7 @@
#include <openvpn/tun/builder/base.hpp> #include <openvpn/tun/builder/base.hpp>
#include <openvpn/tun/extern/fw.hpp> #include <openvpn/tun/extern/fw.hpp>
#include <openvpn/pki/epkibase.hpp> #include <openvpn/pki/epkibase.hpp>
#include <openvpn/transport/client/extern/fw.hpp>
namespace openvpn { namespace openvpn {
class OptionList; class OptionList;
@@ -172,6 +173,10 @@ namespace openvpn {
// option of profile // option of profile
std::string serverOverride; std::string serverOverride;
// Use a different port than that specified in "remote"
// option of profile
std::string portOverride;
// Force a given transport protocol // Force a given transport protocol
// Should be tcp, udp, or adaptive. // Should be tcp, udp, or adaptive.
std::string protoOverride; std::string protoOverride;
@@ -192,6 +197,9 @@ namespace openvpn {
// DNS servers, use the standard Google DNS servers. // DNS servers, use the standard Google DNS servers.
bool googleDnsFallback = false; bool googleDnsFallback = false;
// if true, do synchronous DNS lookup.
bool synchronousDnsLookup = false;
// Enable autologin sessions // Enable autologin sessions
bool autologinSessions = true; bool autologinSessions = true;
@@ -321,7 +329,8 @@ namespace openvpn {
struct LogInfo struct LogInfo
{ {
LogInfo() {} LogInfo() {}
LogInfo(std::string str); LogInfo(std::string str)
: text(std::move(str)) {}
std::string text; // log output (usually but not always one line) std::string text; // log output (usually but not always one line)
}; };
@@ -412,6 +421,7 @@ namespace openvpn {
class OpenVPNClient : public TunBuilderBase, // expose tun builder virtual methods class OpenVPNClient : public TunBuilderBase, // expose tun builder virtual methods
public LogReceiver, // log message notification public LogReceiver, // log message notification
public ExternalTun::Factory, // low-level tun override public ExternalTun::Factory, // low-level tun override
public ExternalTransport::Factory,// low-level transport override
private ExternalPKIBase private ExternalPKIBase
{ {
public: public:
@@ -567,10 +577,13 @@ namespace openvpn {
Private::ClientState* state; Private::ClientState* state;
private: private:
void connect_setup(Status&, bool&);
void do_connect_async();
static Status status_from_exception(const std::exception&);
static void parse_config(const Config&, EvalConfig&, OptionList&); static void parse_config(const Config&, EvalConfig&, OptionList&);
void parse_extras(const Config&, EvalConfig&); void parse_extras(const Config&, EvalConfig&);
void external_pki_error(const ExternalPKIRequestBase&, const size_t err_type); void external_pki_error(const ExternalPKIRequestBase&, const size_t);
void process_epki_cert_chain(const ExternalPKICertRequest& req); void process_epki_cert_chain(const ExternalPKICertRequest&);
void check_app_expired(); void check_app_expired();
static MergeConfig build_merge_config(const ProfileMerge&); static MergeConfig build_merge_config(const ProfileMerge&);
@@ -5,11 +5,29 @@ if [ -z "$O3" ]; then
echo O3 var must point to ovpn3 tree echo O3 var must point to ovpn3 tree
exit 1 exit 1
fi fi
if [ -z "$DEP_DIR" ]; then
[ -z "$DL" ] && DL=~/Downloads echo DEP_DIR var must point to dependency build folder
exit 1
fi
if [ -z "$DL" ]; then
echo DL var must point to the download folder
exit 1
fi
. $O3/core/deps/lib-versions . $O3/core/deps/lib-versions
# source helper functions
. $O3/core/deps/functions.sh
PACKAGE=${ASIO_VERSION}
FNAME=${ASIO_VERSION}.tar.gz
PV=${ASIO_VERSION#*-}
URL=https://github.com/chriskohlhoff/asio/archive/${PV}.tar.gz
CSUM=${ASIO_CSUM}
download
cd $DEP_DIR
rm -rf asio* rm -rf asio*
tar xf $DL/$ASIO_VERSION.tar.gz tar xf $DL/$ASIO_VERSION.tar.gz
cp -a $ASIO_VERSION asio cp -a $ASIO_VERSION asio
@@ -0,0 +1,30 @@
function check_download()
{
if [ -f $DL/$FNAME ]; then
CHECK=$(sha256sum $DL/$FNAME |awk '{printf $1};')
if [ "$CHECK" == "$CSUM" ]; then
return 0
else
echo "Checksum mismatch for $FNAME. Was $CHECK, expected $CSUM"
fi
else
echo "$FNAME not found."
fi
return -1
}
function download()
{
check_download && return 0
rm -f $DL/$FNAME
if [ -n "$URL" ]; then
wget $URL -O $DL/$FNAME
else
echo URL must be specified
exit 1
fi
check_download || return -1
}
@@ -1,4 +1,10 @@
export ASIO_VERSION=asio-20170301 export ASIO_VERSION=asio-862aed305dcf91387535519c9549c17630339a12
export LZ4_VERSION=lz4-1.7.5 export ASIO_CSUM=65eb4e0997795e4c7c76325387311c3b9d211754615c275bfe5ca6e186dc322b
export MBEDTLS_VERSION=mbedtls-2.4.0
export LZ4_VERSION=lz4-1.8.0
export LZ4_CSUM=2ca482ea7a9bb103603108b5a7510b7592b90158c151ff50a28f1ca8389fccf6
export MBEDTLS_VERSION=mbedtls-2.6.0
export MBEDTLS_CSUM=99bc9d4212d3d885eeb96273bcde8ecc649a481404b8d7ea7bb26397c9909687
export OPENSSL_VERSION=openssl-1.0.2h export OPENSSL_VERSION=openssl-1.0.2h
@@ -5,17 +5,33 @@ if [ -z "$O3" ]; then
echo O3 var must point to ovpn3 tree echo O3 var must point to ovpn3 tree
exit 1 exit 1
fi fi
if [ -z "$DEP_DIR" ]; then
echo DEP_DIR var must point to dependency build folder
exit 1
fi
if [ -z "$DL" ]; then
echo DL var must point to the download folder
exit 1
fi
if [ -z "$TARGET" ]; then if [ -z "$TARGET" ]; then
echo TARGET var must be defined echo TARGET var must be defined
exit 1 exit 1
fi fi
[ -z "$DL" ] && DL=~/Downloads
# source vars # source vars
. $O3/core/vars/vars-${TARGET} . $O3/core/vars/vars-${TARGET}
. $O3/core/deps/lib-versions . $O3/core/deps/lib-versions
# source helper functions
. $O3/core/deps/functions.sh
FNAME=${LZ4_VERSION}.tar.gz
PN=${LZ4_VERSION#*-}
URL=https://github.com/lz4/lz4/archive/v${PN}.tar.gz
CSUM=${LZ4_CSUM}
download
CC=cc CC=cc
LD=ld LD=ld
@@ -5,6 +5,15 @@ if [ -z "$O3" ]; then
echo O3 var must point to ovpn3 tree echo O3 var must point to ovpn3 tree
exit 1 exit 1
fi fi
if [ -z "$DEP_DIR" ]; then
echo DEP_DIR var must point to dependency build folder
exit 1
fi
if [ -z "$DL" ]; then
echo DL var must point to the download folder
exit 1
fi
if [ -z "$TARGET" ]; then if [ -z "$TARGET" ]; then
echo TARGET var must be defined echo TARGET var must be defined
exit 1 exit 1
@@ -14,6 +23,16 @@ fi
. $O3/core/vars/vars-${TARGET} . $O3/core/vars/vars-${TARGET}
. $O3/core/deps/lib-versions . $O3/core/deps/lib-versions
# source helper functions
. $O3/core/deps/functions.sh
FNAME=${MBEDTLS_VERSION}-apache.tgz
PN=${MBEDTLS_VERSION#*-}
URL=https://tls.mbed.org/download/$MBEDTLS_VERSION-apache.tgz
CSUM=${MBEDTLS_CSUM}
download
# put build targets here # put build targets here
DIST=$(pwd)/mbedtls/mbedtls-$PLATFORM DIST=$(pwd)/mbedtls/mbedtls-$PLATFORM
rm -rf $DIST rm -rf $DIST
@@ -31,6 +50,11 @@ else
# enable MD4 (needed for NTLM auth) # enable MD4 (needed for NTLM auth)
perl -pi -e 's/^\/\/// if /#define MBEDTLS_MD4_C/' include/mbedtls/config.h perl -pi -e 's/^\/\/// if /#define MBEDTLS_MD4_C/' include/mbedtls/config.h
# apply pre-generated patches
for file in $O3/core/deps/mbedtls/patches/*.patch; do
patch -p1 <$file
done
fi fi
# compiler vars # compiler vars
@@ -48,7 +72,8 @@ SRC=$(pwd)
cd library cd library
rm -f *.o rm -f *.o
for c in *.c ; do for c in *.c ; do
CMD="$CC -I../include $PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC -c $c" CMD="$CC -I../include -DMBEDTLS_RELAXED_X509_DATE \
$PLATFORM_FLAGS $OTHER_COMPILER_FLAGS $LIB_OPT_LEVEL $LIB_FPIC -c $c"
echo $CMD echo $CMD
$CMD $CMD
done done
@@ -0,0 +1,41 @@
diff -urw mbedtls-2.6.0.orig/library/x509.c mbedtls-2.6.0/library/x509.c
--- mbedtls-2.6.0.orig/library/x509.c 2017-11-03 11:46:21.403848065 +0800
+++ mbedtls-2.6.0/library/x509.c 2017-11-03 11:58:46.259817520 +0800
@@ -559,13 +559,20 @@
/*
* Parse seconds if present
*/
- if ( len >= 2 )
+ if ( len >= 2 && **p >= '0' && **p <= '9' )
{
CHECK( x509_parse_int( p, 2, &tm->sec ) );
len -= 2;
}
else
+ {
+#if defined(MBEDTLS_RELAXED_X509_DATE)
+ /* if relaxed mode, allow seconds to be absent */
+ tm->sec = 0;
+#else
return ( MBEDTLS_ERR_X509_INVALID_DATE );
+#endif
+ }
/*
* Parse trailing 'Z' if present
@@ -575,6 +582,15 @@
(*p)++;
len--;
}
+#if defined(MBEDTLS_RELAXED_X509_DATE)
+ else if ( len == 5 && **p == '+' )
+ {
+ int tz; /* throwaway timezone */
+ (*p)++;
+ CHECK( x509_parse_int( p, 4, &tz ) );
+ return 0;
+ }
+#endif
/*
* We should have parsed all characters at this point
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -31,8 +31,9 @@ fi
echo SWIG echo SWIG
swig -c++ -java -package $pkg -I$O3/core/client -I$O3/core ovpncli.i swig -c++ -java -package $pkg -I$O3/core/client -I$O3/core ovpncli.i
# fixme: removed "android" from TARGET list due to compile failures in Asio TARGETS=${TARGETS:-android-a7a android-a8a android-x86}
for TARGET in android-a8a android-a7a ; do
for TARGET in $TARGETS; do
if [ "$DEBUG_BUILD" = "1" ]; then if [ "$DEBUG_BUILD" = "1" ]; then
. ../vars/vars-${TARGET}-dbg . ../vars/vars-${TARGET}-dbg
@@ -58,10 +59,13 @@ else
ssl_libdir="-L$DEP_DIR/mbedtls/mbedtls-$PLATFORM/library" ssl_libdir="-L$DEP_DIR/mbedtls/mbedtls-$PLATFORM/library"
fi fi
[ -z "$GPP_CMD" ] && GPP_CMD=g++
echo CORE $ABI echo CORE $ABI
g++ \ $GPP_CMD \
$CXX_COMPILER_FLAGS \ $CXX_COMPILER_FLAGS \
$PLATFORM_FLAGS \ $PLATFORM_FLAGS \
$OTHER_COMPILER_FLAGS \
$LIB_OPT_LEVEL $LIB_FPIC \ $LIB_OPT_LEVEL $LIB_FPIC \
-Wall -Wno-sign-compare -Wno-unused-parameter \ -Wall -Wno-sign-compare -Wno-unused-parameter \
-Wno-unused-local-typedefs \ -Wno-unused-local-typedefs \
@@ -71,6 +75,7 @@ g++ \
-DASIO_STANDALONE \ -DASIO_STANDALONE \
-DASIO_NO_DEPRECATED \ -DASIO_NO_DEPRECATED \
-DHAVE_LZ4 \ -DHAVE_LZ4 \
-DOPENVPN_USE_TLS_MD5 \
-I$O3/core/client \ -I$O3/core/client \
-I$O3/core \ -I$O3/core \
$common \ $common \
@@ -80,9 +85,10 @@ g++ \
-c $O3/core/client/ovpncli.cpp -c $O3/core/client/ovpncli.cpp
echo WRAP $ABI echo WRAP $ABI
g++ \ $GPP_CMD \
$CXX_COMPILER_FLAGS \ $CXX_COMPILER_FLAGS \
$PLATFORM_FLAGS \ $PLATFORM_FLAGS \
$OTHER_COMPILER_FLAGS \
$opt2 $LIB_FPIC \ $opt2 $LIB_FPIC \
-fno-strict-aliasing \ -fno-strict-aliasing \
-Wall \ -Wall \
@@ -112,5 +118,8 @@ mv libovpncli.so build/libs/$ABI/
rm ovpncli.o rm ovpncli.o
done done
mv ovpncli.java ovpncliJNI.java SWIGTYPE_*.java ClientAPI_*.java build/ mv ovpncli_wrap.cxx ovpncli_wrap.h ovpncli.java ovpncliJNI.java SWIGTYPE_*.java ClientAPI_*.java build/
git clean -q -fX . git clean -q -fX .
tar -czf android-core-build.tgz build
mv android-core-build.tgz $O3/
@@ -54,7 +54,7 @@ g++ \
$CXX_COMPILER_FLAGS \ $CXX_COMPILER_FLAGS \
$PLATFORM_FLAGS \ $PLATFORM_FLAGS \
$LIB_OPT_LEVEL $LIB_FPIC \ $LIB_OPT_LEVEL $LIB_FPIC \
-Wall -Wno-sign-compare -Wno-unused-parameter \ -Wall -Werror -Wno-sign-compare -Wno-unused-parameter \
-Wno-unused-local-typedefs \ -Wno-unused-local-typedefs \
$vis1 \ $vis1 \
$ssl_def \ $ssl_def \
@@ -75,7 +75,7 @@ g++ \
$PLATFORM_FLAGS \ $PLATFORM_FLAGS \
$opt2 $LIB_FPIC \ $opt2 $LIB_FPIC \
-fno-strict-aliasing \ -fno-strict-aliasing \
-Wall \ -Wall -Werror \
$vis1 $vis2 \ $vis1 $vis2 \
-I$O3/core/client \ -I$O3/core/client \
-I$O3/core \ -I$O3/core \
@@ -15,6 +15,7 @@
// ignore these ClientAPI::OpenVPNClient bases // ignore these ClientAPI::OpenVPNClient bases
%ignore openvpn::ClientAPI::LogReceiver; %ignore openvpn::ClientAPI::LogReceiver;
%ignore openvpn::ExternalTun::Factory; %ignore openvpn::ExternalTun::Factory;
%ignore openvpn::ExternalTransport::Factory;
// modify exported C++ class names to incorporate their enclosing namespace // modify exported C++ class names to incorporate their enclosing namespace
%rename(ClientAPI_OpenVPNClient) OpenVPNClient; %rename(ClientAPI_OpenVPNClient) OpenVPNClient;
@@ -49,4 +50,5 @@ namespace std {
%include "openvpn/pki/epkibase.hpp" %include "openvpn/pki/epkibase.hpp"
%include "openvpn/tun/builder/base.hpp" %include "openvpn/tun/builder/base.hpp"
%import "openvpn/tun/extern/fw.hpp" // ignored %import "openvpn/tun/extern/fw.hpp" // ignored
%import "openvpn/transport/client/extern/fw.hpp" // ignored
%include "ovpncli.hpp" %include "ovpncli.hpp"
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -148,19 +148,19 @@ namespace openvpn {
throw ip_exception("address unspecified"); throw ip_exception("address unspecified");
} }
static Addr from_ipv4(const IPv4::Addr& addr) static Addr from_ipv4(IPv4::Addr addr)
{ {
Addr a; Addr a;
a.ver = V4; a.ver = V4;
a.u.v4 = addr; a.u.v4 = std::move(addr);
return a; return a;
} }
static Addr from_ipv6(const IPv6::Addr& addr) static Addr from_ipv6(IPv6::Addr addr)
{ {
Addr a; Addr a;
a.ver = V6; a.ver = V6;
a.u.v6 = addr; a.u.v6 = std::move(addr);
return a; return a;
} }
@@ -327,6 +327,22 @@ namespace openvpn {
throw ip_exception("address unspecified"); throw ip_exception("address unspecified");
} }
// validate the prefix length for the IP version
static bool validate_prefix_len(Version v, const unsigned int prefix_len)
{
if (v == V4)
{
if (prefix_len <= V4_SIZE)
return true;
}
else if (v == V6)
{
if (prefix_len <= V6_SIZE)
return true;
}
return false;
}
// build a netmask using given prefix_len // build a netmask using given prefix_len
static Addr netmask_from_prefix_len(Version v, const unsigned int prefix_len) static Addr netmask_from_prefix_len(Version v, const unsigned int prefix_len)
{ {
@@ -837,23 +853,31 @@ namespace openvpn {
return 0; return 0;
} }
std::size_t hashval() const template <typename HASH>
void hash(HASH& h) const
{ {
std::size_t seed = 0;
switch (ver) switch (ver)
{ {
case Addr::V4: case Addr::V4:
Hash::combine(seed, 4, u.v4); u.v4.hash(h);
break; break;
case Addr::V6: case Addr::V6:
Hash::combine(seed, 6, u.v6); u.v6.hash(h);
break; break;
default: default:
break; break;
} }
return seed;
} }
#ifdef HAVE_CITYHASH
std::size_t hashval() const
{
HashSizeT h;
hash(h);
return h.value();
}
#endif
#ifdef OPENVPN_IP_IMMUTABLE #ifdef OPENVPN_IP_IMMUTABLE
private: private:
#endif #endif
@@ -951,6 +975,8 @@ namespace openvpn {
} }
} }
#ifdef HAVE_CITYHASH
OPENVPN_HASH_METHOD(openvpn::IP::Addr, hashval); OPENVPN_HASH_METHOD(openvpn::IP::Addr, hashval);
#endif
#endif #endif
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -35,7 +35,6 @@
#include <openvpn/common/socktypes.hpp> #include <openvpn/common/socktypes.hpp>
#include <openvpn/common/ffs.hpp> #include <openvpn/common/ffs.hpp>
#include <openvpn/common/hexstr.hpp> #include <openvpn/common/hexstr.hpp>
#include <openvpn/common/hash.hpp>
#include <openvpn/addr/iperr.hpp> #include <openvpn/addr/iperr.hpp>
namespace openvpn { namespace openvpn {
@@ -85,12 +84,12 @@ namespace openvpn {
return ret; return ret;
} }
struct sockaddr_in to_sockaddr() const struct sockaddr_in to_sockaddr(const unsigned short port=0) const
{ {
struct sockaddr_in ret; struct sockaddr_in ret;
std::memset(&ret, 0, sizeof(ret)); std::memset(&ret, 0, sizeof(ret));
ret.sin_family = AF_INET; ret.sin_family = AF_INET;
ret.sin_port = 0; ret.sin_port = htons(port);
ret.sin_addr.s_addr = htonl(u.addr); ret.sin_addr.s_addr = htonl(u.addr);
return ret; return ret;
} }
@@ -493,9 +492,10 @@ namespace openvpn {
return SIZE; return SIZE;
} }
std::size_t hashval() const template <typename HASH>
void hash(HASH& h) const
{ {
return Hash::value(u.addr); h(u.addr);
} }
#ifdef OPENVPN_IP_IMMUTABLE #ifdef OPENVPN_IP_IMMUTABLE
@@ -566,6 +566,4 @@ namespace openvpn {
} }
} }
OPENVPN_HASH_METHOD(openvpn::IPv4::Addr, hashval);
#endif // OPENVPN_ADDR_IPV4_H #endif // OPENVPN_ADDR_IPV4_H
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -34,7 +34,6 @@
#include <openvpn/common/socktypes.hpp> #include <openvpn/common/socktypes.hpp>
#include <openvpn/common/ffs.hpp> #include <openvpn/common/ffs.hpp>
#include <openvpn/common/hexstr.hpp> #include <openvpn/common/hexstr.hpp>
#include <openvpn/common/hash.hpp>
#include <openvpn/addr/ipv4.hpp> #include <openvpn/addr/ipv4.hpp>
#include <openvpn/addr/iperr.hpp> #include <openvpn/addr/iperr.hpp>
@@ -84,12 +83,12 @@ namespace openvpn {
return ret; return ret;
} }
struct sockaddr_in6 to_sockaddr() const struct sockaddr_in6 to_sockaddr(const unsigned short port=0) const
{ {
struct sockaddr_in6 ret; struct sockaddr_in6 ret;
std::memset(&ret, 0, sizeof(ret)); std::memset(&ret, 0, sizeof(ret));
ret.sin6_family = AF_INET6; ret.sin6_family = AF_INET6;
ret.sin6_port = 0; ret.sin6_port = htons(port);
host_to_network_order((union ipv6addr *)&ret.sin6_addr.s6_addr, &u); host_to_network_order((union ipv6addr *)&ret.sin6_addr.s6_addr, &u);
ret.sin6_scope_id = scope_id_; ret.sin6_scope_id = scope_id_;
return ret; return ret;
@@ -535,9 +534,10 @@ namespace openvpn {
return SIZE; return SIZE;
} }
std::size_t hashval() const template <typename HASH>
void hash(HASH& h) const
{ {
return Hash::value(u.u32[0], u.u32[1], u.u32[2], u.u32[3]); h(u.bytes, sizeof(u.bytes));
} }
#ifdef OPENVPN_IP_IMMUTABLE #ifdef OPENVPN_IP_IMMUTABLE
@@ -825,6 +825,4 @@ namespace openvpn {
} }
} }
OPENVPN_HASH_METHOD(openvpn::IPv6::Addr, hashval);
#endif // OPENVPN_ADDR_IPV6_H #endif // OPENVPN_ADDR_IPV6_H
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -1,3 +1,24 @@
// OpenVPN -- An application to securely tunnel IP networks
// over a single port, with support for SSL/TLS-based
// session authentication and key exchange,
// packet encryption, packet authentication, and
// packet compression.
//
// Copyright (C) 2012-2017 OpenVPN Inc.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Affero General Public License for more details.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>.
// Regular expressions for IPv4/v6 // Regular expressions for IPv4/v6
// Source: http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses // Source: http://stackoverflow.com/questions/53497/regular-expression-that-matches-valid-ipv6-addresses
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -123,6 +123,14 @@ namespace openvpn {
return addr.defined() && prefix_len == addr.size(); return addr.defined() && prefix_len == addr.size();
} }
unsigned int host_bits() const
{
if (prefix_len < addr.size())
return addr.size() - prefix_len;
else
return 0;
}
bool contains(const ADDR& a) const // assumes canonical address/routes bool contains(const ADDR& a) const // assumes canonical address/routes
{ {
if (addr.defined() && addr.version() == a.version()) if (addr.defined() && addr.version() == a.version())
@@ -167,10 +175,21 @@ namespace openvpn {
return prefix_len == other.prefix_len && addr == other.addr; return prefix_len == other.prefix_len && addr == other.addr;
} }
template <typename HASH>
void hash(HASH& h) const
{
addr.hash(h);
h(prefix_len);
}
#ifdef HAVE_CITYHASH
std::size_t hash_value() const std::size_t hash_value() const
{ {
return Hash::value(addr, prefix_len); HashSizeT h;
hash(h);
return h.value();
} }
#endif
}; };
template <typename ADDR> template <typename ADDR>
@@ -253,8 +272,10 @@ namespace openvpn {
} }
} }
#ifdef HAVE_CITYHASH
OPENVPN_HASH_METHOD(openvpn::IP::Route, hash_value); OPENVPN_HASH_METHOD(openvpn::IP::Route, hash_value);
OPENVPN_HASH_METHOD(openvpn::IP::Route4, hash_value); OPENVPN_HASH_METHOD(openvpn::IP::Route4, hash_value);
OPENVPN_HASH_METHOD(openvpn::IP::Route6, hash_value); OPENVPN_HASH_METHOD(openvpn::IP::Route6, hash_value);
#endif
#endif #endif
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
// //
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -158,6 +158,7 @@ namespace openvpn {
case CryptoAlgs::AES_128_CBC: case CryptoAlgs::AES_128_CBC:
case CryptoAlgs::AES_192_CBC: case CryptoAlgs::AES_192_CBC:
case CryptoAlgs::AES_256_CBC: case CryptoAlgs::AES_256_CBC:
case CryptoAlgs::AES_256_CTR:
return kCCAlgorithmAES128; return kCCAlgorithmAES128;
case CryptoAlgs::DES_CBC: case CryptoAlgs::DES_CBC:
return kCCAlgorithmDES; return kCCAlgorithmDES;
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -44,9 +44,11 @@ namespace openvpn {
{ {
} }
void bind_local(const IP::Addr& addr) // if port 0, kernel will dynamically allocate free port
void bind_local(const IP::Addr& addr, const unsigned short port=0)
{ {
bind_local_addr = addr; bind_local_addr = addr;
bind_local_port = port;
} }
private: private:
@@ -57,11 +59,12 @@ namespace openvpn {
set_option(openvpn_io::socket_base::reuse_address(true), ec); set_option(openvpn_io::socket_base::reuse_address(true), ec);
if (ec) if (ec)
return; return;
bind(openvpn_io::ip::tcp::endpoint(bind_local_addr.to_asio(), 0), ec); // port 0 -- kernel will choose port bind(openvpn_io::ip::tcp::endpoint(bind_local_addr.to_asio(), bind_local_port), ec);
} }
} }
IP::Addr bind_local_addr; IP::Addr bind_local_addr;
unsigned short bind_local_port = 0;
}; };
} }
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -36,6 +36,10 @@
#include <openvpn/common/sockopt.hpp> #include <openvpn/common/sockopt.hpp>
#include <openvpn/addr/ip.hpp> #include <openvpn/addr/ip.hpp>
#ifdef OPENVPN_POLYSOCK_SUPPORTS_BIND
#include <openvpn/asio/asioboundsock.hpp>
#endif
#ifdef ASIO_HAS_LOCAL_SOCKETS #ifdef ASIO_HAS_LOCAL_SOCKETS
#include <openvpn/common/peercred.hpp> #include <openvpn/common/peercred.hpp>
#endif #endif
@@ -160,7 +164,11 @@ namespace openvpn {
return false; return false;
} }
#ifdef OPENVPN_POLYSOCK_SUPPORTS_BIND
AsioBoundSocket::Socket socket;
#else
openvpn_io::ip::tcp::socket socket; openvpn_io::ip::tcp::socket socket;
#endif
}; };
#ifdef ASIO_HAS_LOCAL_SOCKETS #ifdef ASIO_HAS_LOCAL_SOCKETS
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -454,16 +454,31 @@ namespace openvpn {
std::memcpy(write_alloc(size), data, size * sizeof(T)); std::memcpy(write_alloc(size), data, size * sizeof(T));
} }
void write(const void* data, const size_t size)
{
write((const T*)data, size);
}
void prepend(const T* data, const size_t size) void prepend(const T* data, const size_t size)
{ {
std::memcpy(prepend_alloc(size), data, size * sizeof(T)); std::memcpy(prepend_alloc(size), data, size * sizeof(T));
} }
void prepend(const void* data, const size_t size)
{
prepend((const T*)data, size);
}
void read(T* data, const size_t size) void read(T* data, const size_t size)
{ {
std::memcpy(data, read_alloc(size), size * sizeof(T)); std::memcpy(data, read_alloc(size), size * sizeof(T));
} }
void read(void* data, const size_t size)
{
read((T*)data, size);
}
T* write_alloc(const size_t size) T* write_alloc(const size_t size)
{ {
if (size > remaining()) if (size > remaining())
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -30,6 +30,7 @@
#include <openvpn/common/size.hpp> #include <openvpn/common/size.hpp>
#include <openvpn/common/exception.hpp> #include <openvpn/common/exception.hpp>
#include <openvpn/common/strerror.hpp>
#include <openvpn/buffer/buflist.hpp> #include <openvpn/buffer/buflist.hpp>
namespace openvpn { namespace openvpn {
@@ -41,7 +42,7 @@ namespace openvpn {
if (status < 0) if (status < 0)
{ {
const int eno = errno; const int eno = errno;
OPENVPN_THROW(buf_read_error, "on " << title << " : " << std::strerror(eno)); OPENVPN_THROW(buf_read_error, "on " << title << " : " << strerror_str(eno));
} }
else if (!status) else if (!status)
return false; return false;
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -562,6 +562,9 @@ namespace openvpn {
void new_client() void new_client()
{ {
++generation; ++generation;
if (client_options->asio_work_always_on())
asio_work.reset(new AsioWork(io_context));
else
asio_work.reset(); asio_work.reset();
if (client) if (client)
{ {
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -50,6 +50,7 @@ namespace openvpn {
ADD_ROUTES, ADD_ROUTES,
ECHO_OPT, ECHO_OPT,
INFO, INFO,
WARN,
PAUSE, PAUSE,
RESUME, RESUME,
RELAY, RELAY,
@@ -64,6 +65,7 @@ namespace openvpn {
CERT_VERIFY_FAIL, CERT_VERIFY_FAIL,
TLS_VERSION_MIN, TLS_VERSION_MIN,
CLIENT_HALT, CLIENT_HALT,
CLIENT_SETUP,
CONNECTION_TIMEOUT, CONNECTION_TIMEOUT,
INACTIVE_TIMEOUT, INACTIVE_TIMEOUT,
DYNAMIC_CHALLENGE, DYNAMIC_CHALLENGE,
@@ -99,6 +101,7 @@ namespace openvpn {
"ADD_ROUTES", "ADD_ROUTES",
"ECHO", "ECHO",
"INFO", "INFO",
"WARN",
"PAUSE", "PAUSE",
"RESUME", "RESUME",
"RELAY", "RELAY",
@@ -113,6 +116,7 @@ namespace openvpn {
"CERT_VERIFY_FAIL", "CERT_VERIFY_FAIL",
"TLS_VERSION_MIN", "TLS_VERSION_MIN",
"CLIENT_HALT", "CLIENT_HALT",
"CLIENT_SETUP",
"CONNECTION_TIMEOUT", "CONNECTION_TIMEOUT",
"INACTIVE_TIMEOUT", "INACTIVE_TIMEOUT",
"DYNAMIC_CHALLENGE", "DYNAMIC_CHALLENGE",
@@ -395,6 +399,31 @@ namespace openvpn {
Info(std::string value) : ReasonBase(INFO, std::move(value)) {} Info(std::string value) : ReasonBase(INFO, std::move(value)) {}
}; };
struct Warn : public ReasonBase
{
Warn(std::string value) : ReasonBase(WARN, std::move(value)) {}
};
class ClientSetup : public ReasonBase
{
public:
ClientSetup(const std::string& status, const std::string& message)
: ReasonBase(CLIENT_SETUP, make(status, message))
{
}
private:
static std::string make(const std::string& status, const std::string& message)
{
std::string ret;
ret += status;
if (!status.empty() && !message.empty())
ret += ": ";
ret += message;
return ret;
}
};
class Queue : public RC<thread_unsafe_refcount> class Queue : public RC<thread_unsafe_refcount>
{ {
public: public:
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -66,6 +66,11 @@
#include <openvpn/client/cliemuexr.hpp> #include <openvpn/client/cliemuexr.hpp>
#endif #endif
#if defined(OPENVPN_EXTERNAL_TRANSPORT_FACTORY)
#include <openvpn/transport/client/extern/config.hpp>
#include <openvpn/transport/client/extern/fw.hpp>
#endif
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY) #if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
// requires that client implements ExternalTun::Factory::new_tun_factory // requires that client implements ExternalTun::Factory::new_tun_factory
#include <openvpn/tun/extern/config.hpp> #include <openvpn/tun/extern/config.hpp>
@@ -116,6 +121,7 @@ namespace openvpn {
{ {
std::string gui_version; std::string gui_version;
std::string server_override; std::string server_override;
std::string port_override;
Protocol proto_override; Protocol proto_override;
IPv6Setting ipv6; IPv6Setting ipv6;
int conn_timeout = 0; int conn_timeout = 0;
@@ -129,6 +135,7 @@ namespace openvpn {
bool info = false; bool info = false;
bool tun_persist = false; bool tun_persist = false;
bool google_dns_fallback = false; bool google_dns_fallback = false;
bool synchronous_dns_lookup = false;
std::string private_key_password; std::string private_key_password;
bool disable_client_cert = false; bool disable_client_cert = false;
int ssl_debug_level = 0; int ssl_debug_level = 0;
@@ -156,6 +163,10 @@ namespace openvpn {
#if defined(OPENVPN_EXTERNAL_TUN_FACTORY) #if defined(OPENVPN_EXTERNAL_TUN_FACTORY)
ExternalTun::Factory* extern_tun_factory = nullptr; ExternalTun::Factory* extern_tun_factory = nullptr;
#endif #endif
#if defined(OPENVPN_EXTERNAL_TRANSPORT_FACTORY)
ExternalTransport::Factory* extern_transport_factory = nullptr;
#endif
}; };
ClientOptions(const OptionList& opt, // only needs to remain in scope for duration of constructor call ClientOptions(const OptionList& opt, // only needs to remain in scope for duration of constructor call
@@ -167,6 +178,7 @@ namespace openvpn {
cli_events(config.cli_events), cli_events(config.cli_events),
server_poll_timeout_(10), server_poll_timeout_(10),
server_override(config.server_override), server_override(config.server_override),
port_override(config.port_override),
proto_override(config.proto_override), proto_override(config.proto_override),
conn_timeout_(config.conn_timeout), conn_timeout_(config.conn_timeout),
tcp_queue_limit(64), tcp_queue_limit(64),
@@ -179,7 +191,12 @@ namespace openvpn {
info(config.info), info(config.info),
autologin(false), autologin(false),
autologin_sessions(false), autologin_sessions(false),
creds_locked(false) creds_locked(false),
asio_work_always_on_(false),
synchronous_dns_lookup(false)
#ifdef OPENVPN_EXTERNAL_TRANSPORT_FACTORY
,extern_transport_factory(config.extern_transport_factory)
#endif
{ {
// parse general client options // parse general client options
const ParseClientConfig pcc(opt); const ParseClientConfig pcc(opt);
@@ -245,8 +262,9 @@ namespace openvpn {
// reconnections. // reconnections.
remote_list->set_enable_cache(config.tun_persist); remote_list->set_enable_cache(config.tun_persist);
// process server override // process server/port overrides
remote_list->set_server_override(config.server_override); remote_list->set_server_override(config.server_override);
remote_list->set_port_override(config.port_override);
// process protocol override, should be called after set_enable_cache // process protocol override, should be called after set_enable_cache
remote_list->handle_proto_override(config.proto_override, remote_list->handle_proto_override(config.proto_override,
@@ -279,6 +297,13 @@ namespace openvpn {
if (opt.exists("fragment")) if (opt.exists("fragment"))
throw option_error("sorry, 'fragment' directive is not supported, nor is connecting to a server that uses 'fragment' directive"); throw option_error("sorry, 'fragment' directive is not supported, nor is connecting to a server that uses 'fragment' directive");
#ifdef OPENVPN_PLATFORM_UWP
// workaround for OVPN3-62 Busy loop in win_event.hpp
asio_work_always_on_ = true;
#endif
synchronous_dns_lookup = config.synchronous_dns_lookup;
// init transport config // init transport config
const std::string session_name = load_transport_config(); const std::string session_name = load_transport_config();
@@ -580,6 +605,8 @@ namespace openvpn {
int conn_timeout() const { return conn_timeout_; } int conn_timeout() const { return conn_timeout_; }
bool asio_work_always_on() const { return asio_work_always_on_; }
RemoteList::Ptr remote_list_precache() const RemoteList::Ptr remote_list_precache() const
{ {
RemoteList::Ptr r; RemoteList::Ptr r;
@@ -654,6 +681,7 @@ namespace openvpn {
cp->dc.set_factory(new CryptoDCSelect<SSLLib::CryptoAPI>(frame, cli_stats, prng)); cp->dc.set_factory(new CryptoDCSelect<SSLLib::CryptoAPI>(frame, cli_stats, prng));
cp->dc_deferred = true; // defer data channel setup until after options pull cp->dc_deferred = true; // defer data channel setup until after options pull
cp->tls_auth_factory.reset(new CryptoOvpnHMACFactory<SSLLib::CryptoAPI>()); cp->tls_auth_factory.reset(new CryptoOvpnHMACFactory<SSLLib::CryptoAPI>());
cp->tls_crypt_factory.reset(new CryptoTLSCryptFactory<SSLLib::CryptoAPI>());
cp->tlsprf_factory.reset(new CryptoTLSPRFFactory<SSLLib::CryptoAPI>()); cp->tlsprf_factory.reset(new CryptoTLSPRFFactory<SSLLib::CryptoAPI>());
cp->ssl_factory = cc->new_factory(); cp->ssl_factory = cc->new_factory();
cp->load(opt, *proto_context_options, config.default_key_direction, false); cp->load(opt, *proto_context_options, config.default_key_direction, false);
@@ -679,6 +707,22 @@ namespace openvpn {
// should have been caught earlier in RemoteList::handle_proto_override. // should have been caught earlier in RemoteList::handle_proto_override.
// construct transport object // construct transport object
#ifdef OPENVPN_EXTERNAL_TRANSPORT_FACTORY
ExternalTransport::Config transconf;
transconf.remote_list = remote_list;
transconf.frame = frame;
transconf.stats = cli_stats;
transconf.socket_protect = socket_protect;
transconf.server_addr_float = server_addr_float;
transconf.synchronous_dns_lookup = synchronous_dns_lookup;
transconf.protocol = transport_protocol;
transport_factory = extern_transport_factory->new_transport_factory(transconf);
#ifdef OPENVPN_GREMLIN
udpconf->gremlin_config = gremlin_config;
#endif
#else
if (dco) if (dco)
{ {
DCO::TransportConfig transconf; DCO::TransportConfig transconf;
@@ -753,6 +797,7 @@ namespace openvpn {
else else
throw option_error("internal error: unknown transport protocol"); throw option_error("internal error: unknown transport protocol");
} }
#endif // OPENVPN_EXTERNAL_TRANSPORT_FACTORY
return remote_list->current_server_host(); return remote_list->current_server_host();
} }
@@ -774,6 +819,7 @@ namespace openvpn {
ClientCreds::Ptr creds; ClientCreds::Ptr creds;
unsigned int server_poll_timeout_; unsigned int server_poll_timeout_;
std::string server_override; std::string server_override;
std::string port_override;
Protocol proto_override; Protocol proto_override;
int conn_timeout_; int conn_timeout_;
unsigned int tcp_queue_limit; unsigned int tcp_queue_limit;
@@ -788,11 +834,16 @@ namespace openvpn {
bool autologin; bool autologin;
bool autologin_sessions; bool autologin_sessions;
bool creds_locked; bool creds_locked;
bool asio_work_always_on_;
bool synchronous_dns_lookup;
PushOptionsBase::Ptr push_base; PushOptionsBase::Ptr push_base;
OptionList::FilterBase::Ptr pushed_options_filter; OptionList::FilterBase::Ptr pushed_options_filter;
ClientLifeCycle::Ptr client_lifecycle; ClientLifeCycle::Ptr client_lifecycle;
AltProxy::Ptr alt_proxy; AltProxy::Ptr alt_proxy;
DCO::Ptr dco; DCO::Ptr dco;
#ifdef OPENVPN_EXTERNAL_TRANSPORT_FACTORY
ExternalTransport::Factory* extern_transport_factory;
#endif
}; };
} }
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -28,6 +28,10 @@
#include <string> #include <string>
#include <sstream> #include <sstream>
#ifdef HAVE_CONFIG_JSONCPP
#include "json/json.h"
#endif /* HAVE_CONFIG_JSONCPP */
#include <openvpn/common/size.hpp> #include <openvpn/common/size.hpp>
#include <openvpn/common/exception.hpp> #include <openvpn/common/exception.hpp>
#include <openvpn/common/options.hpp> #include <openvpn/common/options.hpp>
@@ -38,6 +42,9 @@
#include <openvpn/client/remotelist.hpp> #include <openvpn/client/remotelist.hpp>
#include <openvpn/client/cliconstants.hpp> #include <openvpn/client/cliconstants.hpp>
#include <openvpn/ssl/peerinfo.hpp> #include <openvpn/ssl/peerinfo.hpp>
#include <openvpn/ssl/proto.hpp>
#include <openvpn/ssl/proto_context_options.hpp>
#include <openvpn/ssl/sslchoose.hpp>
namespace openvpn { namespace openvpn {
class ParseClientConfig { class ParseClientConfig {
@@ -57,6 +64,11 @@ namespace openvpn {
std::string proto; std::string proto;
}; };
ParseClientConfig()
{
reset_pod();
}
ParseClientConfig(const OptionList& options) ParseClientConfig(const OptionList& options)
{ {
try { try {
@@ -179,9 +191,9 @@ namespace openvpn {
} }
// validate remote list // validate remote list
RemoteList rl(options, "", 0, nullptr); remoteList.reset(new RemoteList(options, "", 0, nullptr));
{ {
const RemoteList::Item* ri = rl.first_item(); const RemoteList::Item* ri = remoteList->first_item();
if (ri) if (ri)
{ {
firstRemoteListItem_.host = ri->server_host; firstRemoteListItem_.host = ri->server_host;
@@ -222,8 +234,8 @@ namespace openvpn {
} }
else else
{ {
if (rl.defined()) if (remoteList)
profileName_ = rl.first_server_host(); profileName_ = remoteList->first_server_host();
} }
} }
@@ -260,6 +272,31 @@ namespace openvpn {
if (pushPeerInfo_) if (pushPeerInfo_)
peerInfoUV_ = peer_info_uv; peerInfoUV_ = peer_info_uv;
} }
// dev name
{
const Option *o = options.get_ptr("dev");
if (o)
{
dev = o->get(1, 256);
}
}
// protocol configuration
{
protoConfig.reset(new ProtoContext::Config());
protoConfig->tls_auth_factory.reset(new CryptoOvpnHMACFactory<SSLLib::CryptoAPI>());
protoConfig->tls_crypt_factory.reset(new CryptoTLSCryptFactory<SSLLib::CryptoAPI>());
protoConfig->load(options, ProtoContextOptions(), -1, false);
}
// ssl lib configuration
try {
sslConfig.reset(new SSLLib::SSLAPI::Config());
sslConfig->load(options, SSLConfigAPI::LF_PARSE_MODE);
} catch (...) {
sslConfig.reset();
}
} }
catch (const std::exception& e) catch (const std::exception& e)
{ {
@@ -268,6 +305,11 @@ namespace openvpn {
} }
} }
static ParseClientConfig parse(const std::string& content)
{
return parse(content, nullptr);
}
static ParseClientConfig parse(const std::string& content, OptionList::KeyValueList* content_list) static ParseClientConfig parse(const std::string& content, OptionList::KeyValueList* content_list)
{ {
OptionList options; OptionList options;
@@ -397,7 +439,173 @@ namespace openvpn {
return os.str(); return os.str();
} }
std::string to_string_config() const
{
std::ostringstream os;
os << "client" << std::endl;
os << "dev " << dev << std::endl;
os << "dev-type " << protoConfig->layer.dev_type() << std::endl;
for (size_t i = 0; i < remoteList->size(); i++)
{
const RemoteList::Item& item = remoteList->get_item(i);
os << "remote " << item.server_host << " " << item.server_port;
const char *proto = item.transport_protocol.protocol_to_string();
if (proto)
os << " " << proto;
os << std::endl;
}
if (protoConfig->tls_crypt_context)
{
os << "<tls-crypt>" << std::endl << protoConfig->tls_key.render() << "</tls-crypt>"
<< std::endl;
}
else if (protoConfig->tls_auth_context)
{
os << "<tls-auth>" << std::endl << protoConfig->tls_key.render() << "</tls-auth>"
<< std::endl;
os << "key_direction " << protoConfig->key_direction << std::endl;
}
// SSL parameters
if (sslConfig)
{
print_pem(os, "ca", sslConfig->extract_ca());
print_pem(os, "crl", sslConfig->extract_crl());
print_pem(os, "key", sslConfig->extract_private_key());
print_pem(os, "cert", sslConfig->extract_cert());
std::vector<std::string> extra_certs = sslConfig->extract_extra_certs();
if (extra_certs.size() > 0)
{
os << "<extra-certs>" << std::endl;
for (auto& cert : extra_certs)
{
os << cert;
}
os << "</extra-certs>" << std::endl;
}
}
os << "cipher " << CryptoAlgs::name(protoConfig->dc.cipher(), "none")
<< std::endl;
os << "auth " << CryptoAlgs::name(protoConfig->dc.digest(), "none")
<< std::endl;
const char *comp = protoConfig->comp_ctx.method_to_string();
if (comp)
os << "compress " << comp << std::endl;
os << "keepalive " << protoConfig->keepalive_ping.to_seconds() << " "
<< protoConfig->keepalive_timeout.to_seconds() << std::endl;
os << "tun-mtu " << protoConfig->tun_mtu << std::endl;
os << "reneg-sec " << protoConfig->renegotiate.to_seconds() << std::endl;
return os.str();
}
#ifdef HAVE_CONFIG_JSONCPP
std::string to_json_config() const
{
std::ostringstream os;
Json::Value root(Json::objectValue);
root["mode"] = Json::Value("client");
root["dev"] = Json::Value(dev);
root["dev-type"] = Json::Value(protoConfig->layer.dev_type());
root["remotes"] = Json::Value(Json::arrayValue);
for (size_t i = 0; i < remoteList->size(); i++)
{
const RemoteList::Item& item = remoteList->get_item(i);
Json::Value el = Json::Value(Json::objectValue);
el["address"] = Json::Value(item.server_host);
el["port"] = Json::Value((Json::UInt)std::stoi(item.server_port));
if (item.transport_protocol() == Protocol::NONE)
el["proto"] = Json::Value("adaptive");
else
el["proto"] = Json::Value(item.transport_protocol.str());
root["remotes"].append(el);
}
if (protoConfig->tls_crypt_context)
{
root["tls_wrap"] = Json::Value(Json::objectValue);
root["tls_wrap"]["mode"] = Json::Value("tls_crypt");
root["tls_wrap"]["key"] = Json::Value(protoConfig->tls_key.render());
}
else if (protoConfig->tls_auth_context)
{
root["tls_wrap"] = Json::Value(Json::objectValue);
root["tls_wrap"]["mode"] = Json::Value("tls_auth");
root["tls_wrap"]["key_direction"] = Json::Value((Json::UInt)protoConfig->key_direction);
root["tls_wrap"]["key"] = Json::Value(protoConfig->tls_key.render());
}
// SSL parameters
if (sslConfig)
{
json_pem(root, "ca", sslConfig->extract_ca());
json_pem(root, "crl", sslConfig->extract_crl());
json_pem(root, "cert", sslConfig->extract_cert());
// JSON config is aimed to users, therefore we do not export the raw private
// key, but only some basic info
SSLConfigAPI::PKType priv_key_type = sslConfig->private_key_type();
if (priv_key_type != SSLConfigAPI::PK_NONE)
{
root["key"] = Json::Value(Json::objectValue);
root["key"]["type"] = Json::Value(sslConfig->private_key_type_string());
root["key"]["length"] = Json::Value((Json::UInt)sslConfig->private_key_length());
}
std::vector<std::string> extra_certs = sslConfig->extract_extra_certs();
if (extra_certs.size() > 0)
{
root["extra_certs"] = Json::Value(Json::arrayValue);
for (auto cert = extra_certs.begin(); cert != extra_certs.end(); cert++)
{
if (!cert->empty())
root["extra_certs"].append(Json::Value(*cert));
}
}
}
root["cipher"] = Json::Value(CryptoAlgs::name(protoConfig->dc.cipher(), "none"));
root["auth"] = Json::Value(CryptoAlgs::name(protoConfig->dc.digest(), "none"));
if (protoConfig->comp_ctx.type() != CompressContext::NONE)
root["compression"] = Json::Value(protoConfig->comp_ctx.str());
root["keepalive"] = Json::Value(Json::objectValue);
root["keepalive"]["ping"] = Json::Value((Json::UInt)protoConfig->keepalive_ping.to_seconds());
root["keepalive"]["timeout"] = Json::Value((Json::UInt)protoConfig->keepalive_timeout.to_seconds());
root["tun_mtu"] = Json::Value((Json::UInt)protoConfig->tun_mtu);
root["reneg_sec"] = Json::Value((Json::UInt)protoConfig->renegotiate.to_seconds());
return root.toStyledString();
}
#endif /* HAVE_CONFIG_JSONCPP */
private: private:
static void print_pem(std::ostream& os, std::string label, std::string pem)
{
if (pem.empty())
return;
os << "<" << label << ">" << std::endl << pem << "</" << label << ">" << std::endl;
}
#ifdef HAVE_CONFIG_JSONCPP
static void json_pem(Json::Value& obj, std::string key, std::string pem)
{
if (pem.empty())
return;
obj[key] = Json::Value(pem);
}
#endif /* HAVE_CONFIG_JSONCPP */
static bool parse_auth_user_pass(const OptionList& options, std::vector<std::string>* user_pass) static bool parse_auth_user_pass(const OptionList& options, std::vector<std::string>* user_pass)
{ {
return UserPass::parse(options, "auth-user-pass", 0, user_pass); return UserPass::parse(options, "auth-user-pass", 0, user_pass);
@@ -456,11 +664,6 @@ namespace openvpn {
} }
} }
ParseClientConfig()
{
reset_pod();
}
void reset_pod() void reset_pod()
{ {
error_ = autologin_ = externalPki_ = staticChallengeEcho_ = false; error_ = autologin_ = externalPki_ = staticChallengeEcho_ = false;
@@ -496,8 +699,12 @@ namespace openvpn {
ServerList serverList_; ServerList serverList_;
bool hasEmbeddedPassword_; bool hasEmbeddedPassword_;
std::string embeddedPassword_; std::string embeddedPassword_;
RemoteList::Ptr remoteList;
RemoteItem firstRemoteListItem_; RemoteItem firstRemoteListItem_;
PeerInfo::Set::Ptr peerInfoUV_; PeerInfo::Set::Ptr peerInfoUV_;
ProtoContext::Config::Ptr protoConfig;
SSLLib::SSLAPI::Config::Ptr sslConfig;
std::string dev;
}; };
} }
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -785,10 +785,23 @@ namespace openvpn {
} }
} }
// react to any tls warning triggered during the tls-handshake
virtual void check_tls_warnings()
{
uint32_t tls_warnings = get_tls_warnings();
if (tls_warnings & SSLAPI::TLS_WARN_SIG_MD5)
{
ClientEvent::Base::Ptr ev = new ClientEvent::Warn("TLS: received certificate signed with MD5. Please inform your admin to upgrade to a stronger algorithm. Support for MD5 will be dropped at end of Apr 2018");
cli_events->add_event(std::move(ev));
}
}
// base class calls here when primary session transitions to ACTIVE state // base class calls here when primary session transitions to ACTIVE state
virtual void active() virtual void active()
{ {
OPENVPN_LOG("Session is ACTIVE"); OPENVPN_LOG("Session is ACTIVE");
check_tls_warnings();
schedule_push_request_callback(Time::Duration::seconds(0)); schedule_push_request_callback(Time::Duration::seconds(0));
} }
@@ -842,6 +855,7 @@ namespace openvpn {
else else
{ {
housekeeping_timer.cancel(); housekeeping_timer.cancel();
housekeeping_schedule.reset();
} }
} }
} }
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -338,8 +338,8 @@ namespace openvpn {
else else
{ {
// call into Asio to do the resolve operation // call into Asio to do the resolve operation
OPENVPN_LOG_REMOTELIST("*** PreResolve RESOLVE on " << item.server_host); OPENVPN_LOG_REMOTELIST("*** PreResolve RESOLVE on " << item.server_host << " : " << item.server_port);
resolver.async_resolve(item.server_host, "", resolver.async_resolve(item.server_host, item.server_port,
[self=Ptr(this)](const openvpn_io::error_code& error, openvpn_io::ip::tcp::resolver::results_type results) [self=Ptr(this)](const openvpn_io::error_code& error, openvpn_io::ip::tcp::resolver::results_type results)
{ {
self->resolve_callback(error, results); self->resolve_callback(error, results);
@@ -517,16 +517,27 @@ namespace openvpn {
// override all server hosts to server_override // override all server hosts to server_override
void set_server_override(const std::string& server_override) void set_server_override(const std::string& server_override)
{ {
if (!server_override.empty()) if (server_override.empty())
return;
for (auto &item : list)
{ {
for (std::vector<Item::Ptr>::iterator i = list.begin(); i != list.end(); ++i) item->server_host = server_override;
{ item->res_addr_list.reset();
Item& item = **i;
item.server_host = server_override;
item.res_addr_list.reset(nullptr);
} }
reset_cache(); reset_cache();
} }
// override all server ports to port_override
void set_port_override(const std::string& port_override)
{
if (port_override.empty())
return;
for (auto &item : list)
{
item->server_port = port_override;
item->res_addr_list.reset();
}
reset_cache();
} }
void set_random(const RandomAPI::Ptr& rng_arg) void set_random(const RandomAPI::Ptr& rng_arg)
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.
@@ -4,18 +4,18 @@
// packet encryption, packet authentication, and // packet encryption, packet authentication, and
// packet compression. // packet compression.
// //
// Copyright (C) 2012-2017 OpenVPN Technologies, Inc. // Copyright (C) 2012-2017 OpenVPN Inc.
// //
// This program is free software: you can redistribute it and/or modify // This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License Version 3 // it under the terms of the GNU Affero General Public License Version 3
// as published by the Free Software Foundation. // as published by the Free Software Foundation.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU Affero General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU Affero General Public License
// along with this program in the COPYING file. // along with this program in the COPYING file.
// If not, see <http://www.gnu.org/licenses/>. // If not, see <http://www.gnu.org/licenses/>.

Some files were not shown because too many files have changed in this diff Show More