From patchwork Tue Aug 15 23:15:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Quartulli X-Patchwork-Id: 3325 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c39e:b0:d7:3b0f:3938 with SMTP id fx30csp871481dyb; Tue, 15 Aug 2023 16:16:44 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGFxV9RI217k758IdgoyAXyhUQiHyp6L+9oi+fTnA3jxLfgROol99rwsHNq2ST1XsGJgZf7 X-Received: by 2002:a17:902:7fce:b0:1bd:d14a:7e14 with SMTP id t14-20020a1709027fce00b001bdd14a7e14mr297098plb.65.1692141404638; Tue, 15 Aug 2023 16:16:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692141404; cv=none; d=google.com; s=arc-20160816; b=Nhriis+28BmmgEMqMcYoovuMbBq68xJzLtu72cUjOKA8mvmUbKv/qRF1cA4yQGuq4a r17WF2kNJsbS9UoHAe1AAab/PtoXe1p2RRLW9SDJD1RP+/7NVJLUj4flerbYJzRwK4Ms i+K95IqF7zLBiFm4AFXfv7kZj1c65Hl6auAeRGOYDkXE6TbXQzm95BTqJ6gmG2I01RLX MeLiC0qOIfknvN8GcOlyHyHkHq9i0nQsmTkG0wHuxH8jQiUxXbwWsNBuJwl0ofFMyb6N t1oqueQuFB4ozAo4dxsSAE5XTWXf7jdf90TwwuEPdu307g6EC/Gey7cy5J2E/06EAwr0 r+Xw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:content-transfer-encoding:cc:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:message-id:date:to:from:dkim-signature:dkim-signature :dkim-signature; bh=tDhOuhQ5pvYKftPcwXUNslMQBfUjYAULO/xph5eBra0=; fh=ipSnmaUiFvVyOkWo2rhyu3BPqh+TT4EMVKraJV42Zuk=; b=Du4Zly8ZcgjrqV0Hmu+5Ni5BjRpLLmMEen+0LpoUhyhR1Wzxft3FAiIARXrIjr2PJG 4KBXmbylTejT7GZlYY+Qgc6YbjwHet8gPFPMy2St33vlbrrUR0w7WMWW3smPia8sz67r YE9NPwEsi/LYval3JuWMWXHHSqs1R9iA2CGs4T0tAtnAiHHFA08cskfpARshHIN+ywQZ 34mVbKH8dEGeE3URf3kFlRwiwKteSmx7Ae4vnoIX/btTEFZNN7IneKkfbGjxAOcOIio6 wCzpppXoKQZoDxYjw+X+ImwfRavv1vP1ggtIq7iN9M+EonWCPkTBZG5+/PRVzHxO60Ik YOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=JbJrzwri; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=h+zELTjM; dkim=fail header.i=@unstable.cc header.s=20220809-q8oc header.b=N1pAn0ur; 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 y13-20020a17090322cd00b001bdff09dcccsi1396157plg.139.2023.08.15.16.16.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 15 Aug 2023 16:16:44 -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=JbJrzwri; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=h+zELTjM; dkim=fail header.i=@unstable.cc header.s=20220809-q8oc header.b=N1pAn0ur; 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 1qW3Gr-0004Gl-4t; Tue, 15 Aug 2023 23:16:16 +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 1qW3Gq-0004Gc-0C for openvpn-devel@lists.sourceforge.net; Tue, 15 Aug 2023 23:16:14 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qdJoZ6m+0gEvNqqNL8LzLtl4UdBiF4Z9SXMrji9PRlw=; b=JbJrzwriQTte/MvS8dvv7vBqnx EzaD5ouUWttYlJsk46A5ElH5dEsEhi/auKG67UsrGyL+pnKxFAMNfOHseGwwGnnvudbV4olCFToG7 gCpEhUVgsNAlY+6Z9gKG6gIikqbrYxSMIYVmEh9oms7dFWV5YU8D56tsB6496dncYja8=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=qdJoZ6m+0gEvNqqNL8LzLtl4UdBiF4Z9SXMrji9PRlw=; b=h +zELTjMC9qUbbTmE1In8hsJSsSl0BUiB6zQ104fsOHCmrCOoMNEMP+8lujeQph5vcqr4IPpQ3gTvU jt/5BDxgD52kvS/Uy0a4hLeJ84M8rgzCMacZxvvNOEkhUpVZ3RQxoIrCswYF2ArRzO+yO5shCObGD PpAaRzwujRTfAngo=; Received: from wilbur.contactoffice.com ([212.3.242.68]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1qW3Gh-0006MM-Rv for openvpn-devel@lists.sourceforge.net; Tue, 15 Aug 2023 23:16:14 +0000 Received: from smtpauth1.co-bxl (smtpauth1.co-bxl [10.2.0.15]) by wilbur.contactoffice.com (Postfix) with ESMTP id F1EEC278; Wed, 16 Aug 2023 01:15:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1692141359; s=20220809-q8oc; d=unstable.cc; i=a@unstable.cc; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Transfer-Encoding; l=1171; bh=qdJoZ6m+0gEvNqqNL8LzLtl4UdBiF4Z9SXMrji9PRlw=; b=N1pAn0urspoQ1wJf7BZhRb8FWgfkZRj3KwyaABhDKwXX/EZs3QF7eRY7MguxTUIb DDlZY+YLbZ4E70tOuis0T/hN8DPIIMj+pf97CvqVQCHpi/15sfqzjBi5PQYG0tLmvzA s5quNU4iSzm7Vsg/Y7G08ttHJO3iof8LO/+T4B4BTxBcMB5arDNKDfXVngXxrBTa4N1 J2Xp620SSpBI0wKsalLVNtB9rUlYMRjsDy14BaSghE9KohvodnixnoJteYsLP1Tu0vF GMWDHMT/F2tvQyIKg9D5A4ZbyGD1+FRtGKPliqNFcxf3DrT5I++UzmnTxXyWZAd6CHw 94MJhrt22g== Received: by smtp.mailfence.com with ESMTPSA ; Wed, 16 Aug 2023 01:15:55 +0200 (CEST) From: Antonio Quartulli To: openvpn-devel@lists.sourceforge.net Date: Wed, 16 Aug 2023 01:15:55 +0200 Message-ID: <20230815231555.6465-1-a@unstable.cc> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Spam-Flag: NO X-Spam-Status: No, hits=-1.0 required=4.7 symbols=ALL_TRUSTED device=10.2.0.21 X-ContactOffice-Account: com:375058688 X-Spam-Score: -0.9 (/) 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: Although it's a combination of options that is not really useful, when specifying --multihome along with --proto tcp and DCO is enabled, OpenVPN will crash while attempting to access c2.link_socket_ac [...] Content analysis details: (-0.9 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [212.3.242.68 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-Headers-End: 1qW3Gh-0006MM-Rv Subject: [Openvpn-devel] [PATCH] dco: fix crash when --multihome is used with --proto tcp 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 X-GMAIL-THRID: =?utf-8?q?1774338865175472291?= X-GMAIL-MSGID: =?utf-8?q?1774338865175472291?= Although it's a combination of options that is not really useful, when specifying --multihome along with --proto tcp and DCO is enabled, OpenVPN will crash while attempting to access c2.link_socket_actual (NULL for the TCP case) in order to retrieve the local address (in function dco_multi_get_localaddr()) Prevent crash by running this code only if proto is UDP. The same check is already performed in socket.c/h for the non-DCO case. Fixes: https://github.com/OpenVPN/openvpn/issues/390 Change-Id: I61adc26ce2ff737e020c3d980902a46758cb23e5 Signed-off-by: Antonio Quartulli Acked-by: Gert Doering --- src/openvpn/dco.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/dco.c b/src/openvpn/dco.c index 7c7eaac4..cd3e0ad3 100644 --- a/src/openvpn/dco.c +++ b/src/openvpn/dco.c @@ -509,7 +509,7 @@ dco_multi_get_localaddr(struct multi_context *m, struct multi_instance *mi, #if ENABLE_IP_PKTINFO struct context *c = &mi->context; - if (!(c->options.sockflags & SF_USE_IP_PKTINFO)) + if (!proto_is_udp(c->c2.link_socket->info.proto) || !(c->options.sockflags & SF_USE_IP_PKTINFO)) { return false; }