From patchwork Fri Jul 22 10:40:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Selva Nair X-Patchwork-Id: 2602 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director9.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id MGjIIXgL22K4OgAAIUCqbw (envelope-from ) for ; Fri, 22 Jul 2022 16:41:28 -0400 Received: from proxy15.mail.ord1d.rsapps.net ([172.30.191.6]) by director9.mail.ord1d.rsapps.net with LMTP id cE2oIXgL22IGJAAAalYnBA (envelope-from ) for ; Fri, 22 Jul 2022 16:41:28 -0400 Received: from smtp15.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy15.mail.ord1d.rsapps.net with LMTPS id cMJWIXgL22J7TQAAAY1PeQ (envelope-from ) for ; Fri, 22 Jul 2022 16:41:28 -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: smtp15.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: a8a6e420-09fe-11ed-900f-5254007ab6c8-1-1 Received: from [216.105.38.7] ([216.105.38.7:50574] helo=lists.sourceforge.net) by smtp15.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 24/E7-23138-77B0BD26; Fri, 22 Jul 2022 16:41:28 -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.94.2) (envelope-from ) id 1oEzRi-0005JU-Eh; Fri, 22 Jul 2022 20:40:26 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-1.v29.lw.sourceforge.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1oEzRg-0005JO-BR for openvpn-devel@lists.sourceforge.net; Fri, 22 Jul 2022 20:40:24 +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: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:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=PIEBRh3D9DHepU01GY3SZ1s5XfNRv9lf7DBBLkA7CIg=; b=MVH1U1uAm5WcG7SI5PTfi8cr4C 2QXecMjutg4yMCIEf5DCDvTj1J2zmubBKemDfqYQHqgyzjQ8maLDEl9oRTmIf3z53SVETxIe3JTaH 2r3wtjZ8JGLBdKsssjXo2MCnbTYh2t3O73zMYacTxfqRKYa2hTDq/UvGvSFvNdMx47C4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=Content-Transfer-Encoding:MIME-Version: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:In-Reply-To: References:List-Id:List-Help:List-Unsubscribe:List-Subscribe:List-Post: List-Owner:List-Archive; bh=PIEBRh3D9DHepU01GY3SZ1s5XfNRv9lf7DBBLkA7CIg=; b=m bGfGCZ1UK7iXjh59L28+kATagOBxKttK5XRonColRsIpw9JbcE6krJ/oddmb89JCBXX3WFY23UfF2 m4SRFgPuYT0I+byB3phmsrtJtSy1rJ0tdfnlcxDwZtDTJbrOWKWxPtS4IyMv4X6DcBBbSu8UjTKOZ fiv+bV7T01vbSSlo=; Received: from mail-qk1-f182.google.com ([209.85.222.182]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.94.2) id 1oEzRb-0079mk-Uj for openvpn-devel@lists.sourceforge.net; Fri, 22 Jul 2022 20:40:24 +0000 Received: by mail-qk1-f182.google.com with SMTP id f14so4532410qkm.0 for ; Fri, 22 Jul 2022 13:40:19 -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:mime-version :content-transfer-encoding; bh=PIEBRh3D9DHepU01GY3SZ1s5XfNRv9lf7DBBLkA7CIg=; b=fumuV3ObhPLpeUesByHF6XWaf86Nd8uO1Kt7G+1s/8bRL/eyS4OZfv8+32cUkOdgOk rxbcsK931e63hi8NAytcjdydVRUCWyPFybBrbczBTdx8tbOS9bke5Uw9blpZwLy+hn1g WN3mEggbwha/QfT+ltvqoNE3K8dYUsH2Hstnnc93hcfgl/FUxt+zDxdF4xqeX4VeHn8W nwXhforcBdFRay+eulb/g6Viv+en1wHbWdbbtRnO174sji2S4txCJzcfcPiQKqLKN0rZ 1+HT8Rr9XFmxLcWf/wc2bPwsvQYHA9NotceQRqsu3bVYpDHnbeATl8VjjZIURpRRhEji Ekwg== 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:mime-version :content-transfer-encoding; bh=PIEBRh3D9DHepU01GY3SZ1s5XfNRv9lf7DBBLkA7CIg=; b=N0kXns+IuVRJbQdGJUz6e+o5zPke0kSM1c1oV9uzJjegZlNs6uaqDo17Y0m9VK/Mp5 X05O2slqpiKTe0L3mX8ikfDM3drk8OniHYDRa7PllmCb3eyOhig3o6AZLyy967lJPZyy +PovT8MmkYyqVHdJMmxuCSl+MkpmnOfRKpT4Xr3Fo3rRc47PEyQPqFQlNi6B7hXNyZ3m Z7fdYN/a5/do1kZYRIWCfBfbHCIGBhsQO8eNwqTd2vkO6moK6/9hnXG/R7Dm3b/rCGIf JqMkMG9ZSM6f28wvRo2wR/QDhO5PJCSCVYC0rPssZaLdkshla2jWCllf/87X/jsTpWkc xbtQ== X-Gm-Message-State: AJIora9oURkbllVXZ9z1z5tBM0k5ZKOWhVSgbSciZ38oTNj0SuclJqv/ FuvLBLlVLNbej81tcmPxLqfCQBYJK8c= X-Google-Smtp-Source: AGRyM1sg/NAmpM5CtDekQ7LyN1yDztE+LqjeOBxvSofEH+cBwFSx2WWTpRxz25Zg63VmC+aQUzEYgA== X-Received: by 2002:a37:5fc4:0:b0:6b5:ec2b:93e6 with SMTP id t187-20020a375fc4000000b006b5ec2b93e6mr1372232qkb.693.1658522413899; Fri, 22 Jul 2022 13:40:13 -0700 (PDT) Received: from uranus.home.sansel.ca (bras-vprn-tnhlon4053w-lp130-02-70-51-223-109.dsl.bell.ca. [70.51.223.109]) by smtp.gmail.com with ESMTPSA id v1-20020a05620a440100b006b5fc79427fsm4434356qkp.77.2022.07.22.13.40.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Jul 2022 13:40:12 -0700 (PDT) From: selva.nair@gmail.com To: openvpn-devel@lists.sourceforge.net Date: Fri, 22 Jul 2022 16:40:07 -0400 Message-Id: <20220722204007.7537-1-selva.nair@gmail.com> X-Mailer: git-send-email 2.30.2 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 The correct errno can get overwritten by the call to format_extended_socket_error() which may set errno to EAGAIN losing the original error and cause to bypass the error reporting below. Fix by readin [...] 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_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 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.85.222.182 listed in wl.mailspike.net] -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [209.85.222.182 listed in list.dnswl.org] X-Headers-End: 1oEzRb-0079mk-Uj Subject: [Openvpn-devel] [PATCH] In x_check_status() read errno early 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 The correct errno can get overwritten by the call to format_extended_socket_error() which may set errno to EAGAIN losing the original error and cause to bypass the error reporting below. Fix by reading the errno of interest at the top of the function. Reported by: Gert Doering Signed-off-by: Selva Nair Acked-by: Gert Doering --- src/openvpn/error.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/openvpn/error.c b/src/openvpn/error.c index 49ed1dbc..7cd35b17 100644 --- a/src/openvpn/error.c +++ b/src/openvpn/error.c @@ -658,6 +658,9 @@ x_check_status(int status, { const char *extended_msg = NULL; + bool crt_error = false; + int my_errno = openvpn_errno_maybe_crt(&crt_error); + msg(x_cs_verbose_level, "%s %s returned %d", sock ? proto2ascii(sock->info.proto, sock->info.af, true) : "", description, @@ -688,9 +691,6 @@ x_check_status(int status, } #endif - bool crt_error = false; - int my_errno = openvpn_errno_maybe_crt(&crt_error); - if (!ignore_sys_error(my_errno, crt_error)) { if (extended_msg)