Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix when specifying CONFIG_FILE var #187

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ This script is designed to be run on the UDM-Pro, UDM, UDM-SE, UDR, or UXG-Pro.
[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Address = 10.68.1.88/32,fc00:dddd:eeee:bb01::5:6666/128
PostUp = sh /etc/split-vpn/vpn/updown.sh %i up
PreDown = sh /etc/split-vpn/vpn/updown.sh %i down
PreUp = CONFIG_FILE=/etc/split-vpn/vpn/vpn.conf sh /etc/split-vpn/vpn/updown.sh %i pre-up
PostUp = CONFIG_FILE=/etc/split-vpn/vpn/vpn.conf sh /etc/split-vpn/vpn/updown.sh %i up
PreDown = CONFIG_FILE=/etc/split-vpn/vpn/vpn.conf sh /etc/split-vpn/vpn/updown.sh %i down
Table = 101

[Peer]
Expand Down
3 changes: 2 additions & 1 deletion vpn/add-vpn-iptables-rules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,9 @@ delete_dns_routes() {
}

# If configuration variables are not present, source the config file from the PWD.
CONFIG_FILE="${CONFIG_FILE:-$PWD/vpn.conf}"
if [ -z "${MARK}" ]; then
. ./vpn.conf
. "$CONFIG_FILE"
fi

# Default to tun0 if no device name was passed to this script
Expand Down
5 changes: 2 additions & 3 deletions vpn/updown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -272,10 +272,9 @@ delete_all_routes() {
### END OF FUNCTIONS ###

# If configuration variables are not present, source config file from the PWD.
CONFIG_FILE=""
CONFIG_FILE="${CONFIG_FILE:-$PWD/vpn.conf}"
if [ -z "${MARK}" ]; then
CONFIG_FILE="${PWD}/vpn.conf"
. ./vpn.conf
. "$CONFIG_FILE"
fi

# If no provider was given, assume openvpn for backwards compatibility.
Expand Down