aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKerin Millar <kfm@plushkava.net>2023-01-19 04:47:54 +0000
committerSam James <sam@gentoo.org>2023-01-19 18:49:22 +0000
commite6db37173cb70183ee983aa1aaa5224a2f8c49c3 (patch)
tree0b8cc7f12538c9e1c0110e7cdc829d5ff94bf3c4
parentnet/wpa_supplicant.sh: Properly expand the number of positional parameters (diff)
downloadnetifrc-e6db37173cb70183ee983aa1aaa5224a2f8c49c3.tar.gz
netifrc-e6db37173cb70183ee983aa1aaa5224a2f8c49c3.tar.bz2
netifrc-e6db37173cb70183ee983aa1aaa5224a2f8c49c3.zip
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@plushkava.net> Signed-off-by: Sam James <sam@gentoo.org>
-rw-r--r--net/l2tp.sh6
1 files 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