From patchwork Wed Jul 27 17:45:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2609 Return-Path: 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 ) for ; 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 ) for ; 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 ) for ; 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 ) (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 ) 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 ) 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 ; 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: openvpn-devel-bounces@lists.sourceforge.net X-getmail-retrieved-from-mailbox: Inbox 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. Signed-off-by: Selva Nair Acked-by: Gert Doering --- src/openvpn/manage.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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); + } } /*