mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-19 23:43:00 +02:00
ipsec: Find correct RED IP address when using %defaultroute
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
@@ -23,6 +23,7 @@ shopt -s nullglob
|
||||
|
||||
VPN_CONFIG="/var/ipfire/vpn/config"
|
||||
|
||||
eval $(/usr/local/bin/readhash /var/ipfire/ethernet/settings)
|
||||
eval $(/usr/local/bin/readhash /var/ipfire/vpn/settings)
|
||||
|
||||
VARS=(
|
||||
@@ -42,6 +43,20 @@ main() {
|
||||
local action
|
||||
|
||||
local interfaces=()
|
||||
local vpn_ip
|
||||
|
||||
# Handle %defaultroute
|
||||
if [ "${VPN_IP}" = "%defaultroute" ]; then
|
||||
if [ -r "/var/ipfire/red/local-ipaddress" ]; then
|
||||
vpn_ip="$(</var/ipfire/red/local-ipaddress)"
|
||||
|
||||
elif [ "${RED_TYPE}" = "STATIC" -a -n "${RED_ADDRESS}" ]; then
|
||||
vpn_ip="${RED_ADDRESS}"
|
||||
|
||||
fi
|
||||
else
|
||||
vpn_ip="${VPM_IP}"
|
||||
fi
|
||||
|
||||
# We are done when IPsec is not enabled
|
||||
if [ "${ENABLED}" = "on" ]; then
|
||||
@@ -66,7 +81,7 @@ main() {
|
||||
interfaces+=( "${intf}" )
|
||||
|
||||
local args=(
|
||||
"local" "${VPN_IP}"
|
||||
"local" "${vpn_ip}"
|
||||
"remote" "${righthost}"
|
||||
"ttl" "255"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user