From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1478656-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 2B30815800F
	for <garchives@archives.gentoo.org>; Thu, 19 Jan 2023 18:50:19 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 65B15E08BB;
	Thu, 19 Jan 2023 18:50:18 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 50F75E08BB
	for <gentoo-commits@lists.gentoo.org>; Thu, 19 Jan 2023 18:50:18 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 5EDE3340B9C
	for <gentoo-commits@lists.gentoo.org>; Thu, 19 Jan 2023 18:50:17 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 9C03D771
	for <gentoo-commits@lists.gentoo.org>; Thu, 19 Jan 2023 18:50:15 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1674154162.e6db37173cb70183ee983aa1aaa5224a2f8c49c3.sam@OpenRC>
Subject: [gentoo-commits] proj/netifrc:master commit in: net/
X-VCS-Repository: proj/netifrc
X-VCS-Files: net/l2tp.sh
X-VCS-Directories: net/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: e6db37173cb70183ee983aa1aaa5224a2f8c49c3
X-VCS-Branch: master
Date: Thu, 19 Jan 2023 18:50:15 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 732dc358-011f-4b60-8ade-c771da49e0b9
X-Archives-Hash: 06faa4251de66eb58e8a5a54416f2d65

commit:     e6db37173cb70183ee983aa1aaa5224a2f8c49c3
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Thu Jan 19 04:47:54 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jan 19 18:49:22 2023 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=e6db3717

net/l2tp.sh: Don't try to evaluate l2tptunnel_${IFVAR} if unset

The "restructuring" commit went one step too far by combining the test for
whether l2tptunnel_${IFVAR} is defined with the test for whether the tunnel
exists, in a way that adversely affects the outer control flow. Fix it by
nesting the latter test.

Fixes: 0b8b9b13146c1eba04f2bd8d0b2b049c03891010
Signed-off-by: Kerin Millar <kfm <AT> plushkava.net>
Signed-off-by: Sam James <sam <AT> gentoo.org>

 net/l2tp.sh | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/l2tp.sh b/net/l2tp.sh
index aa8e3fd..dde86af 100644
--- a/net/l2tp.sh
+++ b/net/l2tp.sh
@@ -28,12 +28,14 @@ l2tp_pre_start() {
 		eend 1 "${key} defines a \"name\" parameter, which is forbidden by netifrc"
 	elif ! modprobe l2tp_eth; then
 		eend 1 "Couldn't load the l2tp_eth module (perhaps the CONFIG_L2TP_ETH kernel option is disabled)"
-	elif key="l2tptunnel_${IFVAR}"; ! eval "[ \${${key}+set} ]" && ! _l2tp_has_tunnel "${tunnel_id}"; then
+	elif key="l2tptunnel_${IFVAR}"; ! eval "[ \${${key}+set} ]"; then
 		# A tunnel may incorporate more than one session (link). This
 		# module allows for the user not to define a tunnel for a given
 		# session. In that case, it will be expected that the required
 		# tunnel has already been created to satisfy some other session.
-		eend 1 "Tunnel #${tunnel_id} not found (defining ${key} may be required)"
+		if ! _l2tp_has_tunnel "${tunnel_id}"; then
+			eend 1 "Tunnel #${tunnel_id} not found (defining ${key} may be required)"
+		fi
 	elif eval "l2tptunnel=\$${key}"; _is_blank "${l2tptunnel}"; then
 		eend 1 "${key} is defined but its value is blank"
 	elif ! declared_tunnel=$(_l2tp_parse_opts "${l2tptunnel}" "local peer_tunnel_id remote tunnel_id" "encap"); then