From patchwork Thu Jun 23 22:37:56 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 2545 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend41.mail.ord1d.rsapps.net with LMTP id SNxCNMF/tWJ8XgAAqwncew (envelope-from ) for ; Fri, 24 Jun 2022 05:11:29 -0400 Received: from proxy18.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id 4GQ2NMF/tWIoWAAAalYnBA (envelope-from ) for ; Fri, 24 Jun 2022 05:11:29 -0400 Received: from smtp38.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy18.mail.ord1d.rsapps.net with LMTPS id qNzsM8F/tWJHMQAATCaURg (envelope-from ) for ; Fri, 24 Jun 2022 05:11:29 -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: smtp38.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: a1e107f0-f39d-11ec-abdf-525400f6a58b-1-1 Received: from [216.105.38.7] ([216.105.38.7:54124] helo=lists.sourceforge.net) by smtp38.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id CA/1A-06104-1CF75B26; Fri, 24 Jun 2022 05:11:29 -0400 Received: from [127.0.0.1] (helo=sfs-ml-1.v29.lw.sourceforge.com) by sfs-ml-1.v29.lw.sourceforge.com with esmtp (Exim 4.94.2) (envelope-from ) id 1o4fKn-0002ep-Sa; Fri, 24 Jun 2022 09:10:37 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1o4fKn-0002eh-Cp for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 09:10:37 +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=5P1nKPwZtq+Xr+wVY+xKJ2Hxynco2PVUr5bsWCSXUyw=; b=c9K2pzXZb+7FtuPvu+tXi1+zQ5 Mo2vGC1e2myEpZ4zeAM47SWyU5Z5XIivSwwghHyGvxPAUIuzuu6KqsFEsd7+4+sIdZ6RcreoNMt05 fs+hBCF4SgpRrFUzg5CLYj0NiWCUbzi9yLjsCH58jdrlCGnjA2G1thM3EoKUw6QZUZ6I=; 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=5P1nKPwZtq+Xr+wVY+xKJ2Hxynco2PVUr5bsWCSXUyw=; b=ZvwN5PezhchoKRQ455Ukze9wie AlFKJUtx5oLdkpJEhbl5yppPc/t1u9YH6T1CjsUQiZKeOQs1s+uGB18PIc2VA1TCf+4QOvGOG5pj2 6nUlmZ5m0MI8Gns6Q85y4Kq2unG/4UCvRKmq6uMuzTW3dKnroKf885MumQy+GCpql5eE=; Received: from s2.neomailbox.net ([5.148.176.60]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1o4fKm-00063V-HM for openvpn-devel@lists.sourceforge.net; Fri, 24 Jun 2022 09:10:37 +0000 From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Fri, 24 Jun 2022 10:37:56 +0200 Message-Id: <20220624083809.23487-13-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-1.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: A server may push options that are not compatible with DCO. In this case we should log a message and bail out. Signed-off-by: Antonio Quartulli --- src/openvpn/init.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) 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 X-Headers-End: 1o4fKm-00063V-HM Subject: [Openvpn-devel] [PATCH 12/25] dco: check that pulled options are compatible 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: Antonio Quartulli Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox A server may push options that are not compatible with DCO. In this case we should log a message and bail out. Signed-off-by: Antonio Quartulli Acked-By: Arne Schwabe --- src/openvpn/init.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/openvpn/init.c b/src/openvpn/init.c index b0a4b252..091cbd24 100644 --- a/src/openvpn/init.c +++ b/src/openvpn/init.c @@ -2219,6 +2219,19 @@ do_deferred_p2p_ncp(struct context *c) return true; } + +static bool +check_dco_pull_options(struct options *o) +{ + if (!o->use_peer_id) + { + msg(D_TLS_ERRORS, "OPTIONS IMPORT: Server did not request DATA_V2 packet " + "format required for data channel offload"); + return false; + } + return true; +} + /* * Handle non-tun-related pulled options. */ @@ -2341,6 +2354,16 @@ finish_options(struct context *c) return false; } + /* Check if the pushed options are compatible with DCO if we have + * DCO enabled */ + if (dco_enabled(&c->options) && !check_dco_pull_options(&c->options)) + { + msg(D_TLS_ERRORS, "OPTIONS ERROR: pushed options are incompatible with " + "data channel offload. Use --disable-dco to connect" + "to this server"); + return false; + } + return true; }