From patchwork Sat Nov 11 05:03:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steffan Karger X-Patchwork-Id: 63 X-Patchwork-Delegate: a@unstable.cc Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director4.mail.ord1d.rsapps.net ([172.28.255.1]) by backend31.mail.ord1d.rsapps.net (Dovecot) with LMTP id Y5P4Ip8fB1qQDwAAgoeIoA for ; Sat, 11 Nov 2017 11:04:47 -0500 Received: from director9.mail.ord1c.rsapps.net ([172.28.255.1]) by director4.mail.ord1d.rsapps.net (Dovecot) with LMTP id Y5TjIp8fB1rMNQAAHDmxtw ; Sat, 11 Nov 2017 11:04:47 -0500 Received: from smtp52.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by director9.mail.ord1c.rsapps.net (Dovecot) with LMTP id nXMLB58fB1pTXwAA4V03VA ; Sat, 11 Nov 2017 11:04:47 -0500 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.34.181.88] Authentication-Results: smtp52.gate.ord1c.rsapps.net; iprev=pass policy.iprev="216.34.181.88"; 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; dkim=fail (signature verification failed) header.d=karger-me.20150623.gappssmtp.com; dmarc=none (p=nil; dis=none) header.from=karger.me X-Classification-ID: 0a0a01ea-c6fa-11e7-8180-b8ca3a5c9d28-1-1 Received: from [216.34.181.88] ([216.34.181.88:53233] helo=lists.sourceforge.net) by smtp52.gate.ord1c.rsapps.net (envelope-from ) (ecelerity 4.2.1.56364 r(Core:4.2.1.14)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 7D/40-08471-F9F170A5; Sat, 11 Nov 2017 11:04:47 -0500 Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.89) (envelope-from ) id 1eDYGU-00008r-4i; Sat, 11 Nov 2017 16:04:14 +0000 Received: from sfi-mx-3.v28.ch3.sourceforge.com ([172.29.28.193] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89) (envelope-from ) id 1eDYGS-00008b-LO for openvpn-devel@lists.sourceforge.net; Sat, 11 Nov 2017 16:04:12 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: MIME-Version:Content-Type:Content-Transfer-Encoding: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=Ofi32RZv7k3zfmZpO6jHfqbATh7LRbbIP26B/Bgff4o=; b=PIUVqXdG7/XsuRKVJVPUtLDtWy GLr6sjCsOs9Y6WJv3oGx7Jyz/s2BiTk8LEUqaLKyZ9WlLB1lzD2aWq3d/C20bOJaE982vpnr3mOht X87vzycfL0NNEiWpMiKOfwtOyDp5pW1W+TK3RZRPtJMhnzCbLMrHrtBOhOBip0p0VnVY=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:MIME-Version: Content-Type:Content-Transfer-Encoding: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=Ofi32RZv7k3zfmZpO6jHfqbATh7LRbbIP26B/Bgff4o=; b=VaA7g7jj+91jVHMEQo/8bGxDYw oASXEIR60AMpFSGGLZ8kMTzMv5T7xGvbdLbMnnMFnU6jHUK0djQeDuncBSj99aJjwviu6ZpydVQBx R4oEHaJNpPCWkdGJrp9tu3VfqMF4Ob1HEa7Xd33J42yxaytSiQp00Q2JZ33ZeHsX1xOY=; Received: from mail-wm0-f47.google.com ([74.125.82.47]) by sfi-mx-3.v28.ch3.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.89) id 1eDYGR-0003LG-5f for openvpn-devel@lists.sourceforge.net; Sat, 11 Nov 2017 16:04:12 +0000 Received: by mail-wm0-f47.google.com with SMTP id 9so2350206wme.4 for ; Sat, 11 Nov 2017 08:04:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=karger-me.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=Ofi32RZv7k3zfmZpO6jHfqbATh7LRbbIP26B/Bgff4o=; b=1Y55hlJOEINMg87qFd26wX40yOAt3B0WUhP3tlNU480mlksETt7IviYZT6gfRrTP2c rkoyHrHNozWPCDXllns4cLcEId+oCrkibMHK4qmiFgiJS58BE+6X2DDCtb+KkMv0hXUz S1OPvRft4imMUfOrcawwnSFLnpjHs0iY1xa0n901/8ecDTQmCbGY7tWWfZj8UMQ2aqXn G8PuzOy3PPTcES2ayCRMuT2+CW2cNZzQE+v55ReMO1cVFCatjw2hJdXHX2J8O20jjoAM SyFl17jx0/dXipXoaDkpJc+KD2iUqNBkGjMT+4s4ZA8CfTpKtgUevFLA+H3/+0ckfc4/ Bvzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=Ofi32RZv7k3zfmZpO6jHfqbATh7LRbbIP26B/Bgff4o=; b=V7iOrh/JpmEdqykXATCRoKdmcQBKt9wrXHX+x5xY05oNY23IrzVm9ojBBadfeaWD1U iIoSemU7VikarhYMun9OZQe7ov2fnkUCbHdQfihPP+IKPFf0rupqj66pZTJktQEo27/r ZK7UT+aoRBqqYBhB02dLhxLOT+2Fdghm+FA2kLH6zMv7PtiNmKKk9EeO924ASCAFQ2Ph ezoRHl7E5d51BoK/gKorvHlVGEoBJtAuOWRwgKw4oX1LQPsv4eZreYSGATG8sh3OXajJ de+D/38VZUWDfwtdG5odAOL0OpqckXu+bmTPNTHLz1F2CAdMQG6I7dSQQj6sHJB0xXdQ QSXA== X-Gm-Message-State: AJaThX44G32DSVx5VvbkWXGhIiNaBigIQll9vZIrYPIQVCIP/pB/RM1N bLND30HIzbjOfqCdSH4XXH1OQExDJzg= X-Google-Smtp-Source: AGs4zMZPfkJplc8tCADDz5cRJqgYIKXT2RM+AS7NyEKeDQimMuTQiTXN8hZzCug/qRpfm1SQDIlheQ== X-Received: by 10.80.177.72 with SMTP id l8mr5331702edd.175.1510416244907; Sat, 11 Nov 2017 08:04:04 -0800 (PST) Received: from localhost.localdomain ([2001:985:e54:1050::1000]) by smtp.gmail.com with ESMTPSA id w13sm10629884edk.46.2017.11.11.08.04.03 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 11 Nov 2017 08:04:03 -0800 (PST) From: Steffan Karger To: openvpn-devel@lists.sourceforge.net Date: Sat, 11 Nov 2017 17:03:59 +0100 Message-Id: <20171111160359.28078-1-steffan@karger.me> X-Mailer: git-send-email 2.14.1 X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.82.47 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1eDYGR-0003LG-5f Subject: [Openvpn-devel] [PATCH] Use P_DATA_V2 for server->client packets too 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: , MIME-Version: 1.0 Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox P_DATA_V2 introduced the peer-id. This allows clients to float, but as a side-effect 32-bit aligns the encrypted data. That alignment improves performance particularly on cheaper/older CPUs. So although servers don't actually have a peer-id, still use the V2 packet format (with a zero-id) for server->client traffic too. Signed-off-by: Steffan Karger --- src/openvpn/forward.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/openvpn/forward.c b/src/openvpn/forward.c index 1b7455bb..20e89d34 100644 --- a/src/openvpn/forward.c +++ b/src/openvpn/forward.c @@ -496,7 +496,7 @@ encrypt_sign(struct context *c, bool comp_frag) /* If using P_DATA_V2, prepend the 1-byte opcode and 3-byte peer-id to the * packet before openvpn_encrypt(), so we can authenticate the opcode too. */ - if (c->c2.buf.len > 0 && !c->c2.tls_multi->opt.server && c->c2.tls_multi->use_peer_id) + if (c->c2.buf.len > 0 && c->c2.tls_multi->use_peer_id) { tls_prepend_opcode_v2(c->c2.tls_multi, &b->encrypt_buf); }