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

Add mptcp option by default to OpenVPN #525

Merged
merged 1 commit into from
Aug 6, 2024
Merged
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
20 changes: 18 additions & 2 deletions openvpn/files/openvpn.init
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@ LIST_SEP="
UCI_STARTED=
UCI_DISABLED=

version_over_5_4() {
MAJOR_VERSION=$(uname -r | awk -F '.' '{print $1}')
MINOR_VERSION=$(uname -r | awk -F '.' '{print $2}')
if [ $MAJOR_VERSION -ge 5 ] && [ $MINOR_VERSION -gt 13 ] || [ $MAJOR_VERSION -gt 5 ] ; then
return 0
else
return 1
fi
}

append_param() {
local s="$1"
local v="$2"
Expand Down Expand Up @@ -150,6 +160,10 @@ openvpn_add_instance() {
local ipchange="$9"
local client=$(grep -qEx "client|tls-client" "$dir/$conf" && echo 1)

#if version_over_5_4; then
# PROG="mptcpize run ${PROG}"
#fi

procd_open_instance "$name"
procd_set_param command "$PROG" \
--syslog "openvpn($name)" \
Expand All @@ -167,6 +181,7 @@ openvpn_add_instance() {
${route_pre_down:+--setenv user_route_pre_down "$route_pre_down"} \
${client:+${ipchange:+--setenv user_ipchange "$ipchange"}} \
--script-security "${security:-2}" \
${mptcp:+--mptcp} \
$(openvpn_get_dev "$name" "$conf") \
$(openvpn_get_credentials "$name" "$conf")
procd_set_param file "$dir/$conf"
Expand All @@ -189,13 +204,14 @@ start_uci_instance() {
return 1
}

local up down route_up route_pre_down ipchange script_security
local up down route_up route_pre_down ipchange script_security mptcp
config_get up "$s" up
config_get down "$s" down
config_get route_up "$s" route_up
config_get route_pre_down "$s" route_pre_down
config_get ipchange "$s" ipchange
config_get script_security "$s" script_security
config_get_bool mptcp "$s" mptcp true

[ ! -d "/var/run" ] && mkdir -p "/var/run"

Expand All @@ -207,7 +223,7 @@ start_uci_instance() {
[ -n "$route_up" ] || get_openvpn_option "$config" route_up route-up
[ -n "$route_pre_down" ] || get_openvpn_option "$config" route_pre_down route-pre-down
[ -n "$ipchange" ] || get_openvpn_option "$config" ipchange ipchange
openvpn_add_instance "$s" "${config%/*}" "$config" "$script_security" "$up" "$down" "$route_up" "$route_pre_down" "$ipchange"
openvpn_add_instance "$s" "${config%/*}" "$config" "$script_security" "$up" "$down" "$route_up" "$route_pre_down" "$ipchange" "$mptcp"
return
fi

Expand Down