| Message ID | 20200709101603.11941-8-arne@rfc2549.org |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director12.mail.ord1d.rsapps.net ([172.28.255.1]) by backend30.mail.ord1d.rsapps.net with LMTP id sNRbJKHuBl+hVAAAIUCqbw for <patchwork@openvpn.net>; Thu, 09 Jul 2020 06:17:05 -0400 Received: from proxy2.mail.ord1c.rsapps.net ([172.28.255.1]) by director12.mail.ord1d.rsapps.net with LMTP id GF5lJKHuBl8ETgAAIasKDg ; Thu, 09 Jul 2020 06:17:05 -0400 Received: from smtp13.gate.ord1c ([172.28.255.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy2.mail.ord1c.rsapps.net with LMTP id wBLwI6HuBl8nagAA311kuQ ; Thu, 09 Jul 2020 06:17:05 -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: smtp13.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: 563e55fe-c1cd-11ea-92d7-bc305bf03494-1-1 Received: from [216.105.38.7] ([216.105.38.7:46958] helo=lists.sourceforge.net) by smtp13.gate.ord1c.rsapps.net (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 7D/6A-20374-1AEE60F5; Thu, 09 Jul 2020 06:17:05 -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.90_1) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1jtTbU-0002Es-7r; Thu, 09 Jul 2020 10:16:32 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from <arne@kamera.blinkt.de>) id 1jtTbH-0002DB-1w for openvpn-devel@lists.sourceforge.net; Thu, 09 Jul 2020 10:16:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:To: From:Sender:Reply-To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: 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=r2Gox2dBufvtuFACCzog6+mwFEBeUqtp8K/rGFZWR/w=; b=MLwvSb/gg/gFStksYfiS4RrPAu ijwC95w2ZNMnvKs0ln0K1YXOFT1xkAKF9oYMoSreMNwo6FG3ifWv9+d1i8Z7rar161hMua8y7r5Sc YAsm5VHiJMm1WchqyHWu2UzDRvTGZcc4QvgOs4oSJK/tWWM0VFe1TDUJCgBTeQ/qpcGA=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=References:In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc :MIME-Version:Content-Type:Content-Transfer-Encoding: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=r2Gox2dBufvtuFACCzog6+mwFEBeUqtp8K/rGFZWR/w=; b=HHuArTV0wglb+mFRARyEwHPZRe ZRMcNs2r6HQPCchGwwmfrfvNfjaGKYpRis68Tnq6d7UKdIsEahb+IdkGDuQ7DtVFx8Ir3qWKhW8Mr 8vMGR7uYtb7IWSpZl9GraJYBV+lo51PiR9VWZma6tG2i+27hE+JPpDyvwT+ued3QbOtI=; Received: from mail.blinkt.de ([192.26.174.232]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1jtTbF-000gge-VR for openvpn-devel@lists.sourceforge.net; Thu, 09 Jul 2020 10:16:19 +0000 Received: from kamera.blinkt.de ([2001:638:502:390:20c:29ff:fec8:535c]) by mail.blinkt.de with smtp (Exim 4.92.3 (FreeBSD)) (envelope-from <arne@kamera.blinkt.de>) id 1jtTb2-000HY8-4L for openvpn-devel@lists.sourceforge.net; Thu, 09 Jul 2020 12:16:04 +0200 Received: (nullmailer pid 12010 invoked by uid 10006); Thu, 09 Jul 2020 10:16:03 -0000 From: Arne Schwabe <arne@rfc2549.org> To: openvpn-devel@lists.sourceforge.net Date: Thu, 9 Jul 2020 12:16:03 +0200 Message-Id: <20200709101603.11941-8-arne@rfc2549.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200709101603.11941-1-arne@rfc2549.org> References: <20200709101603.11941-1-arne@rfc2549.org> X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. 0.0 URIBL_BLOCKED ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [URIs: rfc2549.org] 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: 1jtTbF-000gge-VR Subject: [Openvpn-devel] [PATCH 8/8] Code cleanup: remove superflous variable X-BeenThere: openvpn-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: <openvpn-devel.lists.sourceforge.net> List-Unsubscribe: <https://lists.sourceforge.net/lists/options/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=unsubscribe> List-Archive: <http://sourceforge.net/mailarchive/forum.php?forum_name=openvpn-devel> List-Post: <mailto:openvpn-devel@lists.sourceforge.net> List-Help: <mailto:openvpn-devel-request@lists.sourceforge.net?subject=help> List-Subscribe: <https://lists.sourceforge.net/lists/listinfo/openvpn-devel>, <mailto:openvpn-devel-request@lists.sourceforge.net?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox |
| Series |
[Openvpn-devel,1/8] Deprecate ncp-disable and add improved ncp to Changes.rst
|
|
Commit Message
Arne Schwabe
July 9, 2020, 12:16 a.m. UTC
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
---
src/openvpn/ssl.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
Hi, On 09/07/2020 12:16, Arne Schwabe wrote: > Signed-off-by: Arne Schwabe <arne@rfc2549.org> > --- > src/openvpn/ssl.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c > index 4ee4c245..54a23011 100644 > --- a/src/openvpn/ssl.c > +++ b/src/openvpn/ssl.c > @@ -1231,11 +1231,10 @@ lame_duck_must_die(const struct tls_session *session, interval_t *wakeup) > const struct key_state *lame = &session->key[KS_LAME_DUCK]; > if (lame->state >= S_INITIAL) > { > - const time_t local_now = now; > ASSERT(lame->must_die); /* a lame duck key must always have an expiration */ > - if (local_now < lame->must_die) > + if (now < lame->must_die) > { > - compute_earliest_wakeup(wakeup, lame->must_die - local_now); > + compute_earliest_wakeup(wakeup, lame->must_die - now); The only reason for having this local variable is the case where this code would run concurrently with a thread that could update "now" behind our back. Since openvpn runs in a single thread, such scenario is not possible at all. For this reason this patch makes sense and it removes one more bit that was originally introduced in the attempt of implementing multi threading. Acked-by: Antonio Quartulli <a@unstable.cc> > return false; > } > else >
Your patch has been applied to the master branch.
After some discussion on IRC, Antonio and I have come to the conclusion
that the original code was related to the pre-2.2 threading attempts, and
that "copying 'now' to a new local variable" might have been necessary to
avoid another thread messing with it while comparisons are being made - so
having a thread-local "local_now" is reasonable.
Now, the threading stuff was never finished and removed in 7aa6c12a4424d
nearly 10 years ago... out with it :-)
commit ca514800ca126b69dbde846db819d8bf4c490e68
Author: Arne Schwabe
Date: Thu Jul 9 12:16:03 2020 +0200
Code cleanup: remove superflous variable
Signed-off-by: Arne Schwabe <arne@rfc2549.org>
Acked-by: Antonio Quartulli <antonio@openvpn.net>
Message-Id: <20200709101603.11941-8-arne@rfc2549.org>
URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg20252.html
Signed-off-by: Gert Doering <gert@greenie.muc.de>
--
kind regards,
Gert Doering
diff --git a/src/openvpn/ssl.c b/src/openvpn/ssl.c index 4ee4c245..54a23011 100644 --- a/src/openvpn/ssl.c +++ b/src/openvpn/ssl.c @@ -1231,11 +1231,10 @@ lame_duck_must_die(const struct tls_session *session, interval_t *wakeup) const struct key_state *lame = &session->key[KS_LAME_DUCK]; if (lame->state >= S_INITIAL) { - const time_t local_now = now; ASSERT(lame->must_die); /* a lame duck key must always have an expiration */ - if (local_now < lame->must_die) + if (now < lame->must_die) { - compute_earliest_wakeup(wakeup, lame->must_die - local_now); + compute_earliest_wakeup(wakeup, lame->must_die - now); return false; } else