From patchwork Thu Jun 23 22:38:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2535 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.30.191.6]) by backend41.mail.ord1d.rsapps.net with LMTP id GFlMEPJ+tWKrXQAAqwncew (envelope-from ) for ; Fri, 24 Jun 2022 05:08:02 -0400 Received: from proxy12.mail.ord1d.rsapps.net ([172.30.191.6]) by director10.mail.ord1d.rsapps.net with LMTP id iKVYEPJ+tWIAfAAApN4f7A (envelope-from ) for ; Fri, 24 Jun 2022 05:08:02 -0400 Received: from smtp7.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy12.mail.ord1d.rsapps.net with LMTPS id eLPnD/J+tWLeOwAA7PHxkg (envelope-from ) for ; Fri, 24 Jun 2022 05:08:02 -0400 X-Spam-Threshold: 95 X-Spam-Score: 0 X-Spam-Flag: NO X-Virus-Scanned: OK X-Orig-To: openvpnslackdevel@openvpn.net X-Originating-Ip: [216.105.38.7] Authentication-Results: smtp7.gate.ord1d.rsapps.net; iprev=pass policy.iprev="216.105.38.7"; spf=pass smtp.mailfrom="openvpn-devel-bounces@lists.sourceforge.net" smtp.helo="lists.sourceforge.net"; dkim=fail (signature verification failed) header.d=sourceforge.net; dkim=fail (signature verification failed) header.d=sf.net; dmarc=none (p=nil; dis=none) header.from=unstable.cc X-Suspicious-Flag: YES X-Classification-ID: 25d56b42-f39d-11ec-8707-525400d0c497-1-1 Received: from [216.105.38.7] ([216.105.38.7:35052] helo=lists.sourceforge.net) by smtp7.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id F1/9D-02674-1FE75B26; Fri, 24 Jun 2022 05:08:01 -0400 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.94.2) (envelope-from ) id 1o4fHQ-00025N-Ou; Fri, 24 Jun 2022 09:07: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.94.2) (envelope-from ) id 1o4fHP-000257-UP for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 09:07:08 +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:Cc:To:From:Sender:Reply-To: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=GolyblZNaLLtxIudbyFrn0Hu5rVyNiuzi0TUpbJWfE8=; b=BnpcGY2Vkj5wfmxle+OZWqpioe tnf3Lz07fFHjEC/16kE4mBTQe1wwr26m2D03QUBj6d/Rppk2SndA0T76bBkicxjmTXXzvtRjU1cW7 1rTvYpz7/CBhTJjs9eBfPgMQrOt42rmL1VZuKieMjzBg9jGBwHj+77C6dd/RzsNDCRwI=; 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:Cc:To:From:Sender:Reply-To: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=GolyblZNaLLtxIudbyFrn0Hu5rVyNiuzi0TUpbJWfE8=; b=TPFO5U4Z0D0y7howpdI5Qae68F oT5W7wGXDNWTAThzoX+KxzevtBTt8kiBob/nnCqpPR2HELUe6gj4Uer3bBGrjo947jLYNu/c/f7YJ 85+tArmhSSgPNUiz4haizgif6arxD7dJ5fSoiiIMzBADdk5EWcCZ9MjPA/C0c22az1qU=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1o4fHP-00C3wM-UR for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 09:07:08 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 24 Jun 2022 10:38:04 +0200 Message-Id: <20220624083809.23487-21-a@unstable.cc> In-Reply-To: <20220624083809.23487-1-a@unstable.cc> References: <20220624083809.23487-1-a@unstable.cc> MIME-Version: 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: Some platforms may have different constraints in terms of incompatible opions, therefore we add a function that explicitly checks those. Also, add generic option check for when ovpn-dco-win is in use. Content analysis details: (-0.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 SPF_PASS SPF: sender matches SPF record -0.0 T_SCC_BODY_TEXT_LINE No description available. X-Headers-End: 1o4fHP-00C3wM-UR Subject: [Openvpn-devel] [PATCH 20/25] dco-win: add platform dependant check on incompatible options 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: , Cc: Lev Stipakov , Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox Some platforms may have different constraints in terms of incompatible opions, therefore we add a function that explicitly checks those. Also, add generic option check for when ovpn-dco-win is in use. Signed-off-by: Antonio Quartulli Signed-off-by: Lev Stipakov Acked-by: Heiko Hund --- src/openvpn/dco.c | 25 +++++++++++++++++++++++++ src/openvpn/options.c | 5 +++++ 2 files changed, 30 insertions(+) diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 1612a64e..448f29b5 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -190,6 +190,26 @@ dco_update_keys(dco_context_t *dco, struct tls_multi *multi) } } +static bool +dco_check_option_conflict_platform(int msglevel, const struct options *o) +{ +#if defined(_WIN32) + if (o->mode == MODE_SERVER) + { + msg(msglevel, "Only client and p2p data channel offload is supported " + "with ovpn-dco-win."); + return false; + } + + if (o->persist_tun) + { + msg(msglevel, "--persist-tun is not supported with ovpn-dco-win."); + return false; + } +#endif + return true; +} + static bool dco_check_option_conflict_ce(const struct connection_entry *ce, int msglevel) { @@ -228,6 +248,11 @@ dco_check_option_conflict(int msglevel, const struct options *o) return false; } + if (!dco_check_option_conflict_platform(msglevel, o)) + { + return false; + } + if (dev_type_enum(o->dev, o->dev_type) != DEV_TYPE_TUN) { msg(msglevel, "Note: dev-type not tun, disabling data channel offload."); diff --git a/src/openvpn/options.c b/src/openvpn/options.c index 7b450296..d9da8b8b 100644 --- a/src/openvpn/options.c +++ b/src/openvpn/options.c @@ -2376,6 +2376,11 @@ options_postprocess_verify_ce(const struct options *options, { msg(M_USAGE, "--windows-driver wintun requires --dev tun"); } + + if (options->windows_driver == WINDOWS_DRIVER_WINDCO) + { + dco_check_option_conflict(M_USAGE, options); + } #endif /* ifdef _WIN32 */ /*