From patchwork Wed Feb 15 16:26:54 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Lichtenheld X-Patchwork-Id: 3085 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp434610dyk; Wed, 15 Feb 2023 08:27:36 -0800 (PST) X-Google-Smtp-Source: AK7set9GLB75oxr0mWhWEEMcx4pLnupILRzLNhpmXQ4csPtOqEbmOUuYv2lyUyKOWt8MURQpvcdI X-Received: by 2002:a05:6a21:2c86:b0:bf:a57b:6a1b with SMTP id ua6-20020a056a212c8600b000bfa57b6a1bmr2065217pzb.12.1676478456162; Wed, 15 Feb 2023 08:27:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676478456; cv=none; d=google.com; s=arc-20160816; b=CCk4seVQSVOWZYpzF9OqgRJTwvhJMrWJdmm/g31U25cxm+usZ7CWbJIroG9dzRQ0x3 5u+EAnkBrd/Yw4kA2R19OLOTVBX53EV+5XApHrdNl1qeBi4p+yNURnHi6y4KysxoeAYZ JD/X+2nwb5uK/yG7811plixu7RBcikIgANXAbF3x45PSCHq8/xPJ62d3lOMVkCAzvYnf C0MHiNfHC64qcZ4kZuF6sHhH9AADuLhkuKuABNcKNSpOdPyA7vcIRp3aHWhc2/EnyZWF MIqw+VLF38xTzcvf7P9owzW4VjXP2Js2Mw6MenkujzvQYAy/fagFxgDYFvKcMEEsgQYV HK7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :dkim-signature:dkim-signature; bh=Pn7mnKwPTEORNnTcqpjy169MBiY8UwdeGgsft1Cj/2I=; b=HHDovlb/5Ule4QW4X727u4TN7Z1zRjfzJwzdsO/LK2yNf0cGPk5ca8oK3jHKrGXRsH GY4oEQ5inifrEoA/ydew14aZUlsz14WFINK1m7z3Qe791Ef05X/6QOJgtprcx86zRFZ6 o46EGbYRd9KLh1ER13SO3ukRO/jNY/dwy9FzVyJV5+C4C6t/dCfdAUdbyjpHlgCVn2NK N2K/5Zn7tExbdDu8lIHwvUctuEaFTxKBv0e14IMLhSTAOSGLLvzm7yKMrbP9wF2uN7zD YgmamgFyvm1+bL86V4PGqxNJQF7vzmxCphViFNGaQNI3oXBroXR7Jwp+VxAcq2/NYHNP KYlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=ATMMsG0Z; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=grAn3CGB; 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 Received: from lists.sourceforge.net (lists.sourceforge.net. [216.105.38.7]) by mx.google.com with ESMTPS id e123-20020a636981000000b0049b37046fbcsi11978604pgc.391.2023.02.15.08.27.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Feb 2023 08:27:36 -0800 (PST) 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=ATMMsG0Z; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=grAn3CGB; 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 Received: from [127.0.0.1] (helo=sfs-ml-2.v29.lw.sourceforge.com) by sfs-ml-2.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1pSKcg-0001qx-CW; Wed, 15 Feb 2023 16:27:09 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-2.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1pSKce-0001qp-03 for openvpn-devel@lists.sourceforge.net; Wed, 15 Feb 2023 16:27:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Transfer-Encoding:MIME-Version:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=Vih0PRq0MoJSwfQH9o76XEqAKloK+0lSJmLUDHecrGw=; b=ATMMsG0ZekKOzLudXmIT/rghAw HJQ4wql6kTWgZiFMwFjD+UfO6EZo6mf+lYogkyNmJF4LSoUC+VpirV6MGI+tfBb6PF3oZQr+MxMkY jM8hslipQSKricjwGwqtLA/udbysYoyV1s7glr6MsNqOHfnace3QnIKvts3l55uYcvMI=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-Id: Date:Subject:To:From:Sender:Reply-To:Cc:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=Vih0PRq0MoJSwfQH9o76XEqAKloK+0lSJmLUDHecrGw=; b=grAn3CGB/LgyYLHPfZFO7Qfad2 koXLTWn8gCUFSaRovhzTvmj2Hg+h4WMazCKY/O3288ZvjoURy94YBPhlOATIq4lUzbF7JkHFiWc8Z pNYV8ifbKADJp5/ODc3WdmNSzZ8C9I+MvBf3wEAWdksQPvILmVWH6Jf0Mu4gJRv8l2Gw=; Received: from mout-p-101.mailbox.org ([80.241.56.151]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1pSKcZ-005NkY-S9 for openvpn-devel@lists.sourceforge.net; Wed, 15 Feb 2023 16:27:07 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [10.196.197.2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-101.mailbox.org (Postfix) with ESMTPS id 4PH3PW3NZHz9sWT for ; Wed, 15 Feb 2023 17:26:55 +0100 (CET) From: Frank Lichtenheld To: openvpn-devel@lists.sourceforge.net Date: Wed, 15 Feb 2023 17:26:54 +0100 Message-Id: <20230215162654.52137-1-frank@lichtenheld.com> In-Reply-To: <20230215150455.45052-1-frank@lichtenheld.com> References: <20230215150455.45052-1-frank@lichtenheld.com> MIME-Version: 1.0 X-Spam-Score: -0.7 (/) 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: Automatically disabled when - iproute2 is enabled (Don't want to force people specifying --disable-dco explicitely) - libnv is missing on FreeBSD (FreeBSD version too old anyway) Will still error out if libnl-genl is missing on Linux to make people aware of new dependency. Content analysis details: (-0.7 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [80.241.56.151 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-Headers-End: 1pSKcZ-005NkY-S9 Subject: [Openvpn-devel] [PATCH v5] configure: enable DCO by default on FreeBSD/Linux 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: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox X-GMAIL-THRID: =?utf-8?q?1756829740649023698?= X-GMAIL-MSGID: =?utf-8?q?1757915073514572939?= Automatically disabled when - iproute2 is enabled (Don't want to force people specifying --disable-dco explicitely) - libnv is missing on FreeBSD (FreeBSD version too old anyway) Will still error out if libnl-genl is missing on Linux to make people aware of new dependency. v2: error out when libnl-genl is missing as discussed with ordex on IRC. v3: - improvements to the messages, suggested by Selva - further improvements to the default specification, trying to make it clear - if enabling iproute2, do not test for libnl-genl v4: add updates for GHA v5: - v4 was missing the changes of v3. v5 combines the changes from v3 and v4 - fix build failure GHA/ubuntu1804/mbedtls - fix build failure GHA/ubuntu2204/libressl Signed-off-by: Frank Lichtenheld --- .github/workflows/build.yaml | 22 +++++----- configure.ac | 82 +++++++++++++++++++++++++++--------- 2 files changed, 74 insertions(+), 30 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 699964fd..162dd8ce 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -265,20 +265,27 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-18.04, ubuntu-20.04, ubuntu-22.04] + os: [ubuntu-20.04, ubuntu-22.04] sslpkg: [libmbedtls-dev] ssllib: [mbedtls] libname: [mbed TLS] include: + - os: ubuntu-18.04 + sslpkg: "libmbedtls-dev" + ssllib: mbedtls + libname: mbed TLS + extraconf: "--disable-dco" - os: ubuntu-18.04 sslpkg: "libssl1.0-dev" ssllib: openssl libname: OpenSSL 1.0.2 + extraconf: "--disable-dco" - os: ubuntu-18.04 sslpkg: "libssl-dev" libname: OpenSSL 1.1.1 ssllib: openssl + extraconf: "--disable-dco" - os: ubuntu-20.04 sslpkg: "libssl-dev" libname: OpenSSL 1.1.1 @@ -312,22 +319,15 @@ jobs: libname: OpenSSL 1.1.1 ssllib: openssl extraconf: "--disable-lzo --disable-lz4" - - os: ubuntu-20.04 - sslpkg: "libssl-dev" - libname: OpenSSL 1.1.1 - ssllib: openssl - extraconf: "--enable-dco" - nlpkg: "libnl-genl-3-dev" name: "gcc - ${{matrix.os}} - ${{matrix.libname}} ${{matrix.extraconf}}" env: SSLPKG: "${{matrix.sslpkg}}" - NLPKG: "${{matrix.nlpkg}}" runs-on: ${{matrix.os}} steps: - name: Install dependencies - run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev linux-libc-dev man2html libcmocka-dev python3-docutils libtool automake autoconf ${SSLPKG} ${NLPKG} + run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev libnl-genl-3-dev linux-libc-dev man2html libcmocka-dev python3-docutils libtool automake autoconf ${SSLPKG} - name: Checkout OpenVPN uses: actions/checkout@v3 - name: autoconf @@ -354,7 +354,7 @@ jobs: runs-on: ${{matrix.os}} steps: - name: Install dependencies - run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf libmbedtls-dev + run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev libcap-ng-dev libnl-genl-3-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf libmbedtls-dev - name: Checkout OpenVPN uses: actions/checkout@v3 - name: autoconf @@ -514,7 +514,7 @@ jobs: steps: - name: Install dependencies - run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf pkg-config libcap-ng-dev + run: sudo apt update && sudo apt install -y liblzo2-dev libpam0g-dev liblz4-dev linux-libc-dev man2html clang libcmocka-dev python3-docutils libtool automake autoconf pkg-config libcap-ng-dev libnl-genl-3-dev - name: "libressl: checkout" uses: actions/checkout@v3 with: diff --git a/configure.ac b/configure.ac index 66ba6f38..c44d3856 100644 --- a/configure.ac +++ b/configure.ac @@ -157,14 +157,27 @@ AC_ARG_ENABLE( AC_ARG_ENABLE( [dco], - [AS_HELP_STRING([--enable-dco], [enable data channel offload support using the ovpn-dco kernel module (always enabled on Windows) @<:@default=no@:>@])], + [AS_HELP_STRING([--disable-dco], [disable data channel offload support using the ovpn-dco kernel module @<:@default=yes@:>@ on Linux/FreeBSD, can't disable on Windows])], , - [enable_dco="no"] + [ + case "$host" in + *-*-linux*) + enable_dco="auto" + ;; + *-*-freebsd*) + enable_dco="auto" + ;; + *) + # note that this does not disable it for Windows + enable_dco="no" + ;; + esac + ] ) AC_ARG_ENABLE( [iproute2], - [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 @<:@default=no@:>@])], + [AS_HELP_STRING([--enable-iproute2], [enable support for iproute2 (disables DCO) @<:@default=no@:>@])], , [enable_iproute2="no"] ) @@ -549,7 +562,7 @@ AC_CHECK_DECLS( , [[${SOCKET_INCLUDES}]] ) -AC_CHECKING([anonymous union support]) +AC_MSG_CHECKING([anonymous union support]) AC_COMPILE_IFELSE( [AC_LANG_PROGRAM( [[ @@ -784,28 +797,59 @@ PKG_CHECK_MODULES( ) -if test "$enable_dco" = "yes"; then -dnl -dnl Include generic netlink library used to talk to ovpn-dco -dnl +if test "$enable_dco" != "no"; then + enable_dco_arg="$enable_dco" + if test "${enable_iproute2}" = "yes"; then + AC_MSG_WARN([DCO cannot be enabled when using iproute2]) + enable_dco="no" + fi case "$host" in *-*-linux*) - PKG_CHECK_MODULES([LIBNL_GENL], + if test "$enable_dco" = "no"; then + if test "$enable_dco_arg" = "auto"; then + AC_MSG_WARN([DCO support disabled]) + else + AC_MSG_ERROR([DCO support can't be enabled]) + fi + else + dnl + dnl Include generic netlink library used to talk to ovpn-dco + dnl + PKG_CHECK_MODULES([LIBNL_GENL], [libnl-genl-3.0 >= 3.4.0], [have_libnl="yes"], - [AC_MSG_ERROR([libnl-genl-3.0 package not found or too old. Is the development package and pkg-config installed? Must be version 3.4.0 or newer])] - ) - - CFLAGS="${CFLAGS} ${LIBNL_GENL_CFLAGS}" - LIBS="${LIBS} ${LIBNL_GENL_LIBS}" + [ + AC_MSG_ERROR([libnl-genl-3.0 package not found or too old. Is the development package and pkg-config installed? Must be version 3.4.0 or newer for DCO]) + ] + ) + CFLAGS="${CFLAGS} ${LIBNL_GENL_CFLAGS}" + LIBS="${LIBS} ${LIBNL_GENL_LIBS}" - AC_DEFINE(ENABLE_DCO, 1, [Enable shared data channel offload]) - AC_MSG_NOTICE([Enabled ovpn-dco support for Linux]) + AC_DEFINE(ENABLE_DCO, 1, [Enable shared data channel offload]) + AC_MSG_NOTICE([Enabled ovpn-dco support for Linux]) + fi ;; *-*-freebsd*) - LIBS="${LIBS} -lnv" - AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD]) - AC_MSG_NOTICE([Enabled ovpn-dco support for FreeBSD]) + AC_CHECK_LIB( + [nv], + [nvlist_create], + [ + LIBS="${LIBS} -lnv" + AC_DEFINE(ENABLE_DCO, 1, [Enable data channel offload for FreeBSD]) + AC_MSG_NOTICE([Enabled ovpn-dco support for FreeBSD]) + ], + [ + enable_dco="no" + AC_MSG_WARN([Name/Value pair library not found.]) + ] + ) + if test "$enable_dco" = "no"; then + if test "$enable_dco_arg" = "auto"; then + AC_MSG_WARN([DCO support disabled]) + else + AC_MSG_ERROR([DCO support can't be enabled]) + fi + fi ;; *-mingw*) AC_MSG_NOTICE([NOTE: --enable-dco ignored on Windows because it's always enabled])