From patchwork Mon Jul 31 11:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "plaisthos (Code Review)" X-Patchwork-Id: 3310 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:a549:b0:d7:3b0f:3938 with SMTP id ca9csp1257709dyb; Mon, 31 Jul 2023 04:28:18 -0700 (PDT) X-Google-Smtp-Source: APBJJlG75ZYZ8AyfogFNeMZn5WGcKvtWl0LoAXQYuCM3MUmffqkdT7ihaoIpiEGRpC5OiB5ABRLD X-Received: by 2002:a17:903:228f:b0:1b9:be2e:2b40 with SMTP id b15-20020a170903228f00b001b9be2e2b40mr11803282plh.50.1690802897792; Mon, 31 Jul 2023 04:28:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690802897; cv=none; d=google.com; s=arc-20160816; b=Wx2RnuoPFSy4yfZx0aKTgEI88iGF4JxTNOAAeAz7l13ZS0O2zHs1Kz7V8xWOrDHkg9 WkLSxBLcjyWSnutman2wu+sV/r8dqzJYTo84VqoQPZOSHcWB4PatgJU1mhpgZbGw0FEY 1oJ3+dUmlxY/oqolMraYnMiRdVy4Ul79pR53wm3uubr0fbP9nkdpZk/lf0zX97zkZSFm 6LjSl4mUTcpxHhugdMZ3KQ7qIhPG4VtOWhtvrtZzP97yOseZw/cHP+h6FAPbcAi0KvVe twsTTVEORoaB2vpJ0Hntg/JLpaLpp6a3CtwBatJDCH4N3P5rSqFu0cFvjMU9D4npIKvl bfgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:cc:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :mime-version:message-id:references:auto-submitted:date:from :dkim-signature:dkim-signature:dkim-signature; bh=Xq6KaJvHV+WfMZODemnar6+YOCkzkbRksCVjvMzrgPo=; fh=XnSas7nGiRWgtUNrQph4CLMGixqhzm1JnqtYGZx/g7s=; b=GVNP4u5LCblwCCSIaz0XBTav9mlCtOQL4et0uj+QGmKzXGVMgTJlw7V1y0YGgMob7G mX7DSET/vaRTjRG44MjJuOfp0rRo7c7XL/Km/GPvtwNTorj7/5RwqBdjiZtQQMntJW6L jmIwBLLTvzaLRDSpIJjrC/bLrJzROV1Pok9w+DIQhtWD9Gt1mTp3vWiMiJVFm/jCymEs z2mmcAzTk2NFozZacFCPZ6qx/FqxZ2krz8pjzjOvX0RZ0w7pgxGbqQTYKMOacx5GPDkX olGNVOVPgK+dNVl6tlh2JVkoNychBNJvqHExh2QmHbBF+2WjJVOy+3m8b+diA5kuBML0 nY+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=afz6suNd; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=muLXsEBN; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Rsb4vWC3; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id m3-20020a170902db0300b001bbb0fe3641si7419775plx.489.2023.07.31.04.28.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 31 Jul 2023 04:28:17 -0700 (PDT) Received-SPF: pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) client-ip=216.105.38.7; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=afz6suNd; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=muLXsEBN; dkim=neutral (body hash did not verify) header.i=@openvpn.net header.s=google header.b=Rsb4vWC3; spf=pass (google.com: domain of openvpn-devel-bounces@lists.sourceforge.net designates 216.105.38.7 as permitted sender) smtp.mailfrom=openvpn-devel-bounces@lists.sourceforge.net; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=openvpn.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1qQR3a-00021L-13; Mon, 31 Jul 2023 11:27:22 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1qQR3W-00021D-D3 for openvpn-devel@lists.sourceforge.net; Mon, 31 Jul 2023 11:27:18 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:Content-Transfer-Encoding:MIME-Version :Message-ID:Reply-To:References:Subject:List-Unsubscribe:List-Id:Cc:Date:From :Sender:To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help: List-Subscribe:List-Post:List-Owner:List-Archive; bh=lrr4epuEEslL0Am8ti7TWfm8LncSwPi+FuDH2L52RAk=; b=afz6suNdBC9SzYxBDDRehTopfT OX4V2PVJ4NUvKZCG8XV8/ep/8QsMsWdc4s3YqPcNZaMXucdQVGpAn+GkxqPKvskIJHrmlYfJ7niTZ hpot1hEjVDBv7GEv4WRqVlYNUSX7RPvDZbIIJLj3necC4qvV0FmkUsq6reW8jbSV6vC4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Type:Content-Transfer-Encoding:MIME-Version:Message-ID:Reply-To: References:Subject:List-Unsubscribe:List-Id:Cc:Date:From:Sender:To:Content-ID :Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To: Resent-Cc:Resent-Message-ID:In-Reply-To:List-Help:List-Subscribe:List-Post: List-Owner:List-Archive; bh=lrr4epuEEslL0Am8ti7TWfm8LncSwPi+FuDH2L52RAk=; b=m uLXsEBNtaGmMt/XsFZxHkYs6PbKXE47GOVrlInmZiK9Gq+z2o/pcoxP42AH7/LGIIjbc+HuHlhfIe XQqv/voC7/1M12i0khbtXidUOEJTIICzfTa0ac6UQnFAA4Yvo0Q/0tyViB9GZg7VF1DEyg0WkbnGE hZwXP5P4DPMS/ZfU=; Received: from mail-wr1-f54.google.com ([209.85.221.54]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.95) id 1qQR3R-0002Du-3w for openvpn-devel@lists.sourceforge.net; Mon, 31 Jul 2023 11:27:18 +0000 Received: by mail-wr1-f54.google.com with SMTP id ffacd0b85a97d-3178dd771ceso3001886f8f.2 for ; Mon, 31 Jul 2023 04:27:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=openvpn.net; s=google; t=1690802826; x=1691407626; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:date:from:from:to:cc :subject:date:message-id:reply-to; bh=lrr4epuEEslL0Am8ti7TWfm8LncSwPi+FuDH2L52RAk=; b=Rsb4vWC38zzjYEkxwhLnIU4soDHevkxZhC2LVzV5IeuAZGj3OIwoMEN4UGuF4SH0fF S0LJofTJMn1rsIHAYPW4IGTZCUSlELvjP/X3Ta1BcOiqnkQE9r7e59+xxX5BrJAhkfph NSa/p3cc40LbQ/tXzs5JaSGJsbx/XO/Iszn66B4m1Xf1Sc7Tj8L2NfiuhB3RvVzjR5Hq jR1Rp8hA9GZtY5y2KCx7zr78xlqz5XlXUUr9jhVTQB0JbXO+FsZmFr6FS/7t9o3Z/4vs EcCc+WDAOETE6JQkjOplDeDbQt5tajoMhqMiJbTEFxBI1IoesOuac3yi4NA/TCShCMBw 6xmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690802826; x=1691407626; h=user-agent:content-disposition:content-transfer-encoding :mime-version:message-id:reply-to:references:subject :list-unsubscribe:list-id:auto-submitted:cc:date:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=lrr4epuEEslL0Am8ti7TWfm8LncSwPi+FuDH2L52RAk=; b=bYqmtN1aw9tvcomeEugJEzHo3mc7ILJl9YIKqkraF1soPZ/VAo4eTmn/3mtMyG55DJ ZM71kpkEa5e5wSKDNxglEgecKPNrUBSyzG2rdr/LlsyRc1hKZIYlWagquQ3TZg57H3x4 yzStx448TNI8H1+e8D9vLog29dR9nTezPYjsrXvRpo2nNTxvX7Ewuh5o+IZY+0px4x9Z KKfR9epGV7O/aDJokdzRpXdMhb9kW6qO0fegmTQD3EelOTmLLFE+AvYf/YYFYSCtJxCi wHTET+t8ec2QsXF/3cQOOVaUmbcGxyTuGtCfFS9hA1ngli/uDi32T/qj+61VuDnpGAdX gncQ== X-Gm-Message-State: ABy/qLZeYjzFsAuXO03EkNMGcZrqRKy8OOYoiQWA5O1i6nPjZP2bvYjV 2S8aB6Wvlb2A3dVm+9KFadLJXg== X-Received: by 2002:adf:facd:0:b0:317:53e7:d7c2 with SMTP id a13-20020adffacd000000b0031753e7d7c2mr7527248wrs.11.1690802826095; Mon, 31 Jul 2023 04:27:06 -0700 (PDT) Received: from gerrit.openvpn.in (ec2-18-159-0-78.eu-central-1.compute.amazonaws.com. [18.159.0.78]) by smtp.gmail.com with ESMTPSA id d14-20020adff2ce000000b003176053506fsm9095950wrp.99.2023.07.31.04.27.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jul 2023 04:27:05 -0700 (PDT) From: "stipa (Code Review)" X-Google-Original-From: "stipa (Code Review)" X-Gerrit-PatchSet: 1 Date: Mon, 31 Jul 2023 11:27:05 +0000 Auto-Submitted: auto-generated X-Gerrit-MessageType: newchange X-Gerrit-Change-Id: I666314a223d324ca72dbe7ba7d22f764996d3ca2 X-Gerrit-Change-Number: 322 X-Gerrit-Project: openvpn X-Gerrit-ChangeURL: X-Gerrit-Commit: a717c0df0c551d62c780c2d9f9d84ebf7aba67dc References: Message-ID: <5686a39411cec135016dd392f76ed665e9f067ee-HTML@gerrit.openvpn.net> MIME-Version: 1.0 User-Agent: Gerrit/3.8.0 X-Spam-Score: 1.0 (+) X-Spam-Report: Spam detection software, running on the system "util-spamd-2.v13.lw.sourceforge.com", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Attention is currently required from: flichtenheld, plaisthos. stipa has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/322?usp=email ) Change subject: add basic CMake based build Content analysis details: (1.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.221.54 listed in list.dnswl.org] -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.221.54 listed in wl.mailspike.net] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 1.2 MISSING_HEADERS Missing To: header 0.0 WEIRD_PORT URI: Uses non-standard port number for HTTP 0.0 HTML_MESSAGE BODY: HTML included in message -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.0 T_SCC_BODY_TEXT_LINE No description available. 0.0 T_KAM_HTML_FONT_INVALID Test for Invalidly Named or Formatted Colors in HTML X-Headers-End: 1qQR3R-0002Du-3w Subject: [Openvpn-devel] [XL] Change in openvpn[release/2.6]: add basic CMake based build X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: lstipakov@gmail.com, arne-openvpn@rfc2549.org, openvpn-devel@lists.sourceforge.net, frank@lichtenheld.com Cc: plaisthos , openvpn-devel Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1772935339137210680?= X-GMAIL-MSGID: =?utf-8?q?1772935339137210680?= Attention is currently required from: flichtenheld, plaisthos. stipa has uploaded this change for review. ( http://gerrit.openvpn.net/c/openvpn/+/322?usp=email ) Change subject: add basic CMake based build ...................................................................... add basic CMake based build This helps with IDE integration among other things. This is a basic implementation for development purposes that can't replace any of the existing release builds. Change-Id: I666314a223d324ca72dbe7ba7d22f764996d3ca2 Signed-off-by: Arne Schwabe Signed-off-by: Frank Lichtenheld --- A CMakeLists.txt A config.h.cmake.in M src/openvpn/lzo.h 3 files changed, 1,091 insertions(+), 1 deletion(-) git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/22/322/1 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9978ea4 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,591 @@ + cmake_minimum_required(VERSION 3.3) +project(openvpn) + +# This CMake file implements building OpenVPN with CMAKE +# +# Note that this is *NOT* the official way to build openvpn on anything +# other than Windows/mingw despite working on other platforms too. You will need +# to add -DUNSUPPORTED_BUILDS=true to build on non Windows platforms. +# +# This cmake also makes a few assertions like lzo, lz4 being used +# and OpenSSL having version 1.1.1+ and generally does not offer the same +# configurability like autoconf + +# -DCMAKE_TOOLCHAIN_FILE=C:/Users/User/source/repos/vcpkg/scripts/buildsystems/vcpkg.cmake +#-DVCPKG_OVERLAY_PORTS=C:/Users/User/source/repos/openvpn/contrib/vcpkg-ports +#-GNinja + +option(UNSUPPORTED_BUILDS "Allow unsupported builds" OFF) + +if (NOT WIN32 AND NOT ${UNSUPPORTED_BUILDS}) + message(FATAL_ERROR "Note: on Unix platform the official and supported build method is using autoconfig. CMake based build should be only used for Windows and internal testing/development.") +endif() + +option(MBED "BUILD with mbed" OFF) +option(WOLFSSL "BUILD with wolfSSL" OFF) +if (MSVC) + option(USE_WERROR "Treat compiler warnings as errors (-Werror)" OFF) +else () + option(USE_WERROR "Treat compiler warnings as errors (-Werror)" ON) +endif () +option(PLUGIN_DIR "Location of the plugin directory" /usr/local/lib/openvpn/plugins) + +# AddressSanitize - use CXX=clang++ CC=clang cmake -DCMAKE_BUILD_TYPE=asan to build with ASAN +set(CMAKE_C_FLAGS_ASAN + "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" + CACHE STRING "Flags used by the C compiler during AddressSanitizer builds." + FORCE) +set(CMAKE_CXX_FLAGS_ASAN + "-fsanitize=address,undefined -fno-sanitize-recover=all -fno-optimize-sibling-calls -fsanitize-address-use-after-scope -fno-omit-frame-pointer -g -O1" + CACHE STRING "Flags used by the C++ compiler during AddressSanitizer builds." + FORCE) + +if (MSVC) + target_compile_options(${target} PRIVATE /W3) +else () + add_compile_options(-Wall -Wuninitialized) + # We are not ready for this + #add_compile_options(-Wsign-compare) +endif () + +find_package(PkgConfig) +INCLUDE(CheckSymbolExists) +INCLUDE(CheckIncludeFiles) +INCLUDE(CheckTypeSize) +INCLUDE(CheckStructHasMember) + +set(OPENVPN_VERSION_MAJOR 2) +set(OPENVPN_VERSION_MINOR 6) +set(OPENVPN_VERSION_PATCH _git) + +if (NOT WIN32) + add_definitions(-DPLUGIN_LIBDIR=\"${PLUGIN_DIR}\") +endif () + +# TODO remove later when msvc-config.h is removed and we can always include config.h +add_definitions(-DHAVE_CONFIG_H) + + +# Set the various defines for config.h.cmake.in +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set(TARGET_LINUX YES) + set(ENABLE_ASYNC_PUSH YES) + set(ENABLE_LINUXDCO YES) + set(ENABLE_SITNL YES) + set(HAVE_DECL_SO_MARK YES) + set(ENABLE_FEATURE_TUN_PERSIST 1) + set(HAVE_LINUX_TYPES_H 1) + set(ENABLE_DCO YES) + set(HAVE_CMSGHDR YES) +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + set(TARGET_FREEBSD YES) + set(ENABLE_DCO YES) + link_libraries(-lnv) +elseif (WIN32) + set(ENABLE_DCO YES) +elseif (APPLE) + set(TARGET_DARWIN YES) + set(HAVE_NET_IF_UTUN_H YES) +endif () + +if (UNIX) + set(PATH_SEPARATOR /) + set(ENABLE_PORT_SHARE YES) + set(HAVE_SA_FAMILY_T YES) +elseif (WIN32) + set(PATH_SEPARATOR \\\\) + set(TARGET_WIN32 YES) +endif () + +CHECK_SYMBOL_EXISTS(chroot unistd.h HAVE_CHROOT) +CHECK_SYMBOL_EXISTS(chdir unistd.h HAVE_CHDIR) +CHECK_SYMBOL_EXISTS(dup unistd.h HAVE_DUP) +CHECK_SYMBOL_EXISTS(dup2 unistd.h HAVE_DUP2) +CHECK_SYMBOL_EXISTS(fork unistd.h HAVE_FORK) +CHECK_SYMBOL_EXISTS(execve unistd.h HAVE_EXECVE) +CHECK_SYMBOL_EXISTS(ftruncate unistd.h HAVE_FTRUNCATE) +CHECK_SYMBOL_EXISTS(setgid unistd.h HAVE_SETGID) +CHECK_SYMBOL_EXISTS(setuid unistd.h HAVE_SETUID) +CHECK_SYMBOL_EXISTS(getpeereid unistd.h HAVE_GETPEEREID) + +CHECK_SYMBOL_EXISTS(epoll_create sys/epoll.h HAVE_EPOLL_CREATE) + +CHECK_SYMBOL_EXISTS(gettimeofday sys/time.h HAVE_GETTIMEOFDAY) +CHECK_SYMBOL_EXISTS(basename libgen.h HAVE_BASENAME) +CHECK_SYMBOL_EXISTS(chsize io.h HAVE_CHSIZE) +CHECK_SYMBOL_EXISTS(daemon stdlib.h HAVE_DAEMON) +CHECK_SYMBOL_EXISTS(dirname libgen.h HAVE_DIRNAME) +CHECK_SYMBOL_EXISTS(getrlimit sys/resource.h HAVE_GETRLIMIT) +CHECK_SYMBOL_EXISTS(mlockall sys/mman.h HAVE_MLOCKALL) + +CHECK_SYMBOL_EXISTS(sendmsg sys/socket.h HAVE_SENDMSG) +CHECK_SYMBOL_EXISTS(recvmsg sys/socket.h HAVE_RECVMSG) +CHECK_SYMBOL_EXISTS(cmsghdr sys/socket.h HAVE_CMSGHDR) +CHECK_SYMBOL_EXISTS(openlog syslog.h HAVE_OPENLOG) +CHECK_SYMBOL_EXISTS(syslog syslog.h HAVE_SYSLOG) +CHECK_SYMBOL_EXISTS(getgrnam grp.h HAVE_GETGRNAM) +CHECK_SYMBOL_EXISTS(getpwnam pwd.h HAVE_GETPWNAM) +CHECK_SYMBOL_EXISTS(getsockname sys/socket.h HAVE_GETSOCKNAME) + +# Some OS (e.g. FreeBSD) need some basic headers to allow +# including network headers +SET(NETEXTRA sys/types.h) +CHECK_INCLUDE_FILES("${NETEXTRA};netinet/in.h" HAVE_NETINET_IN_H) + +if (HAVE_NETINET_IN_H) + LIST(APPEND NETEXTRA netinet/in.h) +endif () + +CHECK_INCLUDE_FILES("${NETEXTRA};netinet/in6.h" HAVE_NETINET_IN_H) +CHECK_INCLUDE_FILES(linux/if_tun.h HAVE_LINUX_IF_TUN_H) +CHECK_INCLUDE_FILES(linux/sockios.h HAVE_LINUX_SOCKIOS_H) +CHECK_INCLUDE_FILES(dlfcn.h HAVE_DLFCN_H) +CHECK_INCLUDE_FILES(fcntl.h HAVE_FCNTL_H) +CHECK_INCLUDE_FILES(dmalloc.h HAVE_DMALLOC_H) +CHECK_INCLUDE_FILES(err.h HAVE_ERR_H) +CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H) +CHECK_INCLUDE_FILES(poll.h HAVE_POLL_H) +CHECK_INCLUDE_FILES(sys/socket.h HAVE_SYS_SOCKET_H) +CHECK_INCLUDE_FILES(sys/time.h HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILES(netdb.h HAVE_NETDB_H) +CHECK_INCLUDE_FILES(unistd.h HAVE_UNISTD_H) +CHECK_INCLUDE_FILES(sys/un.h HAVE_SYS_UN_H) +CHECK_INCLUDE_FILES(libgen.h HAVE_LIBGEN_H) +CHECK_INCLUDE_FILES(net/if.h HAVE_NET_IF_H) +CHECK_INCLUDE_FILES("${NETEXTRA};netinet/ip.h" HAVE_NETINET_IP_H) +CHECK_INCLUDE_FILES(arpa/inet.h HAVE_ARPA_INET_H) +CHECK_INCLUDE_FILES(net/if_utun.h HAVE_NET_UTUN_H) +CHECK_INCLUDE_FILES(sys/ioctl.h HAVE_SYS_IOCTL_H) +CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H) +CHECK_INCLUDE_FILES("${NETEXTRA};sys/uio.h" HAVE_SYS_UIO_H) +CHECK_INCLUDE_FILES(syslog.h HAVE_SYSLOG_H) +CHECK_INCLUDE_FILES(sys/wait.h HAVE_SYS_WAIT_H) +CHECK_INCLUDE_FILES(grp.h HAVE_GRP_H) +CHECK_INCLUDE_FILES(pwd.h HAVE_PWD_H) +CHECK_INCLUDE_FILES(sys/mman.h HAVE_SYS_MMAN_H) + + +CHECK_INCLUDE_FILES("${NETEXTRA};resolv.h" HAVE_RESOLV_H) +CHECK_INCLUDE_FILES("${NETEXTRA};net/if_tun.h" HAVE_NET_IF_TUN_H) + +# Is this obscure header needed anywhere?! +CHECK_INCLUDE_FILES(netinet/in_systm.h HAVE_NETINET_IN_SYSTM_H) + + +SET(CMAKE_EXTRA_INCLUDE_FILES netinet/ip.h) +CHECK_TYPE_SIZE("struct in_pktinfo" IN_PKTINFO) +CHECK_STRUCT_HAS_MEMBER("struct in_pktinfo" ipi_spec_dst netinet/ip.h HAVE_IPI_SPEC_DST) +CHECK_TYPE_SIZE("struct msghdr" MSGHDR) +SET(CMAKE_EXTRA_INCLUDE_FILES) + +find_program(IFCONFIG_PATH ifconfig) +find_program(IPROUTE_PATH ip) +find_program(ROUTE_PATH route) + + +if (NOT WIN32) + set(ENABLE_LZ4 YES) + set(ENABLE_LZO YES) +endif () + +function(add_library_deps target) + if (${MBED}) + target_include_directories(${target} PRIVATE $ENV{HOME}/oss/mbedtls2/include) + message("Building ${target} for mbed TLS") + target_link_libraries(${target} PUBLIC -L$ENV{HOME}/oss/mbedtls2/library -L/usr/local/opt/lzo/lib -lmbedtls -lmbedx509 -lmbedcrypto) + elseif (${WOLFSSL}) + pkg_search_module(wolfssl wolfssl REQUIRED) + target_link_libraries(${target} PUBLIC ${wolfssl_LINK_LIBRARIES}) + target_include_directories(${target} PRIVATE ${wolfssl_INCLUDE_DIRS}/wolfssl) + message("Building ${target} for WolfSSL: ${wolfssl_LINK_LIBRARIES} ${wolfssl_INCLUDE_DIRS}/wolfsll") + else () + set(ENABLE_X509ALTUSERNAME YES) + + find_package(OpenSSL REQUIRED) + target_link_libraries(${target} PUBLIC OpenSSL::SSL) + + message("Building ${target} for default OpenSSL") + endif () + + + if (${ENABLE_LZ4}) + pkg_search_module(liblz4 liblz4 REQUIRED IMPORTED_TARGET) + target_link_libraries(${target} PUBLIC PkgConfig::liblz4) + endif () + + if (${ENABLE_LZO}) + pkg_search_module(lzo2 lzo2 REQUIRED IMPORTED_TARGET) + target_link_libraries(${target} PUBLIC PkgConfig::lzo2) + endif () + + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + target_include_directories(${target} PUBLIC ${LIBNL_INCLUDE_DIRS}) + target_link_libraries(${target} PUBLIC ${LIBNL_LIBRARIES}) + endif () + + if (USE_WERROR) + if (MSVC) + target_compile_options(${target} PRIVATE /WX) + else () + target_compile_options(${target} PRIVATE -Werror) + endif () + endif () +endfunction() + +if (${MBED}) + set(ENABLE_CRYPTO_MBEDTLS YES) +elseif (${WOLFSSL}) + set(ENABLE_CRYPTO_OPENSSL YES) + set(ENABLE_CRYPTO_WOLFSSL YES) + set(ENABLE_X509ALTUSERNAME YES) +else () + set(ENABLE_CRYPTO_OPENSSL YES) + set(ENABLE_X509ALTUSERNAME YES) +endif () + +include_directories(${CMAKE_CURRENT_SOURCE_DIR} src/compat include) + +if (WIN32) + find_package(OpenSSL REQUIRED) + + link_libraries(OpenSSL::SSL OpenSSL::Crypto ws2_32.lib Crypt32.lib fwpuclnt.lib iphlpapi.lib + wininet.lib setupapi.lib rpcrt4.lib wtsapi32.lib Ncrypt.lib) + add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D _WINSOCK_DEPRECATED_NO_WARNINGS -D_CONSOLE) +endif () + +configure_file(config.h.cmake.in config.h) +configure_file(include/openvpn-plugin.h.in openvpn-plugin.h) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +set(SOURCE_FILES + ${CMAKE_CURRENT_BINARY_DIR}/config.h + ${CMAKE_CURRENT_BINARY_DIR}/openvpn-plugin.h + + src/compat/compat-basename.c + src/compat/compat-daemon.c + src/compat/compat-dirname.c + src/compat/compat-gettimeofday.c + src/compat/compat-strsep.c + src/compat/compat-versionhelpers.h + src/openvpn/argv.c + src/openvpn/argv.h + src/openvpn/base64.c + src/openvpn/base64.h + src/openvpn/basic.h + src/openvpn/block_dns.h + src/openvpn/block_dns.c + src/openvpn/buffer.c + src/openvpn/buffer.h + src/openvpn/circ_list.h + src/openvpn/clinat.c + src/openvpn/clinat.h + src/openvpn/common.h + src/openvpn/comp-lz4.c + src/openvpn/comp-lz4.h + src/openvpn/comp.c + src/openvpn/comp.h + src/openvpn/compstub.c + src/openvpn/console.c + src/openvpn/console_builtin.c + src/openvpn/console.h + src/openvpn/crypto.c + src/openvpn/crypto.h + src/openvpn/crypto_backend.h + src/openvpn/crypto_openssl.c + src/openvpn/crypto_openssl.h + src/openvpn/crypto_mbedtls.c + src/openvpn/crypto_mbedtls.h + src/openvpn/cryptoapi.c + src/openvpn/cryptoapi.h + src/openvpn/dco.c + src/openvpn/dco.h + src/openvpn/dco_win.c + src/openvpn/dco_win.h + src/openvpn/dco_linux.c + src/openvpn/dco_linux.h + src/openvpn/dco_freebsd.c + src/openvpn/dco_freebsd.h + src/openvpn/dhcp.c + src/openvpn/dhcp.h + src/openvpn/dns.c + src/openvpn/dns.h + src/openvpn/errlevel.h + src/openvpn/env_set.c + src/openvpn/env_set.h + src/openvpn/error.c + src/openvpn/error.h + src/openvpn/event.c + src/openvpn/event.h + src/openvpn/fdmisc.c + src/openvpn/fdmisc.h + src/openvpn/forward.c + src/openvpn/forward.h + src/openvpn/fragment.c + src/openvpn/fragment.h + src/openvpn/gremlin.c + src/openvpn/gremlin.h + src/openvpn/helper.c + src/openvpn/helper.h + src/openvpn/httpdigest.c + src/openvpn/httpdigest.h + src/openvpn/init.c + src/openvpn/init.h + src/openvpn/integer.h + src/openvpn/interval.c + src/openvpn/interval.h + src/openvpn/list.c + src/openvpn/list.h + src/openvpn/lladdr.c + src/openvpn/lladdr.h + src/openvpn/lzo.c + src/openvpn/lzo.h + src/openvpn/manage.c + src/openvpn/manage.h + src/openvpn/mbuf.c + src/openvpn/mbuf.h + src/openvpn/memdbg.h + src/openvpn/misc.c + src/openvpn/misc.h + src/openvpn/mroute.c + src/openvpn/mroute.h + src/openvpn/mss.c + src/openvpn/mss.h + src/openvpn/mstats.c + src/openvpn/mstats.h + src/openvpn/mtcp.c + src/openvpn/mtcp.h + src/openvpn/mtu.c + src/openvpn/mtu.h + src/openvpn/mudp.c + src/openvpn/mudp.h + src/openvpn/multi.c + src/openvpn/multi.h + src/openvpn/ntlm.c + src/openvpn/ntlm.h + src/openvpn/occ.c + src/openvpn/occ.h + src/openvpn/openvpn.c + src/openvpn/openvpn.h + src/openvpn/options.c + src/openvpn/options.h + src/openvpn/options_util.c + src/openvpn/options_util.h + src/openvpn/otime.c + src/openvpn/otime.h + src/openvpn/ovpn_dco_win.h + src/openvpn/packet_id.c + src/openvpn/packet_id.h + src/openvpn/perf.c + src/openvpn/perf.h + src/openvpn/ping.c + src/openvpn/ping.h + src/openvpn/pkcs11.c + src/openvpn/pkcs11.h + src/openvpn/pkcs11_backend.h + src/openvpn/pkcs11_openssl.c + src/openvpn/pkcs11_mbedtls.c + src/openvpn/platform.c + src/openvpn/platform.h + src/openvpn/plugin.c + src/openvpn/plugin.h + src/openvpn/pool.c + src/openvpn/pool.h + src/openvpn/proto.c + src/openvpn/proto.h + src/openvpn/proxy.c + src/openvpn/proxy.h + src/openvpn/ps.c + src/openvpn/ps.h + src/openvpn/push.c + src/openvpn/push.h + src/openvpn/pushlist.h + src/openvpn/reliable.c + src/openvpn/reliable.h + src/openvpn/route.c + src/openvpn/route.h + src/openvpn/run_command.c + src/openvpn/run_command.h + src/openvpn/schedule.c + src/openvpn/schedule.h + src/openvpn/session_id.c + src/openvpn/session_id.h + src/openvpn/shaper.c + src/openvpn/shaper.h + src/openvpn/sig.c + src/openvpn/sig.h + src/openvpn/socket.c + src/openvpn/socket.h + src/openvpn/socks.c + src/openvpn/socks.h + src/openvpn/ssl.c + src/openvpn/ssl.h + src/openvpn/ssl_backend.h + src/openvpn/ssl_common.h + src/openvpn/ssl_openssl.c + src/openvpn/ssl_openssl.h + src/openvpn/ssl_mbedtls.c + src/openvpn/ssl_mbedtls.h + src/openvpn/ssl_verify.c + src/openvpn/ssl_verify.h + src/openvpn/ssl_verify_backend.h + src/openvpn/ssl_verify_openssl.c + src/openvpn/ssl_verify_openssl.h + src/openvpn/ssl_verify_mbedtls.c + src/openvpn/ssl_verify_mbedtls.h + src/openvpn/status.c + src/openvpn/status.h + src/openvpn/syshead.h + src/openvpn/tls_crypt.c + src/openvpn/tun.c + src/openvpn/tun.h + src/openvpn/networking_sitnl.c + src/openvpn/networking_freebsd.c + src/openvpn/auth_token.c + src/openvpn/auth_token.h + src/openvpn/ssl_ncp.c + src/openvpn/ssl_ncp.h + src/openvpn/ssl_pkt.c + src/openvpn/ssl_pkt.h + src/openvpn/ssl_util.c + src/openvpn/ssl_util.h + src/openvpn/vlan.c + src/openvpn/vlan.h + src/openvpn/win32.c + src/openvpn/win32-util.c + src/openvpn/win32.h + src/openvpn/win32-util.h + src/openvpn/xkey_helper.c + src/openvpn/xkey_provider.c + ) + +add_executable(openvpn ${SOURCE_FILES}) + +add_library_deps(openvpn) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + target_link_libraries(openvpn PUBLIC -ldl) + + find_package(PkgConfig) + pkg_search_module(LIBNL REQUIRED libnl-genl-3.0) + + target_link_libraries(openvpn PUBLIC ${LIBNL_LIBRARIES}) + target_include_directories(openvpn PRIVATE ${LIBNL_INCLUDE_DIRS}) +endif () + + +if (MINGW) + target_link_options(openvpn PRIVATE -municode) +endif () + +if (NOT WIN32) + find_library(resolv resolv) + # some platform like BSDs already include resolver functionality in the libc and not have an extra resolv library + if (${resolv} OR APPLE) + target_link_libraries(openvpn PUBLIC -lresolv) + endif () +endif () + + +pkg_search_module(cmocka cmocka REQUIRED IMPORTED_TARGET) +enable_testing() + +SET(unit_tests "test_packet_id" "test_crypto" "test_ncp" "test_auth_token" "test_misc" "test_buffer" "test_provider" "test_pkt") + +# These tests work on only on Linux since they depend on special linker features +if (WIN32) + LIST(APPEND unit_tests "test_cryptoapi") +elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + LIST(APPEND unit_tests "test_networking" "test_tls_crypt" "test_argv") +endif () + + +FOREACH (test_name ${unit_tests}) + add_executable(${test_name} + tests/unit_tests/openvpn/${test_name}.c + tests/unit_tests/openvpn/mock_msg.c + src/openvpn/platform.c + src/openvpn/crypto_mbedtls.c + src/openvpn/crypto_openssl.c + src/openvpn/crypto.c + src/openvpn/otime.c + src/openvpn/packet_id.c + src/openvpn/base64.c + src/openvpn/win32-util.c + src/openvpn/mtu.c + src/openvpn/networking_sitnl.c + src/compat/compat-strsep.c + src/compat/compat-gettimeofday.c + src/openvpn/ssl_util.c + src/openvpn/reliable.c + src/openvpn/session_id.c + src/openvpn/mss.c + src/openvpn/xkey_provider.c + ) + + add_library_deps(${test_name}) + target_link_libraries(${test_name} PUBLIC PkgConfig::cmocka) + + target_include_directories(${test_name} PRIVATE src/openvpn) + + if (NOT ${test_name} STREQUAL "test_buffer") + target_sources(${test_name} PRIVATE + src/openvpn/buffer.c + ) + endif () + add_test(NAME ${test_name} COMMAND ${test_name}) +ENDFOREACH () + +target_sources(test_pkt PRIVATE + src/openvpn/argv.c + src/openvpn/env_set.c + src/openvpn/reliable.c + src/openvpn/run_command.c + src/openvpn/session_id.c + src/openvpn/ssl_pkt.c + src/openvpn/tls_crypt.c + ) + +if (TARGET test_cryptoapi) + target_sources(test_cryptoapi PRIVATE + src/openvpn/xkey_helper.c + src/openvpn/xkey_provider.c + ) +endif () + +target_sources(test_provider PRIVATE + src/openvpn/xkey_provider.c + src/openvpn/xkey_helper.c + ) + +target_sources(test_misc PRIVATE + src/openvpn/options_util.c + ) + +IF (TARGET test_tls_crypt) + target_sources(test_tls_crypt PRIVATE + src/openvpn/argv.c + src/openvpn/env_set.c + src/openvpn/run_command.c) +endif () + +if (TARGET test_argv) + target_sources(test_argv PRIVATE + src/openvpn/argv.c + src/openvpn/env_set.c + src/openvpn/run_command.c) +endif () + + +FOREACH (test_name "networking" "tls_crypt" "argv") + if (TARGET test_${test_name}) + target_link_options(test_${test_name} PRIVATE -Wl,--wrap=parse_line) + endif () +ENDFOREACH () + +if (TARGET test_tls_crypt) + target_link_options("test_tls_crypt" PRIVATE + -Wl,--wrap=buffer_read_from_file + -Wl,--wrap=buffer_write_file + -Wl,--wrap=rand_bytes) +ENDIF () \ No newline at end of file diff --git a/config.h.cmake.in b/config.h.cmake.in new file mode 100644 index 0000000..6185971 --- /dev/null +++ b/config.h.cmake.in @@ -0,0 +1,492 @@ + +/* Configuration settings */ +#define CONFIGURE_DEFINES "N/A" + +/* Enable async push */ +#cmakedefine ENABLE_ASYNC_PUSH + +/* Use mbed TLS library */ +#cmakedefine ENABLE_CRYPTO_MBEDTLS + +/* Use Openssl */ +#cmakedefine ENABLE_CRYPTO_OPENSSL + +/* Use wolfSSL crypto library */ +#cmakedefine ENABLE_CRYPTO_WOLFSSL + +/* Enable shared data channel offload */ +#cmakedefine ENABLE_DCO + +/* Enable debugging support (needed for verb>=4) */ +#define ENABLE_DEBUG 1 + +/* We have persist tun capability */ +#cmakedefine ENABLE_FEATURE_TUN_PERSIST + +/* Enable internal fragmentation support */ +#define ENABLE_FRAGMENT 1 + +/* Enable linux data channel offload */ +#cmakedefine ENABLE_LINUXDCO + +/* Enable LZ4 compression library */ +#cmakedefine ENABLE_LZ4 + +/* Enable LZO compression library */ +#cmakedefine ENABLE_LZO + +/* Enable management server capability */ +#define ENABLE_MANAGEMENT 1 + +/* Enable OFB and CFB cipher modes */ +#define ENABLE_OFB_CFB_MODE + +/* Enable PKCS11 */ +/* #undef ENABLE_PKCS11 */ + +/* Enable plug-in support */ +#define ENABLE_PLUGIN 1 + +/* Enable TCP Server port sharing */ +#cmakedefine ENABLE_PORT_SHARE + +/* SELinux support */ +#cmakedefine ENABLE_SELINUX + +/* enable sitnl support */ +#cmakedefine ENABLE_SITNL + +/* Enable systemd integration */ +/* #undef ENABLE_SYSTEMD */ + +/* Enable --x509-username-field feature */ +#cmakedefine ENABLE_X509ALTUSERNAME + +/* Compiler supports anonymous unions */ +#define HAVE_ANONYMOUS_UNION_SUPPORT + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ARPA_INET_H 1 + +/* Define to 1 if you have the `basename' function. */ +#cmakedefine HAVE_BASENAME + +/* Define to 1 if you have the `chdir' function. */ +#cmakedefine HAVE_CHDIR + +/* Define to 1 if you have the `chroot' function. */ +#cmakedefine HAVE_CHROOT + +/* Define to 1 if you have the `chsize' function. */ +#cmakedefine HAVE_CHSIZE + +/* struct cmsghdr needed for extended socket error support */ +#cmakedefine HAVE_CMSGHDR + +/* Define to 1 if you have the `daemon' function. */ +#cmakedefine HAVE_DAEMON + +/* Define to 1 if you have the declaration of `SO_MARK', and to 0 if you +don't. */ +#cmakedefine01 HAVE_DECL_SO_MARK + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DIRECT_H + +/* Define to 1 if you have the `dirname' function. */ +#cmakedefine HAVE_DIRNAME + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DMALLOC_H + +/* Define to 1 if you have the `dup' function. */ +#cmakedefine HAVE_DUP + +/* Define to 1 if you have the `dup2' function. */ +#cmakedefine HAVE_DUP2 + +/* Define to 1 if you have the `epoll_create' function. */ +#cmakedefine HAVE_EPOLL_CREATE + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERR_H + +/* Crypto library supports keying material exporter */ +#define HAVE_EXPORT_KEYING_MATERIAL 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H + +/* Define to 1 if you have the `fork' function. */ +#cmakedefine HAVE_FORK +#cmakedefine HAVE_EXECVE + +/* Define to 1 if you have the `ftruncate' function. */ +#cmakedefine HAVE_FTRUNCATE + +/* Define to 1 if you have the `getgrnam' function. */ +#cmakedefine HAVE_GETGRNAM + +/* Define to 1 if you have the `getpeereid' function. */ +#cmakedefine HAVE_GETPEEREID + +/* Define to 1 if you have the `getpwnam' function. */ +#cmakedefine HAVE_GETPWNAM + +/* Define to 1 if you have the `getrlimit' function. */ +#undef HAVE_GETRLIMIT + +/* Define to 1 if you have the `getsockname' function. */ +#cmakedefine HAVE_GETSOCKNAME + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GRP_H + +/* struct in_pktinfo needed for IP_PKTINFO support */ +#cmakedefine HAVE_IN_PKTINFO + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IO_H + +/* struct in_pktinfo.ipi_spec_dst needed for IP_PKTINFO support */ +#cmakedefine HAVE_IPI_SPEC_DST + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBGEN_H + +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_IF_TUN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_SOCKIOS_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_TYPES_H + +/* Define to 1 if you have the header file. */ +#define HAVE_LZO_CONF_H + +/* Define to 1 if you have the header file. */ +#define HAVE_LZO1X_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_LZOUTIL_H 1 + +/* Define to 1 if you have the `mlockall' function. */ +#cmakedefine HAVE_MLOCKALL + +/* struct msghdr needed for extended socket error support */ +#cmakedefine HAVE_MSGHDR + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETDB_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_SYSTM_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IP_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_TCP_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_IF_TUN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine01 HAVE_NET_IF_UTUN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NET_TUN_IF_TUN_H + +/* Define to 1 if you have the `nice' function. */ +#undef HAVE_NICE + +/* Define to 1 if you have the `openlog' function. */ +#undef HAVE_OPENLOG + +/* OpenSSL engine support available */ +#undef HAVE_OPENSSL_ENGINE + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_POLL_H + +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PWD_H + +/* Define to 1 if you have the `readv' function. */ +#undef HAVE_READV + +/* Define to 1 if you have the `recvmsg' function. */ +#cmakedefine HAVE_RECVMSG +#cmakedefine HAVE_SENDMSG + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_RESOLV_H + +/* sa_family_t, needed to hold AF_* info */ +#cmakedefine HAVE_SA_FAMILY_T + +/* Define to 1 if you have the `sd_booted' function. */ +#undef HAVE_SD_BOOTED + +/* Define to 1 if you have the `setgid' function. */ +#cmakedefine HAVE_SETGID + +/* Define to 1 if you have the `setgroups' function. */ +#undef HAVE_SETGROUPS + +/* Define to 1 if you have the `setsid' function. */ +#undef HAVE_SETSID + +/* Define to 1 if you have the `setsockopt' function. */ +#define HAVE_SETSOCKOPT 1 + +/* Define to 1 if you have the `setuid' function. */ +#cmakedefine HAVE_SETUID + +/* Define to 1 if you have the header file. */ +#undef HAVE_SIGNAL_H + +/* Define to 1 if you have the `socket' function. */ +#undef HAVE_SOCKET + +/* struct sock_extended_err needed for extended socket error support */ +#undef HAVE_SOCK_EXTENDED_ERR + +/* Define to 1 if you have the `stat' function. */ +#define HAVE_STAT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the `strsep' function. */ +#undef HAVE_STRSEP + +/* Define to 1 if you have the `syslog' function. */ +#undef HAVE_SYSLOG + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYSLOG_H + +/* Define to 1 if you have the `system' function. */ +#undef HAVE_SYSTEM + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYSTEMD_SD_DAEMON_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_FILE_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_INOTIFY_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_KERN_CONTROL_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKET_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SOCKIO_H + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UIO_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UN_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_WAIT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TAP_WINDOWS_H + +/* Define to 1 if you have the `time' function. */ +#define HAVE_TIME 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#undef HAVE_UAPI_H + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_VALGRIND_MEMCHECK_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_VERSIONHELPERS_H + +/* Define to 1 if you have the `vfork' function. */ +#undef HAVE_VFORK + +/* Define to 1 if you have the header file. */ +#undef HAVE_VFORK_H + +/* Define to 1 if you have the `vsnprintf' function. */ +#undef HAVE_VSNPRINTF + +/* we always assume a recent mbed TLS version */ +#define HAVE_CTR_DRBG_UPDATE_RET 1 + +/* Path to ifconfig tool */ +#define IFCONFIG_PATH "@IFCONFIG_PATH@" + +/* Path to iproute tool */ +#define IPROUTE_PATH "@IPROUTE_PATH@" + +/* Path to route tool */ +#define ROUTE_PATH "@ROUTE_PATH@" + +/* OpenVPN major version - integer */ +#undef OPENVPN_VERSION_MAJOR + +/* OpenVPN minor version - integer */ +#undef OPENVPN_VERSION_MINOR + +/* OpenVPN patch level - may be a string or integer */ +#define OPENVPN_VERSION_PATCH "@OPENVPN_VERSION_PATCH@" + +/* Name of package */ +#define PACKAGE "openvpn" + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "OpenVPN" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "OpenVPN @OPENVPN_VERSION_MAJOR@.@OPENVPN_VERSION_MINOR@@OPENVPN_VERSION_PATCH@" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "@OPENVPN_VERSION_MAJOR@.@OPENVPN_VERSION_MINOR@@OPENVPN_VERSION_PATCH@" + +/* OpenVPN major version - integer */ +#define OPENVPN_VERSION_MAJOR @OPENVPN_VERSION_MAJOR@ + +/* OpenVPN minor version - integer */ +#define OPENVPN_VERSION_MINOR @OPENVPN_VERSION_MINOR@ + +/* Path to systemd-ask-password tool */ +#undef SYSTEMD_ASK_PASSWORD_PATH + +/* systemd is newer than v216 */ +#define SYSTEMD_NEWER_THAN_216 + +/* The tap-windows id */ +#define TAP_WIN_COMPONENT_ID "tap0901" + +/* The tap-windows version number is required for OpenVPN */ +#define TAP_WIN_MIN_MAJOR 9 + +/* The tap-windows version number is required for OpenVPN */ +#define TAP_WIN_MIN_MINOR 9 + +/* Are we running on Mac OS X? */ +#cmakedefine TARGET_DARWIN + +/* Are we running on FreeBSD? */ +#cmakedefine TARGET_FREEBSD + +/* Are we running on Linux? */ +#cmakedefine TARGET_LINUX + +/* Are we running WIN32? */ +#cmakedefine TARGET_WIN32 + +#define TARGET_ALIAS "@CMAKE_SYSTEM_NAME@" + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + + +#if defined(_WIN32) +#include +typedef uint32_t in_addr_t; +typedef uint16_t in_port_t; + +#define SIGHUP 1 +#define SIGINT 2 +#define SIGUSR1 10 +#define SIGUSR2 12 +#define SIGTERM 15 +#endif + +#if defined(_MSC_VER) +#include +typedef SSIZE_T ssize_t; +#define strncasecmp strnicmp +#define strcasecmp _stricmp + + +#define S_IRUSR 0 +#define S_IWUSR 0 +#define R_OK 4 +#define W_OK 2 +#define X_OK 1 +#define F_OK 0 +#endif + diff --git a/src/openvpn/lzo.h b/src/openvpn/lzo.h index c572354..f05c002 100644 --- a/src/openvpn/lzo.h +++ b/src/openvpn/lzo.h @@ -37,7 +37,14 @@ * @addtogroup compression * @{ */ - +#if defined(HAVE_LZO_CONF_H) +/* The lzo.h magic gets confused and still wants + * to include lzo/lzoconf.h even if our include paths + * are setup to include the paths without lzo/ include lzoconf.h to + * avoid it being include by lzoutil.h */ +#include +#include +#endif #if defined(HAVE_LZO_LZOUTIL_H) #include #elif defined(HAVE_LZOUTIL_H)