From patchwork Wed Aug 31 03:41:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arne Schwabe X-Patchwork-Id: 2737 X-Patchwork-Delegate: gert@greenie.muc.de Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director10.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id WNGUBUdlD2MhOAAAIUCqbw (envelope-from ) for ; Wed, 31 Aug 2022 09:42:31 -0400 Received: from proxy3.mail.ord1c.rsapps.net ([172.28.255.1]) by director10.mail.ord1d.rsapps.net with LMTP id gAlTBUdlD2NYKQAApN4f7A (envelope-from ) for ; Wed, 31 Aug 2022 09:42:31 -0400 Received: from smtp21.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.ord1c.rsapps.net with LMTPS id 0GoQBUdlD2PtUwAANIxBXg (envelope-from ) for ; Wed, 31 Aug 2022 09:42:31 -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: smtp21.gate.ord1c.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=rfc2549.org X-Suspicious-Flag: YES X-Classification-ID: c1d2b336-2932-11ed-93b6-a0369f0d8808-1-1 Received: from [216.105.38.7] ([216.105.38.7:35772] helo=lists.sourceforge.net) by smtp21.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 22/5A-05315-5456F036; Wed, 31 Aug 2022 09:42:30 -0400 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 1oTNyb-0007z1-Lo; Wed, 31 Aug 2022 13:41:53 +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 1oTNya-0007yq-JI for openvpn-devel@lists.sourceforge.net; Wed, 31 Aug 2022 13:41:52 +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=xg4y4FVLIHvZNkRTKd5QuHbrBQCKpefQR+avpBPxxps=; b=HGyjy2ZSdyPiXHjY5QPbWUdrFJ lRNCB2hSp63Lqc8wUQ50HxQEGUV2UA0Fl0S4Sls/6v3hCzbfIR4sxGw17RmabjNjyza3F28AOlQgl u0Hx+jmyvowLSFZgpW02WTBjJzsLh63bjvhaPDzjzxtC9VFAkSb9j2LmnYfZRXFccvI4=; 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=xg4y4FVLIHvZNkRTKd5QuHbrBQCKpefQR+avpBPxxps=; b=A/AV3mBV690k79Lh+sLHjxMtAv ROtDU2RmzwGgD50wD+lsYAA7R1FJ6hzhNLkRGxtZ97stQ+9dEjP3U0Rkv/YGcW4OMf7WKAZQut6aT SWf8iiSw3Ir3QN7tA7LZ5dTZVzLIKdS8Y+SJWjDGnno7C86SNdSKTKvChS19X1iEAJpI=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.95) id 1oTNya-008q84-1d for openvpn-devel@lists.sourceforge.net; Wed, 31 Aug 2022 13:41:52 +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 1oTNyO-0001ig-5Q for openvpn-devel@lists.sourceforge.net; Wed, 31 Aug 2022 15:41:40 +0200 Received: (nullmailer pid 913388 invoked by uid 10006); Wed, 31 Aug 2022 13:41:40 -0000 From: Arne Schwabe To: openvpn-devel@lists.sourceforge.net Date: Wed, 31 Aug 2022 15:41:40 +0200 Message-Id: <20220831134140.913337-2-arne@rfc2549.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220831134140.913337-1-arne@rfc2549.org> References: <20220422134038.3801239-1-arne@rfc2549.org> <20220831134140.913337-1-arne@rfc2549.org> 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: Softether had the number of ACKs in ANY OpenVPN packet limited to 4 and dropped packets with more than 4 ACKs. This leads to Softether dropping P_ACK_V1 packets with more than 4 ACKs as invalid. As th [...] Content analysis details: (0.3 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 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 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record X-Headers-End: 1oTNya-008q84-1d Subject: [Openvpn-devel] [PATCH 29/28] Add workaround for Softether server dropping P_ACK_V1 with >= 5 acks 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 Softether had the number of ACKs in ANY OpenVPN packet limited to 4 and dropped packets with more than 4 ACKs. This leads to Softether dropping P_ACK_V1 packets with more than 4 ACKs as invalid. As the recent change of always acking as many packets as possible, this leads to Softether server not being able to successfully establish a connection anymore as it never registers the ACKs. This behaviour has been fixed on the Softether side with commit 37aa1ba5 but in order to allow clients to connect to older Softether servers, this commit implements a workaround for the case that the peer might be a Softether server (no tls-auth/tls-crypt and no other advanced protocol feature) and limits ACKs to 4 in this case. Signed-off-by: Arne Schwabe Acked-by: Gert Doering --- src/openvpn/ssl_pkt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/openvpn/ssl_pkt.c b/src/openvpn/ssl_pkt.c index e86fbc1b8..9b180cbf4 100644 --- a/src/openvpn/ssl_pkt.c +++ b/src/openvpn/ssl_pkt.c @@ -177,6 +177,15 @@ write_control_auth(struct tls_session *session, { uint8_t header = ks->key_id | (opcode << P_OPCODE_SHIFT); + /* Workaround for Softether servers. Softether has a bug that it only + * allows 4 ACks in packets and drops packets if more ACKs are contained + * in a packet (see commit a14d812dcbc in Softether) */ + if (session->tls_wrap.mode == TLS_WRAP_NONE && !session->opt->server + && !(session->opt->crypto_flags & CO_USE_TLS_KEY_MATERIAL_EXPORT)) + { + max_ack = min_int(max_ack, 4); + } + ASSERT(link_socket_actual_defined(&ks->remote_addr)); ASSERT(reliable_ack_write (ks->rec_ack, ks->lru_acks, buf, &ks->session_id_remote,