From patchwork Wed Aug 3 22:25:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gert Doering X-Patchwork-Id: 2627 Return-Path: Delivered-To: patchwork@openvpn.net Delivered-To: patchwork@openvpn.net Received: from director7.mail.ord1d.rsapps.net ([172.30.191.6]) by backend30.mail.ord1d.rsapps.net with LMTP id KE6uCLaC62K6FgAAIUCqbw (envelope-from ) for ; Thu, 04 Aug 2022 04:26:30 -0400 Received: from proxy16.mail.ord1d.rsapps.net ([172.30.191.6]) by director7.mail.ord1d.rsapps.net with LMTP id +OqqCLaC62LMTwAAovjBpQ (envelope-from ) for ; Thu, 04 Aug 2022 04:26:30 -0400 Received: from smtp4.gate.ord1d ([172.30.191.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by proxy16.mail.ord1d.rsapps.net with LMTPS id MHEkCLaC62IOaQAAetu3IA (envelope-from ) for ; Thu, 04 Aug 2022 04:26:30 -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: smtp4.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; dmarc=none (p=nil; dis=none) header.from=greenie.muc.de X-Suspicious-Flag: YES X-Classification-ID: 2352b968-13cf-11ed-9f65-525400760ffc-1-1 Received: from [216.105.38.7] ([216.105.38.7:51184] helo=lists.sourceforge.net) by smtp4.gate.ord1d.rsapps.net (envelope-from ) (ecelerity 4.2.38.62370 r(:)) with ESMTPS (cipher=DHE-RSA-AES256-GCM-SHA384) id 1E/AF-17252-5B28BE26; Thu, 04 Aug 2022 04:26:29 -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 1oJWAX-0005CV-Uz; Thu, 04 Aug 2022 08:25:25 +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 1oJWAW-0005B3-8I for openvpn-devel@lists.sourceforge.net; Thu, 04 Aug 2022 08:25: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:References: In-Reply-To:Message-Id:Date:Subject:To:From:Sender:Reply-To:Cc: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=RuOvnHrvtCJpZiwAaEZ4FJKjm7aO+YCoA0cwkW2e1V0=; b=N+63VSLA1HGPPWlxBpg/XfeCbh qka1K61u8l0xFUM+vfIYIcLPvdpP6l2pDtfP9cxyBr+Q1uMhT/b8zKT5r9LOW/jmE7V0as4kPkOyR TWUHcgQFKesSPSGEzGZx1WDh6ocHaSDegXrOwpLtzXMeAPkICGcLg61GV0tm9KFCpGbI=; 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:To:From:Sender:Reply-To:Cc: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=RuOvnHrvtCJpZiwAaEZ4FJKjm7aO+YCoA0cwkW2e1V0=; b=IpLxfZ563enGqF+iAPsFROaGiI xTmQIjwwJwMwKmtw8mb6iMBs6RY468cm0Z6P+NnrnFBaf8Mdk9cWdowmmtXpH1xMJ+DUC7UC2tPzE DtGI6p5Wg1apsTpNtb8TDM9AhPtU3VDeU0d0HjwVqzMTR5p9KRdhJGL+IgjyZVDvSXwM=; Received: from vmail1.greenie.net ([195.30.8.66]) by sfi-mx-2.v28.lw.sourceforge.com with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.94.2) id 1oJWAJ-0007fz-Uh for openvpn-devel@lists.sourceforge.net; Thu, 04 Aug 2022 08:25:19 +0000 Received: from ubuntu2004.ov.greenie.net (ubuntu2004.ov.greenie.net [IPv6:2001:608:1:995a:250:56ff:febb:2084]) by vmail1.greenie.net (8.17.1/8.16.1) with SMTP id 2748P23Y032831 for ; Thu, 4 Aug 2022 10:25:02 +0200 (CEST) Received: (nullmailer pid 1750122 invoked by uid 1000); Thu, 04 Aug 2022 08:25:02 -0000 From: Gert Doering To: openvpn-devel@lists.sourceforge.net Date: Thu, 4 Aug 2022 10:25:02 +0200 Message-Id: <20220804082502.1750074-1-gert@greenie.muc.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220803194211.1727822-1-gert@greenie.muc.de> References: <20220803194211.1727822-1-gert@greenie.muc.de> MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.4 (vmail1.greenie.net [IPv6:2001:608:1:995a:20c:29ff:feb8:10eb]); Thu, 04 Aug 2022 10:25:02 +0200 (CEST) X-Spam-Report: Spam detection software, running on the system "util-spamd-1.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: If we get a permission denied error on one DCO device, trying 255 more times will not succeed, and just fill the log file with errors. Also, remove the msg() call there because it was at debug level (needed --verb 4 to be seen), didn't see the correct errno, and the sitnl code already prints the error. Content analysis details: (-2.0 points, 6.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [195.30.8.66 listed in list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 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 X-Headers-End: 1oJWAJ-0007fz-Uh Subject: [Openvpn-devel] [PATCH v2] Break 'try 256 dco devices' loop on EPERM 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 If we get a permission denied error on one DCO device, trying 255 more times will not succeed, and just fill the log file with errors. Also, remove the msg() call there because it was at debug level (needed --verb 4 to be seen), didn't see the correct errno, and the sitnl code already prints the error. v2: use "else if" Signed-off-by: Gert Doering Acked-by: Antonio Quartulli --- src/openvpn/tun.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/openvpn/tun.c b/src/openvpn/tun.c index 02ded4d7..af283aae 100644 --- a/src/openvpn/tun.c +++ b/src/openvpn/tun.c @@ -1883,13 +1883,18 @@ open_tun_dco_generic(const char *dev, const char *dev_type, { openvpn_snprintf(dynamic_name, sizeof(dynamic_name), "%s%d", dev, i); - if (open_tun_dco(tt, ctx, dynamic_name) == 0) + int ret = open_tun_dco(tt, ctx, dynamic_name); + if (ret == 0) { dynamic_opened = true; msg(M_INFO, "DCO device %s opened", dynamic_name); break; } - msg(D_READ_WRITE | M_ERRNO, "Tried opening %s (failed)", dynamic_name); + /* "permission denied" won't succeed if we try 256 times */ + else if (ret == -EPERM) + { + break; + } } if (!dynamic_opened) {