| Message ID | 20220728034508.15180-2-selva.nair@gmail.com |
|---|---|
| State | Accepted |
| Headers |
Return-Path: <openvpn-devel-bounces@lists.sourceforge.net> Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director8.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id oEmQF5kG4mJ/BAAAIUCqbw (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Wed, 27 Jul 2022 23:46:33 -0400 Received: from proxy3.mail.ord1d.rsapps.net ([172.30.191.6]) by director8.mail.ord1d.rsapps.net with LMTP id YE91F5kG4mJaXgAAfY0hYg (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Wed, 27 Jul 2022 23:46:33 -0400 Received: from smtp7.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy3.mail.ord1d.rsapps.net with LMTPS id kLcPF5kG4mKUfwAA7WKfLA (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) for <patchwork@openvpn.net>; Wed, 27 Jul 2022 23:46:33 -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: smtp7.gate.ord1d.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; dkim=fail (signature verification failed) header.d=gmail.com; dmarc=fail (p=none; dis=none) header.from=gmail.com X-Suspicious-Flag: YES X-Classification-ID: defa4c06-0e27-11ed-8707-525400d0c497-1-1 Received: from [216.105.38.7] ([216.105.38.7:46232] helo=lists.sourceforge.net) by smtp7.gate.ord1d.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 B5/B9-02674-99602E26; Wed, 27 Jul 2022 23:46:33 -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.94.2) (envelope-from <openvpn-devel-bounces@lists.sourceforge.net>) id 1oGuSu-0005YA-OP; Thu, 28 Jul 2022 03:45:35 +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.94.2) (envelope-from <selva.nair@gmail.com>) id 1oGuSm-0005Xz-B8 for openvpn-devel@lists.sourceforge.net; Thu, 28 Jul 2022 03:45:27 +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: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:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=qjQLUj0gaumj+nJwIq0zuKaezaJ9Inyf2QiOzoJ5G+M=; b=dc7sV9CIF3BU4vdWIndfWALKD0 bpMO6oEibmlRSciSfYqYFXttFMRCcm3p0IoAkP7Y4UTKdeR9CbKkc4AyXsywIkxcLFArkE8KCerCk WnuPKIZhkH52n65516lq/ZkzVtzF23yoZ79ydRs6dxlV07MBKlZN/1W0yDLjqT9yv/4E=; 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: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:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=qjQLUj0gaumj+nJwIq0zuKaezaJ9Inyf2QiOzoJ5G+M=; b=nC92c8amKMatRZF32ll0WZrO+0 5XG2Z7771EP8VT5PDFzo1wM8A4HePpDTO69XGdOPF6RidQONdpkfQGyHnEACN0hPfMsXOWm8E/0Ki gLBrB9olX0Rm9N0siayLx+cG9fVv5DkUu2wlW2yCY3APDGj0IwYchnLWiougMnOYWzPo=; Received: from mail-il1-f171.google.com ([209.85.166.171]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1oGuSk-00CaZ4-B9 for openvpn-devel@lists.sourceforge.net; Thu, 28 Jul 2022 03:45:26 +0000 Received: by mail-il1-f171.google.com with SMTP id d4so409666ilc.8 for <openvpn-devel@lists.sourceforge.net>; Wed, 27 Jul 2022 20:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qjQLUj0gaumj+nJwIq0zuKaezaJ9Inyf2QiOzoJ5G+M=; b=l8W6FIg2YV9H1eJSw0AGKC8Xez+5waunUX3orNIi+wGscw6n3NaoOnoKvTywpWO4kf Fw8q1+DhGZSFtV5nlICNUQ6OFh4FTr4nmBKwYg4RwKHdd1p7b05TQOjUb/2Q9DFTg0OS 8Zz/4pwz0OpxjRFf6tS3GxjQU8aCoDRa9wm6oILXZF6lNWs7d1jP98HfkdvQtyHpFAsc xU+pce6rckRZve1BwjTaZdDg+xjy/VWfc/4FxfEt6yfvhMZOKESTXMN4JtcRmcqsk0ww XvBgvg9fV0R0ZbwzoVjYh6JJjXppaphKMn3+WTOJajIzRadMPE1fovoWJmoR+FOIRIIt XrQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qjQLUj0gaumj+nJwIq0zuKaezaJ9Inyf2QiOzoJ5G+M=; b=kwKVNi0zOXtxaBJacIuhrK9f3T7BVF/22Ck6ko58Wi/x5bLYxsViqO81vd0gfo1REy uC1Cc8YKWlSpqZYX4nb/lVF0G/BK3/AqcEgNFc8q8Yt9/qkhYrhyUgisV+XfdgckMqqi UlSg6hMYSks8186WWk7JJbI5iJr+ht+k0OzMv1OsWKMttqSzTL40uohubtUT3/T1JDg4 GlbbShb7XKpOe28PaNM3kVcjE/EPB4/LWwMLCKOvou1VxFxp/1zg4P+v0hcv4wOselj+ 1XG/Kw/g8Nebue6l72mVAihHjPwl3YgTapzkPwXjTTFeQiP+UZ9UOrBxNIizWlAFBlSb 03sg== X-Gm-Message-State: AJIora+W71ImpNPDRIXzwv0y7QQ34Vd6APcPehnUMBCvSty9qocTpd3G GzuCIgTm6Y7PlFchSsKGSZewsThzXldWVw== X-Google-Smtp-Source: AGRyM1vl4GzYK37y+YJ0G1+ruoA5+E1bqjX3HLG2ljG5gk4nJ7KMiI36t6IagJDkHCC7RtTTr8x7tQ== X-Received: by 2002:a92:c566:0:b0:2dc:7f17:820b with SMTP id b6-20020a92c566000000b002dc7f17820bmr10209058ilj.23.1658979920665; Wed, 27 Jul 2022 20:45:20 -0700 (PDT) Received: from uranus.home.sansel.ca ([2600:3c03:e001:3b08::1004]) by smtp.gmail.com with ESMTPSA id d184-20020a0262c1000000b0033f0c9f4fbesm8758203jac.135.2022.07.27.20.45.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Jul 2022 20:45:20 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Wed, 27 Jul 2022 23:45:08 -0400 Message-Id: <20220728034508.15180-2-selva.nair@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220728034508.15180-1-selva.nair@gmail.com> References: <20220728034508.15180-1-selva.nair@gmail.com> MIME-Version: 1.0 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: From: Selva Nair Without this, replies to commands from the management client are sometimes lost if the server is writing when a command comes in and leads to a recursive call to this function. For some reason I've not been able to trigger this on Linux, but it does sometimes happen on Windows during intense write activity by openvpn.exe sending log lines to the management client. Content analysis details: (-0.2 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [selva.nair[at]gmail.com] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 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_AU Message has a valid DKIM or DK signature from author's domain -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.166.171 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.166.171 listed in list.dnswl.org] X-Headers-End: 1oGuSk-00CaZ4-B9 Subject: [Openvpn-devel] [PATCH 2/2] Allow a few levels of recursion in virtual_output_callback() 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> 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/2] Do not skip ERROR:/SUCCESS: response from management interface
|
|
Commit Message
Selva Nair
July 27, 2022, 5:45 p.m. UTC
From: Selva Nair <selva.nair@gmail.com> Without this, replies to commands from the management client are sometimes lost if the server is writing when a command comes in and leads to a recursive call to this function. For some reason I've not been able to trigger this on Linux, but it does sometimes happen on Windows during intense write activity by openvpn.exe sending log lines to the management client. Signed-off-by: Selva Nair <selva.nair@gmail.com> --- src/openvpn/manage.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
Comments
Acked-by: Gert Doering <gert@greenie.muc.de> I cannot test this (beyond "compile", but that is trivial) but the description in https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24738.html makes sense, so allowing "a limited amount" of recursion plus actually logging when this is hit should make management more robust against overlapping timing issues aka "race conditions". Your patch has been applied to the master branch. commit 4dfd592ff1ee18aa4859264c8a341dfa1a291988 Author: Selva Nair Date: Wed Jul 27 23:45:08 2022 -0400 Allow a few levels of recursion in virtual_output_callback() Signed-off-by: Selva Nair <selva.nair@gmail.com> Acked-by: Gert Doering <gert@greenie.muc.de> Message-Id: <20220728034508.15180-2-selva.nair@gmail.com> URL: https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24751.html Signed-off-by: Gert Doering <gert@greenie.muc.de> -- kind regards, Gert Doering
Hi, On Tue, Aug 2, 2022 at 8:02 AM Gert Doering <gert@greenie.muc.de> wrote: > Acked-by: Gert Doering <gert@greenie.muc.de> > > I cannot test this (beyond "compile", but that is trivial) but the > description in > > > https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24738.html > > makes sense, so allowing "a limited amount" of recursion plus actually > logging when this is hit should make management more robust against > overlapping timing issues aka "race conditions". > > Your patch has been applied to the master branch. > Can we also apply this to 2.5? I see this trigerred easily with the new persistent connection / PLAP support. I haven't figured the exact reason but hitting reconnect or disconnect at certain instances triggers this -- like when the connection is almost complete and the daemon is doing slow-ish netsh commands. The same code-path is not traversed when interactive service is in use and it seems hitting the "race condition" is much harder in that case. Otherwise we have to limit these new GUI features to 2.6 which would require a new branch in the GUI and some changes to the build process. In some sense this is a "bug fix" though the fix itself is a band-aid as opposed to implementing a command queue to save these write actions instead of dropping them. Selva <div dir="ltr"><div>Hi,</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Aug 2, 2022 at 8:02 AM Gert Doering <<a href="mailto:gert@greenie.muc.de">gert@greenie.muc.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Acked-by: Gert Doering <<a href="mailto:gert@greenie.muc.de" target="_blank">gert@greenie.muc.de</a>><br> <br> I cannot test this (beyond "compile", but that is trivial) but the<br> description in <br> <br> <a href="https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24738.html" rel="noreferrer" target="_blank">https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24738.html</a><br> <br> makes sense, so allowing "a limited amount" of recursion plus actually<br> logging when this is hit should make management more robust against <br> overlapping timing issues aka "race conditions".<br> <br> Your patch has been applied to the master branch.<br></blockquote><div><br></div><div>Can we also apply this to 2.5? I see this trigerred easily with the new persistent connection / PLAP support. I haven't figured the exact reason but hitting reconnect or disconnect at certain instances triggers this -- like when the connection is almost complete and the daemon is doing slow-ish netsh commands. The same code-path is not traversed when interactive service is in use and it seems hitting the "race condition" is much harder in that case.</div><div><br></div><div>Otherwise we have to limit these new GUI features to 2.6 which would require a new branch in the GUI and some changes to the build process.</div><div><br></div><div>In some sense this is a "bug fix" though the fix itself is a band-aid as opposed to implementing a command queue to save these write actions instead of dropping them.</div><div><br></div><div>Selva</div></div></div>
In case this request was lost, here goes again. Can we have this cherry-picked into 2.5 before the next release? Selva On Thu, Aug 11, 2022 at 4:03 PM Selva Nair <selva.nair@gmail.com> wrote: > Hi, > > On Tue, Aug 2, 2022 at 8:02 AM Gert Doering <gert@greenie.muc.de> wrote: > >> Acked-by: Gert Doering <gert@greenie.muc.de> >> >> I cannot test this (beyond "compile", but that is trivial) but the >> description in >> >> >> https://www.mail-archive.com/openvpn-devel@lists.sourceforge.net/msg24738.html >> >> makes sense, so allowing "a limited amount" of recursion plus actually >> logging when this is hit should make management more robust against >> overlapping timing issues aka "race conditions". >> >> Your patch has been applied to the master branch. >> > > Can we also apply this to 2.5? I see this trigerred easily with the new > persistent connection / PLAP support. I haven't figured the exact reason > but hitting reconnect or disconnect at certain instances triggers this -- > like when the connection is almost complete and the daemon is doing > slow-ish netsh commands. The same code-path is not traversed when > interactive service is in use and it seems hitting the "race condition" is > much harder in that case. > > Otherwise we have to limit these new GUI features to 2.6 which would > require a new branch in the GUI and some changes to the build process. > > In some sense this is a "bug fix" though the fix itself is a band-aid as > opposed to implementing a command queue to save these write actions instead > of dropping them. > > Selva >
Hi, On Mon, Aug 22, 2022 at 10:43:39PM -0400, Selva Nair wrote: > In case this request was lost, here goes again. Can we have this > cherry-picked into 2.5 before the next release? Oops. It got lost, was rediscovered last week, and got lost again. Sorry, and thanks for the reminder. gert
Hi, On Tue, Aug 02, 2022 at 02:02:39PM +0200, Gert Doering wrote: > Your patch has been applied to the master branch. > > commit 4dfd592ff1ee18aa4859264c8a341dfa1a291988 ... and after some reminding, to release/2.5 as well. commit 468f53ae3bfcfca6563acbf648e7a0bc6f94b038 (HEAD -> release/2.5) Author: Selva Nair <selva.nair@gmail.com> Date: Wed Jul 27 23:45:08 2022 -0400 Allow a few levels of recursion in virtual_output_callback() ... (cherry picked from commit 4dfd592ff1ee18aa4859264c8a341dfa1a291988) Since this code is virtually unchanged "since ever", it cherrypicked smoothly, diff looks good, and a small client-side test run worked just fine (same caveat as for the "master" patch, I have nothing which triggers this problem today). gert
diff --git a/src/openvpn/manage.c b/src/openvpn/manage.c index 27aa49a8..5670e594 100644 --- a/src/openvpn/manage.c +++ b/src/openvpn/manage.c @@ -312,8 +312,7 @@ virtual_output_callback_func(void *arg, const unsigned int flags, const char *st #define AF_DID_PUSH (1<<0) #define AF_DID_RESET (1<<1) - - if (!recursive_level) /* don't allow recursion */ + if (recursive_level < 5) /* limit recursion */ { struct gc_arena gc = gc_new(); struct log_entry e; @@ -380,6 +379,12 @@ virtual_output_callback_func(void *arg, const unsigned int flags, const char *st --recursive_level; } + else + { + /* cannot use msg here */ + printf("virtual_output: message to management interface " + "dropped due to recursion: <%s>\n", str); + } } /*