mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
ipsec-interfaces: Move conditional block into the loop
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -44,25 +44,6 @@ main() {
|
|||||||
|
|
||||||
local interfaces=()
|
local interfaces=()
|
||||||
|
|
||||||
# Compat for older connections
|
|
||||||
if [ "${local}" = "off" ]; then
|
|
||||||
if [ "${VPN_IP}" = "%defaultroute" ]; then
|
|
||||||
local=""
|
|
||||||
else
|
|
||||||
local="${VPN_IP}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle %defaultroute
|
|
||||||
if [ -z "${local}" ]; then
|
|
||||||
if [ -r "/var/ipfire/red/local-ipaddress" ]; then
|
|
||||||
local="$(</var/ipfire/red/local-ipaddress)"
|
|
||||||
|
|
||||||
elif [ "${RED_TYPE}" = "STATIC" -a -n "${RED_ADDRESS}" ]; then
|
|
||||||
local="${RED_ADDRESS}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# We are done when IPsec is not enabled
|
# We are done when IPsec is not enabled
|
||||||
if [ "${ENABLED}" = "on" ]; then
|
if [ "${ENABLED}" = "on" ]; then
|
||||||
while IFS="," read -r "${VARS[@]}"; do
|
while IFS="," read -r "${VARS[@]}"; do
|
||||||
@@ -85,6 +66,25 @@ main() {
|
|||||||
# Add the interface to the list of all interfaces
|
# Add the interface to the list of all interfaces
|
||||||
interfaces+=( "${intf}" )
|
interfaces+=( "${intf}" )
|
||||||
|
|
||||||
|
# Compat for older connections
|
||||||
|
if [ "${local}" = "off" ]; then
|
||||||
|
if [ "${VPN_IP}" = "%defaultroute" ]; then
|
||||||
|
local=""
|
||||||
|
else
|
||||||
|
local="${VPN_IP}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Handle %defaultroute
|
||||||
|
if [ -z "${local}" ]; then
|
||||||
|
if [ -r "/var/ipfire/red/local-ipaddress" ]; then
|
||||||
|
local="$(</var/ipfire/red/local-ipaddress)"
|
||||||
|
|
||||||
|
elif [ "${RED_TYPE}" = "STATIC" -a -n "${RED_ADDRESS}" ]; then
|
||||||
|
local="${RED_ADDRESS}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
local args=(
|
local args=(
|
||||||
"local" "${local}"
|
"local" "${local}"
|
||||||
"remote" "${remote}"
|
"remote" "${remote}"
|
||||||
|
|||||||
Reference in New Issue
Block a user