public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/netifrc:master commit in: net/
Date: Sun, 15 Jan 2023 14:03:32 +0000 (UTC)	[thread overview]
Message-ID: <1673791390.0b8b9b13146c1eba04f2bd8d0b2b049c03891010.sam@OpenRC> (raw)

commit:     0b8b9b13146c1eba04f2bd8d0b2b049c03891010
Author:     Kerin Millar <kfm <AT> plushkava <DOT> net>
AuthorDate: Sun Jan 15 05:41:10 2023 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Sun Jan 15 14:03:10 2023 +0000
URL:        https://gitweb.gentoo.org/proj/netifrc.git/commit/?id=0b8b9b13

net/l2tp.sh: Slightly improve the structure of l2tp_pre_start()

Restructure so as to avoid an unnecessary level of indentation. The behaviour
of the function remains the same.

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

 net/l2tp.sh | 40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

diff --git a/net/l2tp.sh b/net/l2tp.sh
index 52b5733..ad459df 100644
--- a/net/l2tp.sh
+++ b/net/l2tp.sh
@@ -28,32 +28,30 @@ 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} ]"; then
-		if 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
-			eend 1 "${key} is missing at least one required parameter"
-		elif set -- "${tunnel_id}"; eval "${declared_tunnel}"; [ "$1" != "${tunnel_id}" ]; then
-			eend 1 "${key} defines a \"tunnel_id\" parameter that contradicts l2tpsession_${IFVAR}"
-		elif _l2tp_should_add_tunnel "${tunnel_id}" "${declared_tunnel}"; set -- $?; [ "$1" -eq 2 ]; then
-			eend 1 "Tunnel #${tunnel_id} exists but its properties mismatch those defined by ${key}"
-		elif [ "$1" -eq 1 ]; then
-			# The config matches an existing tunnel.
-			true
-		elif [ "${encap}" = ip ] && ! modprobe l2tp_ip; then
-			eend 1 "Couldn't load the l2tp_ip module (perhaps the CONFIG_L2TP_IP kernel option is disabled)"
-		else
-			ebegin "Creating L2TPv3 tunnel (tunnel_id ${tunnel_id})"
-			printf %s "l2tp add tunnel ${l2tptunnel}" \
-			| xargs -E '' ip
-			eend $?
-		fi
-	elif ! _l2tp_has_tunnel "${tunnel_id}"; then
+	elif key="l2tptunnel_${IFVAR}"; ! eval "[ \${${key}+set} ]" && ! _l2tp_has_tunnel "${tunnel_id}"; 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)"
+	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
+		eend 1 "${key} is missing at least one required parameter"
+	elif set -- "${tunnel_id}"; eval "${declared_tunnel}"; [ "$1" != "${tunnel_id}" ]; then
+		eend 1 "${key} defines a \"tunnel_id\" parameter that contradicts l2tpsession_${IFVAR}"
+	elif _l2tp_should_add_tunnel "${tunnel_id}" "${declared_tunnel}"; set -- $?; [ "$1" -eq 2 ]; then
+		eend 1 "Tunnel #${tunnel_id} exists but its properties mismatch those defined by ${key}"
+	elif [ "$1" -eq 1 ]; then
+		# The config matches an existing tunnel.
+		true
+	elif [ "${encap}" = ip ] && ! modprobe l2tp_ip; then
+		eend 1 "Couldn't load the l2tp_ip module (perhaps the CONFIG_L2TP_IP kernel option is disabled)"
+	else
+		ebegin "Creating L2TPv3 tunnel (tunnel_id ${tunnel_id})"
+		printf %s "l2tp add tunnel ${l2tptunnel}" \
+		| xargs -E '' ip
+		eend $?
 	fi || return
 
 	ebegin "Creating L2TPv3 session (session_id ${session_id} tunnel_id ${tunnel_id})"


             reply	other threads:[~2023-01-15 14:03 UTC|newest]

Thread overview: 112+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-15 14:03 Sam James [this message]
  -- strict thread matches above, loose matches on Subject: below --
2025-03-18 21:50 [gentoo-commits] proj/netifrc:master commit in: net/ Sam James
2025-03-18 21:50 Sam James
2025-03-18 21:50 Sam James
2024-09-29  0:28 Sam James
2024-09-23 12:02 Sam James
2024-09-09 22:43 Patrick McLean
2024-09-01  9:22 Sam James
2024-09-01  9:21 Sam James
2024-08-28 18:54 Patrick McLean
2024-06-11  0:39 Patrick McLean
2024-06-11  0:39 Patrick McLean
2024-05-23 18:12 Patrick McLean
2023-11-26  5:31 Robin H. Johnson
2023-11-25  4:52 Robin H. Johnson
2023-10-19 22:57 Sam James
2023-09-10 15:15 Sam James
2023-05-29  0:17 Mike Gilbert
2023-04-19 17:14 Robin H. Johnson
2023-04-17  4:35 Sam James
2023-02-12  6:54 Sam James
2023-01-19 18:50 Sam James
2023-01-19 18:50 Sam James
2023-01-17 15:06 Sam James
2023-01-17 15:06 Sam James
2023-01-17 15:06 Sam James
2023-01-15 20:37 Sam James
2023-01-15 14:03 Sam James
2023-01-15  1:53 Sam James
2023-01-15  1:51 Sam James
2023-01-15  1:51 Sam James
2022-12-25 19:14 Robin H. Johnson
2022-12-25 19:07 Robin H. Johnson
2021-03-31  1:11 Patrick McLean
2021-03-11 16:54 Lars Wendler
2021-03-11 16:54 Lars Wendler
2021-03-11 16:54 Lars Wendler
2021-02-02  8:28 Lars Wendler
2021-01-27 16:55 Lars Wendler
2021-01-27 14:19 Lars Wendler
2021-01-27 14:06 Lars Wendler
2021-01-24 10:37 Lars Wendler
2021-01-18 14:40 Lars Wendler
2021-01-18 13:04 Lars Wendler
2021-01-18 12:33 Lars Wendler
2021-01-18 12:33 Lars Wendler
2021-01-05 14:27 Lars Wendler
2021-01-05 12:46 Lars Wendler
2021-01-05 12:46 Lars Wendler
2020-12-15 20:11 Lars Wendler
2020-06-02 21:54 Robin H. Johnson
2020-05-31  6:05 Robin H. Johnson
2020-05-31  5:42 Robin H. Johnson
2020-05-31  5:29 Robin H. Johnson
2020-05-31  5:29 Robin H. Johnson
2020-05-31  5:13 Robin H. Johnson
2020-05-31  5:13 Robin H. Johnson
2020-01-04  8:06 Robin H. Johnson
2020-01-04  7:59 Robin H. Johnson
2019-07-09 19:59 Ben Kohler
2019-07-09 19:59 Ben Kohler
2019-07-09 17:39 Ben Kohler
2019-04-21  4:11 Robin H. Johnson
2018-07-12  6:25 Robin H. Johnson
2018-07-10 21:11 Jason Donenfeld
2018-01-21 21:59 Robin H. Johnson
2017-11-27 20:22 Robin H. Johnson
2017-11-27 20:22 Robin H. Johnson
2017-11-14 20:48 Robin H. Johnson
2017-11-14 20:48 Robin H. Johnson
2017-10-21 20:56 Robin H. Johnson
2017-06-09 23:59 Robin H. Johnson
2017-06-09 23:55 Robin H. Johnson
2017-06-09 23:52 Robin H. Johnson
2017-06-09 23:52 Robin H. Johnson
2017-01-27 21:54 Robin H. Johnson
2016-10-27  1:23 Robin H. Johnson
2016-10-24 23:16 Robin H. Johnson
2016-10-24 20:58 Robin H. Johnson
2016-10-24 16:49 Robin H. Johnson
2016-10-24  0:25 Robin H. Johnson
2016-10-24  0:23 Robin H. Johnson
2016-10-24  0:23 Robin H. Johnson
2016-10-24  0:04 Robin H. Johnson
2016-10-24  0:04 Robin H. Johnson
2016-10-23 23:50 Robin H. Johnson
2016-10-23 23:50 Robin H. Johnson
2016-10-23 23:50 Robin H. Johnson
2016-10-23 22:39 Robin H. Johnson
2016-10-23 22:39 Robin H. Johnson
2016-10-05 14:42 Robin H. Johnson
2016-07-19 19:59 Robin H. Johnson
2016-07-05 18:14 Robin H. Johnson
2016-07-05 18:14 Robin H. Johnson
2016-07-05 18:14 Robin H. Johnson
2016-07-05 18:09 Robin H. Johnson
2015-11-08 14:33 Robin H. Johnson
2015-11-08 14:30 Robin H. Johnson
2015-05-25 10:04 Mike Frysinger
2015-05-25 10:04 Mike Frysinger
2015-05-25 10:04 Mike Frysinger
2015-05-25 10:01 Mike Frysinger
2015-01-22 23:01 Robin H. Johnson
2015-01-22 23:01 Robin H. Johnson
2014-12-11 18:13 Robin H. Johnson
2014-09-24  6:19 Robin H. Johnson
2014-07-17 17:56 Robin H. Johnson
2014-07-17 17:56 Robin H. Johnson
2014-04-15 18:18 Robin H. Johnson
2013-08-28 16:59 Robin H. Johnson
2013-08-27 20:06 Ian Stakenvicius
2013-08-25  8:17 Robin H. Johnson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1673791390.0b8b9b13146c1eba04f2bd8d0b2b049c03891010.sam@OpenRC \
    --to=sam@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox