From patchwork Sat Dec 24 19:42:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 2936 Return-Path: Delivered-To: patchwork@openvpn.net Received: by 2002:a05:7300:c95:b0:82:e4b3:40a0 with SMTP id p21csp1133664dyk; Sat, 24 Dec 2022 11:43:29 -0800 (PST) X-Google-Smtp-Source: AMrXdXsbecBiQ+bJfFqJi6uhkoFmg8HfYQJXKC3xS1D2bJ5Fl370oYn+HKzdrd1iqsnttwk5pxUf X-Received: by 2002:a17:902:fe0c:b0:192:5c3e:8939 with SMTP id g12-20020a170902fe0c00b001925c3e8939mr8154070plj.0.1671911008944; Sat, 24 Dec 2022 11:43:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671911008; cv=none; d=google.com; s=arc-20160816; b=jtSTQPv2ZiYk7NySxdG5PusFoNtf18oT5MwzpDgpf78hr6nIwljdr4b9mB+LbyXGZO NgEsexkzaI9i3CH/F3lSiIJnl3a3eof/TuqFw9SwsTQNtzY8dzwD23tBaRn4Bq7yKCwK HffQB4AAx5n1pgpc4ZmrTJ2qK5H4dqywScIoPE8Gi+EqSv6SDsPnzv8NX4FMPNex+UuT XbPBqt/K0MdgqCvLfZhiiqiOYP+66St6jLRfXJKfeeU5468A4IIaEsflxEcCWgfQ4XlT MAk5zAvzKaNoJYrzn348gOZoBCMfXL/7D98srWKS1Ifgx9l9ijojtffDQzBW79IHGMB2 181A== 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=hj4fkBlJhOlb8hWYmOke4IP4kyJ/zatla7bb9tnAExg=; b=KxU5zYy2K1OB/qKRnNUj9CG/c3j3qNS/BMHd68llf+IE6oIO4srpE/cgt4cYd8V7PY S/1beD38wc1RXoZQNXRp3py+K+2wL/lKFlz0AiC8dypbjBsBiY2TmV+oAkmWmtXx9hkf ubY6hASx1rGD/P7YQShf+N9Ou/t37FfT+7Zjs8IkEe4/0A8ESaPnfhIOLdiUVoFlwuwC K0Dis4lVQ2s3Ig5HloHU0pz9wxm+NoII0YiOD68rm/ZYEOul1YucfWCE7JzyOBrlcTGs kVdh2Nu9uF+xnx2JEfxMWAUutEGP9HvZ/B+gyYv/RLNT+8u+JAOqup2WjwuoBeHtyaM4 yWSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@sourceforge.net header.s=x header.b=WA0hGERD; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Ll7RmxdY; 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 o13-20020a170902d4cd00b0017a50d7258dsi7664732plg.97.2022.12.24.11.43.28 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 24 Dec 2022 11:43:28 -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=WA0hGERD; dkim=neutral (body hash did not verify) header.i=@sf.net header.s=x header.b=Ll7RmxdY; 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-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.95) (envelope-from ) id 1p9AQI-0003Y3-LR; Sat, 24 Dec 2022 19:43:10 +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 1p9AQC-0003Xf-3M for openvpn-devel@lists.sourceforge.net; Sat, 24 Dec 2022 19:43:04 +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=0p4WAjcI0uUvjtR/qsaNaQBcs6/6u+w8TWKOYJDu3Xg=; b=WA0hGERDzu8toHwtvTTkvh9R/u NJf90GNDM1LvtXz+2opdp2Fg3up2MKMXrjDgBMYSkJtFeWo+lpip7r3+KGzd/ANqjZRni2OOFdnXB 5LFrZnp02uyOPZbTZ4nBySikObsK7RjardyvM+t03l/2fk87l/m3TGVtwqBYq9ilr11k=; 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=0p4WAjcI0uUvjtR/qsaNaQBcs6/6u+w8TWKOYJDu3Xg=; b=Ll7RmxdYF+2SVml9evLTJ05rNi 7rr+rYk1KQoGPfp3BMTlCb8XpWXT+gdlpXyHb9sjmU0DfaNKWpcfh1fUOEQ3Qo3YsPgcnxwtQvKxM hQPm8MPzHsL/aaV+BzhC8XNuMVwn0CEpGyJNaRri5yzt9d6JkErKXGDrKf3fH4iRb1ME=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1p9AQA-0000xf-Lr for openvpn-devel@lists.sourceforge.net; Sat, 24 Dec 2022 19:43:04 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.95 (FreeBSD)) (envelope-from ) id 1p9AQ1-000H1h-Oh for openvpn-devel@lists.sourceforge.net; Sat, 24 Dec 2022 20:42:53 +0100 Received: (nullmailer pid 3202296 invoked by uid 10006); Sat, 24 Dec 2022 19:42:53 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Sat, 24 Dec 2022 20:42:51 +0100 Message-Id: <20221224194253.3202231-8-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221224194253.3202231-1-arne@rfc2549.org> References: <20221224194253.3202231-1-arne@rfc2549.org> MIME-Version: 1.0 X-Spam-Score: 0.3 (/) 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: Instead of getting the server in a very weird state, we bail out here. This is only a bandaid solution but better than the alternatives. Signed-off-by: Arne Schwabe --- src/openvpn/mtcp.c | 2 +- src/openvpn/multi.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.2 HEADER_FROM_DIFFERENT_DOMAINS From and EnvelopeFrom 2nd level mail domains are different 0.0 SPF_NONE SPF: sender does not publish an SPF Record X-Headers-End: 1p9AQA-0000xf-Lr Subject: [Openvpn-devel] [PATCH 7/9] Bail out when trying to install a TCP socket with residual data to DCO 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?1753125758102487788?= X-GMAIL-MSGID: =?utf-8?q?1753125758102487788?= Instead of getting the server in a very weird state, we bail out here. This is only a bandaid solution but better than the alternatives. Signed-off-by: Arne Schwabe --- src/openvpn/mtcp.c | 2 +- src/openvpn/multi.c | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/openvpn/mtcp.c b/src/openvpn/mtcp.c index 263f4d994..3837ccbab 100644 --- a/src/openvpn/mtcp.c +++ b/src/openvpn/mtcp.c @@ -591,7 +591,7 @@ multi_tcp_post(struct multi_context *m, struct multi_instance *mi, const int act struct gc_arena gc = gc_new(); msg(M_INFO, "ovpn-dco installed socket with residual read " "len=%d, mi=%s. This connection will probably" - " break.", BLEN(&c->c2.link_socket->stream_buf.residual), + " break.", BLEN(&c->c2.link_socket->stream_buf.buf), multi_instance_string(mi, false, &gc)); gc_free(&gc); break; diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c index 9a20112e2..d29b7efe3 100644 --- a/src/openvpn/multi.c +++ b/src/openvpn/multi.c @@ -2316,9 +2316,17 @@ multi_client_setup_dco_initial(struct multi_context *m, { if (!dco_enabled(&mi->context.options)) { - /* DCO not enabled, nothing to do, return sucess */ + /* DCO not enabled, nothing to do, return success */ return true; } + + if (socket_read_residual(mi->context.c2.link_socket)) + { + msg(M_INFO, "TCP socket with half read packet. Cannot install to " + "DCO: %s", multi_instance_string(mi, false, gc)); + return false; + } + int ret = dco_multi_add_new_peer(m, mi); if (ret < 0) {